libsim Versione 7.1.11

◆ vol7d_recompute_stat_proc_diff()

subroutine 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 1016 del file vol7d_class_compute.F90.

1017
1018 CALL l4f_log(l4f_warn, &
1019 'compute_stat_proc_metamorph, can only be applied to average->accumulated timerange and viceversa')
1020! return an empty volume, without signaling error
1021 CALL init(that)
1022 CALL vol7d_alloc_vol(that)
1023 RETURN
1024ENDIF
1025
1026! be safe
1027CALL vol7d_alloc_vol(this)
1028
1029! useful timeranges
1030tr_mask = this%timerange(:)%timerange == stat_proc_input .AND. this%timerange(:)%p2 /= imiss &
1031 .AND. this%timerange(:)%p2 /= 0
1032
1033! initial check (necessary?)
1034IF (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
1040ENDIF
1041
1042! copy required data and reset timerange
1043CALL vol7d_copy(this, that, ltimerange=tr_mask)
1044that%timerange(:)%timerange = stat_proc
1045! why next automatic f2003 allocation does not always work?
1046ALLOCATE(int_ratio(SIZE(that%timerange)), int_ratiod(SIZE(that%timerange)))
1047
1048IF (stat_proc == 0) THEN ! average -> integral
1049 int_ratio = 1./real(that%timerange(:)%p2)
1050 int_ratiod = 1./dble(that%timerange(:)%p2)
1051ELSE ! cumulation
1052 int_ratio = real(that%timerange(:)%p2)
1053 int_ratiod = dble(that%timerange(:)%p2)
1054ENDIF
1055
1056IF (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
1064ENDIF
1065
1066IF (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
1074ENDIF
1075
1076
1077END SUBROUTINE vol7d_compute_stat_proc_metamorph
1078
1079
1080SUBROUTINE vol7d_recompute_stat_proc_agg_multiv(this, that, &
1081 step, start, frac_valid, multiv_proc)
1082TYPE(vol7d),INTENT(inout) :: this
1083TYPE(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
1085TYPE(timedelta),INTENT(in) :: step
1086TYPE(datetime),INTENT(in),OPTIONAL :: start
1087REAL,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
1090INTEGER,INTENT(in) :: multiv_proc
1091
1092INTEGER :: tri
1093INTEGER :: i, j, n, n1, ndtr, i1, i3, i5, i6
1094INTEGER :: linshape(1)
1095REAL :: lfrac_valid, frac_c, frac_m
1096LOGICAL,ALLOCATABLE :: ttr_mask(:,:)
1097TYPE(arrayof_ttr_mapper),POINTER :: map_ttr(:,:)
1098INTEGER,POINTER :: dtratio(:)
1099INTEGER :: stat_proc_input, stat_proc
1100
1101SELECT CASE(multiv_proc)
1102CASE (1) ! direction of maximum
1103 stat_proc_input = 205
1104 stat_proc=205
1105END SELECT
1106
1107tri = stat_proc_input
1108IF (PRESENT(frac_valid)) THEN
1109 lfrac_valid = frac_valid
1110ELSE
1111 lfrac_valid = 1.0
1112ENDIF
1113
1114! be safe
1115CALL vol7d_alloc_vol(this)
1116! initial check
1117
1118! cleanup the original volume
1119CALL vol7d_smart_sort(this, lsort_time=.true.) ! time-ordered volume needed
1120CALL vol7d_reform(this, miss=.false., sort=.false., unique=.true.)
1121
1122CALL init(that, time_definition=this%time_definition)
1123CALL vol7d_alloc(that, nana=SIZE(this%ana), nlevel=SIZE(this%level), &
1124 nnetwork=SIZE(this%network))
1125IF (ASSOCIATED(this%dativar%r)) THEN
1126 CALL vol7d_alloc(that, ndativarr=SIZE(this%dativar%r))
1127 that%dativar%r = this%dativar%r
1128ENDIF
1129IF (ASSOCIATED(this%dativar%d)) THEN
1130 CALL vol7d_alloc(that, ndativard=SIZE(this%dativar%d))
1131 that%dativar%d = this%dativar%d
1132ENDIF
1133that%ana = this%ana
1134that%level = this%level
1135that%network = this%network
1136
1137! compute the output time and timerange and all the required mappings
1138CALL 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)
1141CALL vol7d_alloc_vol(that)
1142
1143ALLOCATE(ttr_mask(SIZE(this%time), SIZE(this%timerange)))
1144linshape = (/SIZE(ttr_mask)/)
1145! finally perform computations
1146IF (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

Generated with Doxygen.