libsim  Versione 7.1.6

◆ vol7d_compute_stat_proc()

subroutine vol7d_class_compute::vol7d_compute_stat_proc ( type(vol7d), intent(inout)  this,
type(vol7d), intent(out)  that,
integer, intent(in)  stat_proc_input,
integer, intent(in)  stat_proc,
type(timedelta), intent(in)  step,
type(datetime), intent(in), optional  start,
logical, intent(in), optional  full_steps,
real, intent(in), optional  frac_valid,
type(timedelta), intent(in), optional  max_step,
logical, intent(in), optional  weighted,
type(vol7d), intent(inout), optional  other 
)

General-purpose method for computing a statistical processing on data in a vol7d object already processed with the same statistical processing, on a different time interval specified by step and start.

This method tries to apply all the suitable specialized statistical processing methods according to the input and output statistical processing requested. The argument stat_proc_input determines which data will be processed, while the stat_proc argument determines the type of statistical process to be applied and which will be owned by output data.

The possible combinations are:

  • stat_proc_input = 254
    • stat_proc = 0 average instantaneous observations
    • stat_proc = 2 compute maximum of instantaneous observations
    • stat_proc = 3 compute minimum of instantaneous observations
    • stat_proc = 4 compute difference of instantaneous observations
    • stat_proc = 6 compute standard deviation of instantaneous observations
    • stat_proc = 201 compute the prevailing direction (mode) on specified sectors, suitable only for variables representing an angle in degrees, e.g. wind direction

processing is computed on longer intervals by aggregation, see the description of vol7d_compute_stat_proc_agg()

  • stat_proc_input = *
    • stat_proc = 254 consider statistically processed values as instantaneous without any extra processing

see the description of vol7d_decompute_stat_proc()

  • stat_proc_input = 0, 1, 2, 3, 4, 200

    • stat_proc = stat_proc_input recompute input data on different intervals

    the same statistical processing is applied to obtain data processed on a different interval, either longer, by aggregation, or shorter, by differences, see the description of vol7d_recompute_stat_proc_agg() and vol7d_recompute_stat_proc_diff() respectively; it is also possible to provide stat_proc_input /= stat_proc, but it has to be used with care.

  • stat_proc_input = 0

    • stat_proc = 1

    a time-averaged rate or flux is transformed into a time-integrated value (sometimes called accumulated) on the same interval by multiplying the values by the length of the time interval in seconds, keeping constant all the rest, including the variable; the unit of the variable implicitly changes accordingly, this is supported officially in grib2 standard, in the other cases it is a forcing of the standards.

  • stat_proc_input = 1

    • stat_proc = 0

    a time-integrated value (sometimes called accumulated) is transformed into a time-averaged rate or flux on the same interval by dividing the values by the length of the time interval in seconds, see also the previous description of the opposite computation.

If a particular statistical processing cannot be performed on the input data, the program continues with a warning and, if requested, the input data is passed over to the volume specified by the other argument, in order to allow continuation of processing. All the other parameters are passed over to the specifical statistical processing methods and are documented there.

Parametri
[in,out]thisvolume providing data to be recomputed, it is not modified by the method, apart from performing a vol7d_alloc_vol on it
[out]thatoutput volume which will contain the recomputed data
[in]stat_proc_inputtype of statistical processing of data that has to be processed (from grib2 table), only data having timerange of this type will be processed, the actual statistical processing performed and which will appear in the output volume, is however determined by stat_proc argument
[in]stat_proctype of statistical processing to be recomputed (from grib2 table), data in output volume that will have a timerange of this type
[in]steplength of the step over which the statistical processing is performed
[in]startstart of statistical processing interval
[in]full_stepsif .TRUE. apply processing only on intervals starting at a forecast time or a reference time modulo step
[in]frac_validminimum fraction of valid data required for considering acceptable a recomputed value, default=1.
[in]max_stepmaximum allowed distance in time between two contiguougs valid data within an interval, for the interval to be eligible for statistical processing
[in]weightedif provided and .TRUE., the statistical process is computed, if possible, by weighting every value with a weight proportional to its validity interval
[in,out]otheroptional volume that, on exit, is going to contain the data that did not contribute to the accumulation computation

Definizione alla linea 300 del file vol7d_class_compute.F90.

