libsim  Versione6.3.0

◆ 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 1022 del file vol7d_class_compute.F90.

1022  RETURN
1023 ENDIF
1024 
1025 ! copy required data and reset timerange
1026 CALL vol7d_copy(this, that, ltimerange=tr_mask)
1027 that%timerange(:)%timerange = stat_proc
1028 ! why next automatic f2003 allocation does not always work?
1029 ALLOCATE(int_ratio(SIZE(that%timerange)), int_ratiod(SIZE(that%timerange)))
1030 
1031 IF (stat_proc == 0) THEN ! average -> integral
1032  int_ratio = 1./REAL(that%timerange(:)%p2)
1033  int_ratiod = 1./dble(that%timerange(:)%p2)
1034 ELSE ! cumulation
1035  int_ratio = REAL(that%timerange(:)%p2)
1036  int_ratiod = dble(that%timerange(:)%p2)
1037 ENDIF
1038 
1039 IF (ASSOCIATED(that%voldatir)) THEN
1040  DO j = 1, SIZE(that%timerange)
1041  WHERE(c_e(that%voldatir(:,:,:,j,:,:)))
1042  that%voldatir(:,:,:,j,:,:) = that%voldatir(:,:,:,j,:,:)*int_ratio(j)
1043  ELSEWHERE
1044  that%voldatir(:,:,:,j,:,:) = rmiss
1045  END WHERE
1046  ENDDO
1047 ENDIF
1048 
1049 IF (ASSOCIATED(that%voldatid)) THEN
1050  DO j = 1, SIZE(that%timerange)
1051  WHERE(c_e(that%voldatid(:,:,:,j,:,:)))
1052  that%voldatid(:,:,:,j,:,:) = that%voldatid(:,:,:,j,:,:)*int_ratiod(j)
1053  ELSEWHERE
1054  that%voldatid(:,:,:,j,:,:) = rmiss
1055  END WHERE
1056  ENDDO
1057 ENDIF
1058 
1059 
1060 END SUBROUTINE vol7d_compute_stat_proc_metamorph
1061 
1062 
1079 SUBROUTINE vol7d_fill_time(this, that, step, start, stopp, cyclicdt)
1080 TYPE(vol7d),INTENT(inout) :: this
1081 TYPE(vol7d),INTENT(inout) :: that
1082 TYPE(timedelta),INTENT(in) :: step
1083 TYPE(datetime),INTENT(in),OPTIONAL :: start
1084 TYPE(datetime),INTENT(in),OPTIONAL :: stopp
1085 TYPE(cyclicdatetime),INTENT(in),OPTIONAL :: cyclicdt
1086 
1087 TYPE(cyclicdatetime) :: lcyclicdt
1088 TYPE(datetime) :: counter, lstart, lstop
1089 INTEGER :: i, naddtime
1090 
1091 CALL safe_start_stop(this, lstart, lstop, start, stopp)
1092 IF (.NOT. c_e(lstart) .OR. .NOT. c_e(lstop) .OR. .NOT. c_e(step)) RETURN
1093 
1094 lcyclicdt=cyclicdatetime_miss
1095 if (present(cyclicdt)) then
1096  if(c_e(cyclicdt)) lcyclicdt=cyclicdt
1097 end if
1098 
1099 CALL l4f_log(l4f_info, 'vol7d_fill_time: time interval '//trim(to_char(lstart))// &
1100  ' '//trim(to_char(lstop)))
1101 
1102 ! Count the number of time levels required for completing the series
1103 ! valid also in the case (SIZE(this%time) == 0)
1104 naddtime = 0
1105 counter = lstart
1106 i = 1
1107 naddcount: DO WHILE(counter <= lstop)
1108  DO WHILE(i <= SIZE(this%time)) ! this%time(i) chases counter
1109  IF (counter < this%time(i)) THEN ! this%time(i) overtook counter
1110  i = max(i-1,1) ! go back if possible
1111  EXIT
1112  ELSE IF (counter == this%time(i) .OR. .NOT. counter == lcyclicdt) THEN ! found matching time
1113  counter = counter + step
1114  cycle naddcount
1115  ENDIF
1116  i = i + 1
1117  ENDDO
1118  naddtime = naddtime + 1
1119  counter = counter + step
1120 ENDDO naddcount
1121 
1122 ! old universal algorithm, not optimized, check that the new one is equivalent
1123 !naddtime = 0
1124 !counter = lstart
1125 !DO WHILE(counter <= lstop)
1126 ! IF (.NOT.ANY(counter == this%time(:))) THEN
1127 ! naddtime = naddtime + 1
1128 ! ENDIF
1129 ! counter = counter + step
1130 !ENDDO
1131 
1132 IF (naddtime > 0) THEN
1133 
1134  CALL init(that)
1135  CALL vol7d_alloc(that, ntime=naddtime)
1136  CALL vol7d_alloc_vol(that)
1137 
1138  ! Repeat the count loop setting the time levels to be added
1139  naddtime = 0
1140  counter = lstart
1141  i = 1
1142  naddadd: DO WHILE(counter <= lstop)
1143  DO WHILE(i <= SIZE(this%time)) ! this%time(i) chases counter
1144  IF (counter < this%time(i)) THEN ! this%time(i) overtook counter
1145  i = max(i-1,1) ! go back if possible
1146  EXIT
1147  ELSE IF (counter == this%time(i) .OR. .NOT. counter == lcyclicdt) THEN ! found matching time
1148  counter = counter + step
1149  cycle naddadd
1150  ENDIF
1151  i = i + 1
1152  ENDDO
1153  naddtime = naddtime + 1
1154  that%time(naddtime) = counter ! only difference
1155  counter = counter + step
1156  ENDDO naddadd
1157 
1158  CALL vol7d_append(that, this, sort=.true.)
1159 
1160 ELSE
1161 !! ? why sort all dimension ?
1162 !! CALL vol7d_copy(this, that, lsort_time=.TRUE.)
1163  CALL vol7d_copy(this, that, sort=.true.)
1164 ENDIF
1165 
1166 
1167 END SUBROUTINE vol7d_fill_time
1168 
1169 
Restituiscono il valore dell&#39;oggetto in forma di stringa stampabile.
Costruttori per le classi datetime e timedelta.

Generated with Doxygen.