|
◆ 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 678 del file vol7d_class_compute.F90.
680 CALL compute_stat_proc_agg_sw(map_ttr(i,j)%array(1:ninp)%time, &
681 pstart, pend, lin_mask(1:ninp), act_max_step)
683 IF (act_max_step > lmax_step) cycle
685 SELECT CASE(stat_proc)
688 that%voldatid(i1,i,i3,j,i5,i6) = &
689 sum(real(weights(1:ndtr))*tmpvold(1:ndtr))
691 that%voldatid(i1,i,i3,j,i5,i6) = &
692 sum(tmpvold(1:ndtr))/ndtr
695 that%voldatid(i1,i,i3,j,i5,i6) = &
696 maxval(tmpvold(1:ndtr))
698 that%voldatid(i1,i,i3,j,i5,i6) = &
699 minval(tmpvold(1:ndtr))
701 that%voldatid(i1,i,i3,j,i5,i6) = &
702 stat_stddev(tmpvold(1:ndtr))
705 IF (vartype == var_dir360) THEN
708 WHERE (tmpvold(1:ndtr) == 0.0d0)
709 tmpvold(1:ndtr) = dmiss
710 ELSE WHERE (tmpvold(1:ndtr) < 22.5d0 .AND. tmpvold(1:ndtr) > 0.0d0)
711 tmpvold(1:ndtr) = tmpvold(1:ndtr) + 360.0d0
713 that%voldatid(i1,i,i3,j,i5,i6) = &
714 stat_mode_histogram(tmpvold(1:ndtr), &
724 CALL delete(map_ttr(i,j))
729 DEALLOCATE(tmpvolr, tmpvold, lin_mask, weights)
731 IF ( PRESENT(other)) THEN
732 CALL vol7d_copy(this, other, miss=.false., sort=.false., unique=.false., &
733 ltimerange=(this%timerange(:)%timerange /= tri))
736 END SUBROUTINE vol7d_compute_stat_proc_agg
754 SUBROUTINE vol7d_decompute_stat_proc(this, that, step, other, stat_proc_input)
755 TYPE(vol7d), INTENT(inout) :: this
756 TYPE(vol7d), INTENT(out) :: that
757 TYPE(timedelta), INTENT(in) :: step
758 TYPE(vol7d), INTENT(inout), OPTIONAL :: other
759 INTEGER, INTENT(in), OPTIONAL :: stat_proc_input
761 INTEGER :: i, tri, steps
764 IF ( PRESENT(stat_proc_input)) THEN
765 tri = stat_proc_input
770 CALL vol7d_alloc_vol(this)
773 CALL getval(step, asec=steps)
776 CALL vol7d_copy(this, that, miss=.false., sort=.false., unique=.false., &
777 ltimerange=(this%timerange(:)%timerange == tri .AND. &
778 this%timerange(:)%p1 == 0 .AND. this%timerange(:)%p2 == steps))
781 that%timerange(:)%timerange = 254
782 that%timerange(:)%p2 = 0
783 DO i = 1, SIZE(that%time(:))
784 that%time(i) = that%time(i) - step/2
787 IF ( PRESENT(other)) THEN
788 CALL vol7d_copy(this, other, miss=.false., sort=.false., unique=.false., &
789 ltimerange=(this%timerange(:)%timerange /= tri .OR. &
790 this%timerange(:)%p1 /= 0 .OR. this%timerange(:)%p2 /= steps))
793 END SUBROUTINE vol7d_decompute_stat_proc
822 SUBROUTINE vol7d_recompute_stat_proc_diff(this, that, stat_proc, step, full_steps, start, other)
823 TYPE(vol7d), INTENT(inout) :: this
824 TYPE(vol7d), INTENT(out) :: that
825 INTEGER, INTENT(in) :: stat_proc
826 TYPE(timedelta), INTENT(in) :: step
827 LOGICAL, INTENT(in), OPTIONAL :: full_steps
828 TYPE(datetime), INTENT(in), OPTIONAL :: start
829 TYPE(vol7d), INTENT(out), OPTIONAL :: other
831 INTEGER :: i1, i3, i5, i6, i, j, k, l, nitr, steps
832 INTEGER, ALLOCATABLE :: map_tr(:,:,:,:,:), f(:), keep_tr(:,:,:)
833 LOGICAL, ALLOCATABLE :: mask_timerange(:)
834 LOGICAL, ALLOCATABLE :: mask_time(:)
835 TYPE(vol7d) :: v7dtmp
839 CALL vol7d_alloc_vol(this)
841 CALL init(that, time_definition=this%time_definition)
844 CALL getval(step, asec=steps)
848 CALL recompute_stat_proc_diff_common(this%time, this%timerange, stat_proc, step, &
849 that%time, that%timerange, map_tr, f, keep_tr, &
850 this%time_definition, full_steps, start)
854 CALL vol7d_alloc(that, nana=0, nlevel=0, nnetwork=0)
855 CALL vol7d_alloc_vol(that)
857 ALLOCATE(mask_time( SIZE(this%time)), mask_timerange( SIZE(this%timerange)))
858 DO l = 1, SIZE(this%time)
859 mask_time(l) = any(this%time(l) == that%time(:))
861 DO l = 1, SIZE(this%timerange)
862 mask_timerange(l) = any(this%timerange(l) == that%timerange(:))
868 CALL vol7d_copy(this, v7dtmp, miss=.false., sort=.false., unique=.false., &
869 ltimerange=mask_timerange(:), ltime=mask_time(:))
871 CALL vol7d_merge(that, v7dtmp, lanasimple=.true., llevelsimple=.true.)
874 IF ( ASSOCIATED(this%voldatir)) THEN
875 DO l = 1, SIZE(this%time)
877 DO j = 1, SIZE(this%time)
879 IF (c_e(map_tr(i,j,k,l,1))) THEN
880 DO i6 = 1, SIZE(this%network)
881 DO i5 = 1, SIZE(this%dativar%r)
882 DO i3 = 1, SIZE(this%level)
883 DO i1 = 1, SIZE(this%ana)
884 IF (c_e(this%voldatir(i1,l,i3,f(k),i5,i6)) .AND. &
885 c_e(this%voldatir(i1,j,i3,f(i),i5,i6))) THEN
887 IF (stat_proc == 0) THEN
889 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = &
890 (this%voldatir(i1,l,i3,f(k),i5,i6)*this%timerange(f(k))%p2 - &
891 this%voldatir(i1,j,i3,f(i),i5,i6)*this%timerange(f(i))%p2)/ &
893 ELSE IF (stat_proc == 1 .OR. stat_proc == 4) THEN
895 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = &
896 this%voldatir(i1,l,i3,f(k),i5,i6) - &
897 this%voldatir(i1,j,i3,f(i),i5,i6)
912 IF ( ASSOCIATED(this%voldatid)) THEN
913 DO l = 1, SIZE(this%time)
915 DO j = 1, SIZE(this%time)
917 IF (c_e(map_tr(i,j,k,l,1))) THEN
918 DO i6 = 1, SIZE(this%network)
919 DO i5 = 1, SIZE(this%dativar%d)
920 DO i3 = 1, SIZE(this%level)
921 DO i1 = 1, SIZE(this%ana)
922 IF (c_e(this%voldatid(i1,l,i3,f(k),i5,i6)) .AND. &
923 c_e(this%voldatid(i1,j,i3,f(i),i5,i6))) THEN
927 IF (stat_proc == 0) THEN
929 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = &
|