|
◆ 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, |
|
|
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] | 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 693 del file vol7d_class_compute.F90.
694 IF (vartype == var_dir360) THEN 696 WHERE (tmpvold(1:ndtr) > 337.5) 697 tmpvold(1:ndtr) = tmpvold(1:ndtr) - 360. 699 that%voldatid(i1,i,i3,j,i5,i6) = & 700 stat_mode_histogram(tmpvold(1:ndtr), & 715 DEALLOCATE(tmpvolr, tmpvold, lin_mask, weights) 717 IF ( PRESENT(other)) THEN 718 CALL vol7d_copy(this, other, miss=.false., sort=.false., unique=.false., & 719 ltimerange=(this%timerange(:)%timerange /= tri)) 722 END SUBROUTINE vol7d_compute_stat_proc_agg 740 SUBROUTINE vol7d_decompute_stat_proc(this, that, step, other, stat_proc_input) 741 TYPE(vol7d), INTENT(inout) :: this 742 TYPE(vol7d), INTENT(out) :: that 743 TYPE(timedelta), INTENT(in) :: step 744 TYPE(vol7d), INTENT(inout), OPTIONAL :: other 745 INTEGER, INTENT(in), OPTIONAL :: stat_proc_input 747 INTEGER :: i, tri, steps 750 IF ( PRESENT(stat_proc_input)) THEN 751 tri = stat_proc_input 756 CALL vol7d_alloc_vol(this) 759 CALL getval(step, asec=steps) 762 CALL vol7d_copy(this, that, miss=.false., sort=.false., unique=.false., & 763 ltimerange=(this%timerange(:)%timerange == tri .AND. & 764 this%timerange(:)%p1 == 0 .AND. this%timerange(:)%p2 == steps)) 767 that%timerange(:)%timerange = 254 768 that%timerange(:)%p2 = 0 769 DO i = 1, SIZE(that%time(:)) 770 that%time(i) = that%time(i) - step/2 773 IF ( PRESENT(other)) THEN 774 CALL vol7d_copy(this, other, miss=.false., sort=.false., unique=.false., & 775 ltimerange=(this%timerange(:)%timerange /= tri .OR. & 776 this%timerange(:)%p1 /= 0 .OR. this%timerange(:)%p2 /= steps)) 779 END SUBROUTINE vol7d_decompute_stat_proc 808 SUBROUTINE vol7d_recompute_stat_proc_diff(this, that, stat_proc, step, full_steps, other) 809 TYPE(vol7d), INTENT(inout) :: this 810 TYPE(vol7d), INTENT(out) :: that 811 INTEGER, INTENT(in) :: stat_proc 812 TYPE(timedelta), INTENT(in) :: step 813 LOGICAL, INTENT(in), OPTIONAL :: full_steps 814 TYPE(vol7d), INTENT(out), OPTIONAL :: other 816 INTEGER :: i1, i3, i5, i6, i, j, k, l, nitr, steps 817 INTEGER, POINTER :: map_tr(:,:,:,:,:), f(:) 818 LOGICAL, POINTER :: mask_timerange(:) 819 LOGICAL, ALLOCATABLE :: mask_time(:) 820 TYPE(vol7d) :: v7dtmp 824 CALL vol7d_alloc_vol(this) 826 CALL init(that, time_definition=this%time_definition) 829 CALL getval(step, asec=steps) 833 CALL recompute_stat_proc_diff_common(this%time, this%timerange, stat_proc, step, & 834 nitr, that%time, that%timerange, map_tr, f, mask_timerange, & 835 this%time_definition, full_steps) 838 CALL vol7d_alloc(that, nana=0, nlevel=0, nnetwork=0) 839 CALL vol7d_alloc_vol(that) 841 ALLOCATE(mask_time( SIZE(this%time))) 842 DO l = 1, SIZE(this%time) 843 mask_time(l) = any(this%time(l) == that%time(:)) 849 CALL vol7d_copy(this, v7dtmp, miss=.false., sort=.false., unique=.false., & 850 ltimerange=mask_timerange(:), ltime=mask_time(:)) 852 CALL vol7d_merge(that, v7dtmp, lanasimple=.true., llevelsimple=.true.) 853 DEALLOCATE(mask_time) 856 IF ( ASSOCIATED(this%voldatir)) THEN 857 DO l = 1, SIZE(this%time) 859 DO j = 1, SIZE(this%time) 861 IF ( c_e(map_tr(i,j,k,l,1))) THEN 862 DO i6 = 1, SIZE(this%network) 863 DO i5 = 1, SIZE(this%dativar%r) 864 DO i3 = 1, SIZE(this%level) 865 DO i1 = 1, SIZE(this%ana) 866 IF ( c_e(this%voldatir(i1,l,i3,f(k),i5,i6)) .AND. & 867 c_e(this%voldatir(i1,j,i3,f(i),i5,i6))) THEN 869 IF (stat_proc == 0) THEN 871 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = & 872 (this%voldatir(i1,l,i3,f(k),i5,i6)*this%timerange(f(k))%p2 - & 873 this%voldatir(i1,j,i3,f(i),i5,i6)*this%timerange(f(i))%p2)/ & 875 ELSE IF (stat_proc == 1 .OR. stat_proc == 4) THEN 877 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = & 878 this%voldatir(i1,l,i3,f(k),i5,i6) - & 879 this%voldatir(i1,j,i3,f(i),i5,i6) 894 IF ( ASSOCIATED(this%voldatid)) THEN 895 DO l = 1, SIZE(this%time) 897 DO j = 1, SIZE(this%time) 899 IF ( c_e(map_tr(i,j,k,l,1))) THEN 900 DO i6 = 1, SIZE(this%network) 901 DO i5 = 1, SIZE(this%dativar%d) 902 DO i3 = 1, SIZE(this%level) 903 DO i1 = 1, SIZE(this%ana) 904 IF ( c_e(this%voldatid(i1,l,i3,f(k),i5,i6)) .AND. & 905 c_e(this%voldatid(i1,j,i3,f(i),i5,i6))) THEN 909 IF (stat_proc == 0) THEN 911 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = & 912 (this%voldatid(i1,l,i3,f(k),i5,i6)*this%timerange(f(k))%p2 - & 913 this%voldatid(i1,j,i3,f(i),i5,i6)*this%timerange(f(i))%p2)/ & 915 ELSE IF (stat_proc == 1 .OR. stat_proc == 4) THEN 917 i1,map_tr(i,j,k,l,1),i3,map_tr(i,j,k,l,2),i5,i6) = & 918 this%voldatid(i1,l,i3,f(k),i5,i6) - & 919 this%voldatid(i1,j,i3,f(i),i5,i6) Distruttori per le 2 classi.
Restituiscono il valore dell'oggetto nella forma desiderata.
Costruttori per le classi datetime e timedelta.
|