libsim  Versione 7.2.6

◆ vol7d_recompute_stat_proc_diff()

subroutine vol7d_class_compute::vol7d_recompute_stat_proc_diff ( type(vol7d), intent(inout)  this,
type(vol7d), intent(out)  that,
integer, intent(in)  stat_proc,
type(timedelta), intent(in)  step,
logical, intent(in), optional  full_steps,
type(datetime), intent(in), optional  start,
type(vol7d), intent(out), optional  other 
)

Specialized method for statistically processing a set of data already processed with the same statistical processing, on a different time interval.

This method performs statistical processing by difference of different intervals. Only floating point single or double precision data with analysis/observation or forecast timerange are processed.

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

  • real single or double precision variables
  • timerange (vol7d_timerange_class::vol7d_timerange::timerange) of type stat_proc
  • any p1 (analysis/observation or forecast)
  • p2 > 0 (processing interval non null, non instantaneous data) and equal to a multiplier of step if full_steps is .TRUE.

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

  • 0 average
  • 1 cumulation
  • 4 difference

Input volume may have any value of thistime_definition, and that value will be conserved in the output volume.

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_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]full_stepsif provided and .TRUE., process only data having processing interval (p2) equal to a multiplier of step
[in]startstart of statistical processing interval
[out]otheroptional volume that, on exit, is going to contain the data that did not contribute to the statistical processing

Definizione alla linea 1020 del file vol7d_class_compute.F90.

