libsim  Versione6.3.0

◆ volgrid6d_compute_stat_proc_agg()

subroutine volgrid6d_class_compute::volgrid6d_compute_stat_proc_agg ( type(volgrid6d), intent(inout)  this,
type(volgrid6d), intent(out)  that,
integer, intent(in)  stat_proc,
type(timedelta), intent(in)  step,
type(datetime), intent(in), optional  start,
type(timedelta), intent(in), optional  max_step,
logical, intent(in), optional  clone 
)

Method for statistically processing a set of instantaneous data.

This method performs statistical processing by aggregation of instantaneous data.

The output that volgrid6d object contains elements from the original volume this satisfying the conditions

Output data will have timerange of type stat_proc, and p2 = step. The supported statistical processing methods (parameter stat_proc) are:

  • 0 average
  • 2 maximum
  • 3 minimum
  • 4 difference

A maximum distance in time for input valid data can be assigned with the optional argument max_step, in order to filter datasets with too long "holes".

Parametri
[in,out]thisvolume providing data to be recomputed, it is not modified by the method, apart from performing a volgrid6d_alloc_vol on it
[out]thatoutput volume which will contain the recomputed data
[in]stat_proctype of statistical processing to be recomputed (from grib2 table), only data having timerange of this type will be recomputed and will appear in the output volume
[in]steplength of the step over which the statistical processing is performed
[in]startstart of statistical processing interval
[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]cloneif provided and .TRUE. , clone the gaid's from this to that

Definizione alla linea 580 del file volgrid6d_class_compute.F90.

580  voldatiin2(this%griddim%dim%nx, this%griddim%dim%ny), &
581  voldatiout(this%griddim%dim%nx, this%griddim%dim%ny))
582 ENDIF
583 
584 ! copy the timeranges already satisfying the requested step, if any
585 DO i = 1, SIZE(mask_timerange)
586  IF (mask_timerange(i)) THEN
587  k = firsttrue(that%timerange(:) == this%timerange(i))
588 #ifdef DEBUG
589  CALL l4f_category_log(this%category, l4f_info, &
590  'volgrid6d_recompute_stat_proc_diff, good timerange: '//t2c(i)// &
591  '->'//t2c(k))
592 #endif
593  IF (k > 0) THEN
594 
595  DO i6 = 1, SIZE(this%var)
596  DO i4 = 1, SIZE(this%time)
597  l = firsttrue(that%time(:) == this%time(i4))
598  IF (l > 0) THEN
599  DO i3 = 1, SIZE(this%level)
600  IF (c_e(this%gaid(i3,i4,i,i6))) THEN
601  IF (lclone) THEN
602  CALL copy(this%gaid(i3,i4,i,i6), that%gaid(i3,l,k,i6))
603  ELSE
604  that%gaid(i3,l,k,i6) = this%gaid(i3,i4,i,i6)
605  ENDIF
606  IF (ASSOCIATED(that%voldati)) THEN
607  that%voldati(:,:,i3,l,k,i6) = this%voldati(:,:,i3,i4,i,i6)
608  ELSE
609  CALL volgrid_get_vol_2d(this, i3, i4, i, i6, voldatiout)
610  CALL volgrid_set_vol_2d(that, i3, l, k, i6, voldatiout)
611  ENDIF
612  ENDIF
613  ENDDO
614  ENDIF
615  ENDDO
616  ENDDO
617 
618  ENDIF
619  ENDIF
620 ENDDO
621 
622 ! compute statistical processing
623 DO l = 1, SIZE(this%time)
624  DO k = 1, nitr
625  DO j = 1, SIZE(this%time)
626  DO i = 1, nitr
627  IF (c_e(map_tr(i,j,k,l,1))) THEN
628  DO i6 = 1, SIZE(this%var)
629  DO i3 = 1, SIZE(this%level)
630 
631  IF (c_e(this%gaid(i3,j,f(i),i6)) .AND. &
632  c_e(this%gaid(i3,l,f(k),i6))) THEN
633 ! take the gaid from the second time/timerange contributing to the
634 ! result (l,f(k))
635  IF (lclone) THEN
636  CALL copy(this%gaid(i3,l,f(k),i6), &
637  that%gaid(i3,map_tr(i,j,k,l,1),map_tr(i,j,k,l,2),i6))
638  ELSE
639  that%gaid(i3,map_tr(i,j,k,l,1),map_tr(i,j,k,l,2),i6) = &
640  this%gaid(i3,l,f(k),i6)
641  ENDIF
642 
643 ! get/set 2d sections API is used
644  CALL volgrid_get_vol_2d(this, i3, l, f(k), i6, voldatiin1)
645  CALL volgrid_get_vol_2d(this, i3, j, f(i), i6, voldatiin2)
646  IF (ASSOCIATED(that%voldati)) &
647  CALL volgrid_get_vol_2d(that, i3, &
648  map_tr(i,j,k,l,1), map_tr(i,j,k,l,2), i6, voldatiout)
649 
650  IF (stat_proc == 0) THEN ! average
651  WHERE(c_e(voldatiin1(:,:)) .AND. c_e(voldatiin2(:,:)))
652  voldatiout(:,:) = &
653  (voldatiin1(:,:)*this%timerange(f(k))%p2 - &
654  voldatiin2(:,:)*this%timerange(f(i))%p2)/ &
655  steps
656  ELSEWHERE
657  voldatiout(:,:) = rmiss
658  END WHERE
659  ELSE IF (stat_proc == 1 .OR. stat_proc == 4) THEN ! acc, diff
660  WHERE(c_e(voldatiin1(:,:)) .AND. c_e(voldatiin2(:,:)))
661  voldatiout(:,:) = voldatiin1(:,:) - voldatiin2(:,:)
662  ELSEWHERE
663  voldatiout(:,:) = rmiss
664  END WHERE
665  ENDIF
666 
667  CALL volgrid_set_vol_2d(that, i3, &
668  map_tr(i,j,k,l,1), map_tr(i,j,k,l,2), i6, voldatiout)
669 
670  ENDIF
671  ENDDO
672  ENDDO
673  ENDIF
674  ENDDO
675  ENDDO
676  ENDDO
677 ENDDO
678 
679 IF (.NOT.ASSOCIATED(that%voldati)) THEN
680  DEALLOCATE(voldatiin1, voldatiin2, voldatiout)
681 ENDIF
682 
683 END SUBROUTINE volgrid6d_recompute_stat_proc_diff
684 
685 
713 SUBROUTINE volgrid6d_compute_stat_proc_metamorph(this, that, stat_proc_input, stat_proc, clone)
714 TYPE(volgrid6d),INTENT(inout) :: this
715 TYPE(volgrid6d),INTENT(out) :: that
716 INTEGER,INTENT(in) :: stat_proc_input
717 INTEGER,INTENT(in) :: stat_proc
718 LOGICAL , INTENT(in),OPTIONAL :: clone
719 
720 INTEGER i, j, n, i3, i4, i6
721 INTEGER,POINTER :: map_tr(:), map_trc(:,:), count_trc(:,:)
722 REAL,POINTER :: voldatiin(:,:), voldatiout(:,:)
723 REAL,ALLOCATABLE :: int_ratio(:)
724 LOGICAL :: lclone
Functions that return a trimmed CHARACTER representation of the input variable.

Generated with Doxygen.