libsim  Versione 7.1.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(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
[out]otheroptional volume that, on exit, is going to contain the data that did not contribute to the statistical processing

Definizione alla linea 1015 del file vol7d_class_compute.F90.

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

Generated with Doxygen.