1021  CALL init(that)
1022  CALL vol7d_alloc_vol(that)
1023  RETURN
1024 ENDIF
1025 
1026 ! be safe
1027 CALL vol7d_alloc_vol(this)
1028 
1029 ! useful timeranges
1030 tr_mask = this%timerange(:)%timerange == stat_proc_input .AND. this%timerange(:)%p2 /= imiss &
1031  .AND. this%timerange(:)%p2 /= 0
1032 
1033 ! initial check (necessary?)
1034 IF (count(tr_mask) == 0) THEN
1035  CALL l4f_log(l4f_warn, &
1036  'vol7d_compute, no timeranges suitable for statistical processing by metamorphosis')
1037  CALL init(that)
1038 ! CALL makeother()
1039  RETURN
1040 ENDIF
1041 
1042 ! copy required data and reset timerange
1043 CALL vol7d_copy(this, that, ltimerange=tr_mask)
1044 that%timerange(:)%timerange = stat_proc
1045 ! why next automatic f2003 allocation does not always work?
1046 ALLOCATE(int_ratio(SIZE(that%timerange)), int_ratiod(SIZE(that%timerange)))
1047 
1048 IF (stat_proc == 0) THEN ! average -> integral
1049  int_ratio = 1./real(that%timerange(:)%p2)
1050  int_ratiod = 1./dble(that%timerange(:)%p2)
1051 ELSE ! cumulation
1052  int_ratio = real(that%timerange(:)%p2)
1053  int_ratiod = dble(that%timerange(:)%p2)
1054 ENDIF
1055 
1056 IF (ASSOCIATED(that%voldatir)) THEN
1057  DO j = 1, SIZE(that%timerange)
1058  WHERE(c_e(that%voldatir(:,:,:,j,:,:)))
1059  that%voldatir(:,:,:,j,:,:) = that%voldatir(:,:,:,j,:,:)*int_ratio(j)
1060  ELSEWHERE
1061  that%voldatir(:,:,:,j,:,:) = rmiss
1062  END WHERE
1063  ENDDO
1064 ENDIF
1065 
1066 IF (ASSOCIATED(that%voldatid)) THEN
1067  DO j = 1, SIZE(that%timerange)
1068  WHERE(c_e(that%voldatid(:,:,:,j,:,:)))
1069  that%voldatid(:,:,:,j,:,:) = that%voldatid(:,:,:,j,:,:)*int_ratiod(j)
1070  ELSEWHERE
1071  that%voldatid(:,:,:,j,:,:) = rmiss
1072  END WHERE
1073  ENDDO
1074 ENDIF
1075 
1076 
1077 END SUBROUTINE vol7d_compute_stat_proc_metamorph
1078 
1079 
1080 SUBROUTINE vol7d_recompute_stat_proc_agg_multiv(this, that, &
1081  step, start, frac_valid, multiv_proc)
1082 TYPE(vol7d),INTENT(inout) :: this
1083 TYPE(vol7d),INTENT(out) :: that
1084 !INTEGER,INTENT(in) :: stat_proc !< type 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
1085 TYPE(timedelta),INTENT(in) :: step
1086 TYPE(datetime),INTENT(in),OPTIONAL :: start
1087 REAL,INTENT(in),OPTIONAL :: frac_valid
1088 !TYPE(vol7d),INTENT(inout),OPTIONAL :: other !< optional volume that, on exit, is going to contain the data that did not contribute to the statistical processing
1089 !INTEGER,INTENT(in),OPTIONAL :: stat_proc_input !< to be used with care, type of statistical processing of data that has to be processed (from grib2 table), only data having timerange of this type will be recomputed, the actual statistical processing performed and which will appear in the output volume, is however determined by \a stat_proc argument
1090 INTEGER,INTENT(in) :: multiv_proc
1091 
1092 INTEGER :: tri
1093 INTEGER :: i, j, n, n1, ndtr, i1, i3, i5, i6
1094 INTEGER :: linshape(1)
1095 REAL :: lfrac_valid, frac_c, frac_m
1096 LOGICAL,ALLOCATABLE :: ttr_mask(:,:)
1097 TYPE(arrayof_ttr_mapper),POINTER :: map_ttr(:,:)
1098 INTEGER,POINTER :: dtratio(:)
1099 INTEGER :: stat_proc_input, stat_proc
1100 
1101 SELECT CASE(multiv_proc)
1102 CASE (1) ! direction of maximum
1103  stat_proc_input = 205
1104  stat_proc=205
1105 END SELECT
1106 
1107 tri = stat_proc_input
1108 IF (PRESENT(frac_valid)) THEN
1109  lfrac_valid = frac_valid
1110 ELSE
1111  lfrac_valid = 1.0
1112 ENDIF
1113 
1114 ! be safe
1115 CALL vol7d_alloc_vol(this)
1116 ! initial check
1117 
1118 ! cleanup the original volume
1119 CALL vol7d_smart_sort(this, lsort_time=.true.) ! time-ordered volume needed
1120 CALL vol7d_reform(this, miss=.false., sort=.false., unique=.true.)
1121 
1122 CALL init(that, time_definition=this%time_definition)
1123 CALL vol7d_alloc(that, nana=SIZE(this%ana), nlevel=SIZE(this%level), &
1124  nnetwork=SIZE(this%network))
1125 IF (ASSOCIATED(this%dativar%r)) THEN
1126  CALL vol7d_alloc(that, ndativarr=SIZE(this%dativar%r))
1127  that%dativar%r = this%dativar%r
1128 ENDIF
1129 IF (ASSOCIATED(this%dativar%d)) THEN
1130  CALL vol7d_alloc(that, ndativard=SIZE(this%dativar%d))
1131  that%dativar%d = this%dativar%d
1132 ENDIF
1133 that%ana = this%ana
1134 that%level = this%level
1135 that%network = this%network
1136 
1137 ! compute the output time and timerange and all the required mappings
1138 CALL recompute_stat_proc_agg_common(this%time, this%timerange, stat_proc, tri, &
1139  step, this%time_definition, that%time, that%timerange, map_ttr, &
1140  dtratio=dtratio, start=start)
1141 CALL vol7d_alloc_vol(that)
1142 
1143 ALLOCATE(ttr_mask(SIZE(this%time), SIZE(this%timerange)))
1144 linshape = (/SIZE(ttr_mask)/)
1145 ! finally perform computations
1146 IF (ASSOCIATED(this%voldatir)) THEN
1147  DO j = 1, SIZE(that%timerange)
1148  DO i = 1, SIZE(that%time)
1149 
1150  DO i1 = 1, SIZE(this%ana)
1151  DO i3 = 1, SIZE(this%level)
1152  DO i6 = 1, SIZE(this%network)
1153  DO i5 = 1, SIZE(this%dativar%r)
1154 
1155  frac_m = 0.
1156  DO n1 = SIZE(dtratio), 1, -1 ! precedence to longer periods
1157  IF (dtratio(n1) <= 0) cycle ! safety check
1158  ttr_mask = .false.
1159  DO n = 1, map_ttr(i,j)%arraysize
1160  IF (map_ttr(i,j)%array(n)%extra_info == dtratio(n1)) THEN
1161  IF (c_e(this%voldatir(i1,map_ttr(i,j)%array(n)%it,i3, &
1162  map_ttr(i,j)%array(n)%itr,i5,i6))) THEN
1163  ttr_mask(map_ttr(i,j)%array(n)%it, &
1164  map_ttr(i,j)%array(n)%itr) = .true.
1165  ENDIF
1166  ENDIF
1167  ENDDO
1168 
1169  ndtr = count(ttr_mask)
1170  frac_c = real(ndtr)/real(dtratio(n1))
1171 

Generated with Doxygen.