|
◆ vol7d_compute_stat_proc_agg()
subroutine vol7d_class_compute::vol7d_compute_stat_proc_agg |
( |
type(vol7d), intent(inout) |
this, |
|
|
type(vol7d), intent(out) |
that, |
|
|
integer, intent(in) |
stat_proc, |
|
|
type(timedelta), intent(in) |
step, |
|
|
type(datetime), intent(in), optional |
start, |
|
|
logical, intent(in), optional |
full_steps, |
|
|
type(timedelta), intent(in), optional |
max_step, |
|
|
logical, intent(in), optional |
weighted, |
|
|
type(vol7d), intent(inout), optional |
other |
|
) |
| |
Method for statistically processing a set of instantaneous data.
This method performs statistical processing by aggregation of instantaneous data. Only floating point single or double precision data are processed.
The output that vol7d 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
- 6 standard deviation
- 201 mode (only for wind direction sectors)
In the case of average, it is possible to weigh the data proportionally to the length of the time interval for which every single value is valid, i.e. halfway between the time level of the value itself and the time of its nearest valid neighbours (argument weighted). 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] | this | volume providing data to be computed, it is not modified by the method, apart from performing a vol7d_alloc_vol on it |
[out] | that | output volume which will contain the computed data |
[in] | stat_proc | type of statistical processing to be computed (from grib2 table) |
[in] | step | length of the step over which the statistical processing is performed |
[in] | start | start of statistical processing interval |
[in] | full_steps | if .TRUE. and start is not provided, apply processing only on intervals starting at a forecast time or a reference time modulo step |
[in] | max_step | maximum allowed distance in time between two contiguougs valid data within an interval, for the interval to be eligible for statistical processing |
[in] | weighted | if provided and .TRUE., the statistical process is computed, if possible, by weighting every value with a weight proportional to its validity interval |
[in,out] | other | optional volume that, on exit, is going to contain the data that did not contribute to the accumulation computation |
Definizione alla linea 677 del file vol7d_class_compute.F90.
679 CALL compute_stat_proc_agg_sw(map_ttr(i,j)%array(1:ninp)%time, &
680 pstart, pend, lin_mask(1:ninp), act_max_step)
682 IF (act_max_step > lmax_step) cycle
684 SELECT CASE(stat_proc)
687 that%voldatid(i1,i,i3,j,i5,i6) = &
688 sum(real(weights(1:ndtr))*tmpvold(1:ndtr))
690 that%voldatid(i1,i,i3,j,i5,i6) = &
691 sum(tmpvold(1:ndtr))/ndtr
694 that%voldatid(i1,i,i3,j,i5,i6) = &
695 maxval(tmpvold(1:ndtr))
697 that%voldatid(i1,i,i3,j,i5,i6) = &
698 minval(tmpvold(1:ndtr))
700 that%voldatid(i1,i,i3,j,i5,i6) = &
701 stat_stddev(tmpvold(1:ndtr))
704 IF (vartype == var_dir360) THEN
707 WHERE (tmpvold(1:ndtr) == 0.0d0)
708 tmpvold(1:ndtr) = dmiss
709 ELSE WHERE (tmpvold(1:ndtr) < 22.5d0 .AND. tmpvold(1:ndtr) > 0.0d0)
710 tmpvold(1:ndtr) = tmpvold(1:ndtr) + 360.0d0
712 that%voldatid(i1,i,i3,j,i5,i6) = &
713 stat_mode_histogram(tmpvold(1:ndtr), &
723 CALL delete(map_ttr(i,j))
728 DEALLOCATE(tmpvolr, tmpvold, lin_mask, weights)
730 IF ( PRESENT(other)) THEN
731 CALL vol7d_copy(this, other, miss=.false., sort=.false., unique=.false., &
732 ltimerange=(this%timerange(:)%timerange /= tri))
735 END SUBROUTINE vol7d_compute_stat_proc_agg
753 SUBROUTINE vol7d_decompute_stat_proc(this, that, step, other, stat_proc_input)
754 TYPE(vol7d), INTENT(inout) :: this
755 TYPE(vol7d), INTENT(out) :: that
756 TYPE(timedelta), INTENT(in) :: step
757 TYPE(vol7d), INTENT(inout), OPTIONAL :: other
758 INTEGER, INTENT(in), OPTIONAL :: stat_proc_input
760 INTEGER :: i, tri, steps
763 IF ( PRESENT(stat_proc_input)) THEN
764 tri = stat_proc_input
769 CALL vol7d_alloc_vol(this)
772 CALL getval(step, asec=steps)
775 CALL vol7d_copy(this, that, miss=.false., sort=.false., unique=.false., &
776 ltimerange=(this%timerange(:)%timerange == tri .AND. &
777 this%timerange(:)%p1 == 0 .AND. this%timerange(:)%p2 == steps))
780 that%timerange(:)%timerange = 254
781 that%timerange(:)%p2 = 0
782 DO i = 1, SIZE(that%time(:))
783 that%time(i) = that%time(i) - step/2
786 IF ( PRESENT(other)) THEN
787 CALL vol7d_copy(this, other, miss=.false., sort=.false., unique=.false., &
788 ltimerange=(this%timerange(:)%timerange /= tri .OR. &
789 this%timerange(:)%p1 /= 0 .OR. this%timerange(:)%p2 /= steps))
792 END SUBROUTINE vol7d_decompute_stat_proc
821 SUBROUTINE vol7d_recompute_stat_proc_diff(this, that, stat_proc, step, full_steps, other)
822 TYPE(vol7d), INTENT(inout) :: this
823 TYPE(vol7d), INTENT(out) :: that
824 INTEGER, INTENT(in) :: stat_proc
825 TYPE(timedelta), INTENT(in) :: step
826 LOGICAL, INTENT(in), OPTIONAL :: full_steps
827 TYPE(vol7d), INTENT(out), OPTIONAL :: other
829 INTEGER :: i1, i3, i5, i6, i, j, k, l, nitr, steps
830 INTEGER, ALLOCATABLE :: map_tr(:,:,:,:,:), f(:), keep_tr(:,:,:)
831 LOGICAL, ALLOCATABLE :: mask_timerange(:)
832 LOGICAL, ALLOCATABLE :: mask_time(:)
833 TYPE(vol7d) :: v7dtmp
837 CALL vol7d_alloc_vol(this)
839 CALL init(that, time_definition=this%time_definition)
842 CALL getval(step, asec=steps)
846 CALL recompute_stat_proc_diff_common(this%time, this%timerange, stat_proc, step, &
847 that%time, that%timerange, map_tr, f, keep_tr, &
848 this%time_definition, full_steps)
852 CALL vol7d_alloc(that, nana=0, nlevel=0, nnetwork=0)
853 CALL vol7d_alloc_vol(that)
855 ALLOCATE(mask_time( SIZE(this%time)), mask_timerange( SIZE(this%timerange)))
856 DO l = 1, SIZE(this%time)
857 mask_time(l) = any(this%time(l) == that%time(:))
859 DO l = 1, SIZE(this%timerange)
860 mask_timerange(l) = any(this%timerange(l) == that%timerange(:))
866 CALL vol7d_copy(this, v7dtmp, miss=.false., sort=.false., unique=.false., &
867 ltimerange=mask_timerange(:), ltime=mask_time(:))
869 CALL vol7d_merge(that, v7dtmp, lanasimple=.true., llevelsimple=.true.)
872 IF ( ASSOCIATED(this%voldatir)) THEN
873 DO l = 1, SIZE(this%time)
875 DO j = 1, SIZE(this%time)
877 IF (c_e(map_tr(i,j,k,l,1))) THEN
878 DO i6 = 1, SIZE(this%network)
879 DO i5 = 1, SIZE(this%dativar%r)
880 DO i3 = 1, SIZE(this%level)
881 DO i1 = 1, SIZE(this%ana)
882 IF (c_e(this%voldatir(i1,l,i3,f(k),i5,i6)) .AND. &
883 c_e(this%voldatir(i1,j,i3,f(i),i5,i6))) THEN
885 IF (stat_proc == 0) THEN
887 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = &
888 (this%voldatir(i1,l,i3,f(k),i5,i6)*this%timerange(f(k))%p2 - &
889 this%voldatir(i1,j,i3,f(i),i5,i6)*this%timerange(f(i))%p2)/ &
891 ELSE IF (stat_proc == 1 .OR. stat_proc == 4) THEN
893 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = &
894 this%voldatir(i1,l,i3,f(k),i5,i6) - &
895 this%voldatir(i1,j,i3,f(i),i5,i6)
910 IF ( ASSOCIATED(this%voldatid)) THEN
911 DO l = 1, SIZE(this%time)
913 DO j = 1, SIZE(this%time)
915 IF (c_e(map_tr(i,j,k,l,1))) THEN
916 DO i6 = 1, SIZE(this%network)
917 DO i5 = 1, SIZE(this%dativar%d)
918 DO i3 = 1, SIZE(this%level)
919 DO i1 = 1, SIZE(this%ana)
920 IF (c_e(this%voldatid(i1,l,i3,f(k),i5,i6)) .AND. &
921 c_e(this%voldatid(i1,j,i3,f(i),i5,i6))) THEN
925 IF (stat_proc == 0) THEN
927 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = &
928 (this%voldatid(i1,l,i3,f(k),i5,i6)*this%timerange(f(k))%p2 - &
|