302  step, this%time_definition, that%time, that%timerange, map_ttr, dtratio, &
303  start, full_steps)
304 CALL vol7d_alloc_vol(that)
305 
306 ALLOCATE(ttr_mask(SIZE(this%time), SIZE(this%timerange)))
307 linshape = (/SIZE(ttr_mask)/)
308 ! finally perform computations
309 IF (ASSOCIATED(this%voldatir)) THEN
310  DO j = 1, SIZE(that%timerange)
311  DO i = 1, SIZE(that%time)
312 
313  DO i1 = 1, SIZE(this%ana)
314  DO i3 = 1, SIZE(this%level)
315  DO i6 = 1, SIZE(this%network)
316  DO i5 = 1, SIZE(this%dativar%r)
317 
318  frac_m = 0.
319  DO n1 = SIZE(dtratio), 1, -1 ! precedence to longer periods
320  IF (dtratio(n1) <= 0) cycle ! safety check
321  ttr_mask = .false.
322  DO n = 1, map_ttr(i,j)%arraysize
323  IF (map_ttr(i,j)%array(n)%extra_info == dtratio(n1)) THEN
324  IF (c_e(this%voldatir(i1,map_ttr(i,j)%array(n)%it,i3, &
325  map_ttr(i,j)%array(n)%itr,i5,i6))) THEN
326  ttr_mask(map_ttr(i,j)%array(n)%it, &
327  map_ttr(i,j)%array(n)%itr) = .true.
328  ENDIF
329  ENDIF
330  ENDDO
331 
332  ndtr = count(ttr_mask)
333  frac_c = real(ndtr)/real(dtratio(n1))
334 
335  IF (ndtr > 0 .AND. frac_c >= max(lfrac_valid, frac_m)) THEN
336  frac_m = frac_c
337  SELECT CASE(stat_proc)
338  CASE (0, 200) ! average, vectorial mean
339  that%voldatir(i1,i,i3,j,i5,i6) = &
340  sum(this%voldatir(i1,:,i3,:,i5,i6), &
341  mask=ttr_mask)/ndtr
342  CASE (1, 4) ! accumulation, difference
343  that%voldatir(i1,i,i3,j,i5,i6) = &
344  sum(this%voldatir(i1,:,i3,:,i5,i6), &
345  mask=ttr_mask)
346  CASE (2) ! maximum
347  that%voldatir(i1,i,i3,j,i5,i6) = &
348  maxval(this%voldatir(i1,:,i3,:,i5,i6), &
349  mask=ttr_mask)
350  CASE (3) ! minimum
351  that%voldatir(i1,i,i3,j,i5,i6) = &
352  minval(this%voldatir(i1,:,i3,:,i5,i6), &
353  mask=ttr_mask)
354  CASE (6) ! stddev
355  that%voldatir(i1,i,i3,j,i5,i6) = &
356  stat_stddev( &
357  reshape(this%voldatir(i1,:,i3,:,i5,i6), shape=linshape), &
358  mask=reshape(ttr_mask, shape=linshape))
359  END SELECT
360  ENDIF
361 
362  ENDDO ! dtratio
363  ENDDO ! var
364  ENDDO ! network
365  ENDDO ! level
366  ENDDO ! ana
367  CALL delete(map_ttr(i,j))
368  ENDDO ! otime
369  ENDDO ! otimerange
370 ENDIF
371 
372 IF (ASSOCIATED(this%voldatid)) THEN
373  DO j = 1, SIZE(that%timerange)
374  DO i = 1, SIZE(that%time)
375 
376  DO i1 = 1, SIZE(this%ana)
377  DO i3 = 1, SIZE(this%level)
378  DO i6 = 1, SIZE(this%network)
379  DO i5 = 1, SIZE(this%dativar%d)
380 
381  frac_m = 0.
382  DO n1 = SIZE(dtratio), 1, -1 ! precedence to longer periods
383  IF (dtratio(n1) <= 0) cycle ! safety check
384  ttr_mask = .false.
385  DO n = 1, map_ttr(i,j)%arraysize
386  IF (map_ttr(i,j)%array(n)%extra_info == dtratio(n1)) THEN
387  IF (c_e(this%voldatid(i1,map_ttr(i,j)%array(n)%it,i3, &
388  map_ttr(i,j)%array(n)%itr,i5,i6))) THEN
389  ttr_mask(map_ttr(i,j)%array(n)%it, &
390  map_ttr(i,j)%array(n)%itr) = .true.

Generated with Doxygen.