|
◆ volgrid6d_recompute_stat_proc_diff()
subroutine volgrid6d_class_compute::volgrid6d_recompute_stat_proc_diff |
( |
type(volgrid6d), intent(inout) |
this, |
|
|
type(volgrid6d), 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, |
|
|
logical, intent(in), optional |
clone |
|
) |
| |
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. Data with both analysis/observation or forecast timerange are processed.
The output that volgrid6d 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
- 1 accumulation
- 4 difference
Input volume may have any value of thistime_definition, and that value will be conserved in the output volume. - Parametri
-
[in,out] | this | volume providing data to be recomputed, it is not modified by the method, apart from performing a volgrid6d_alloc_vol on it |
[out] | that | output volume which will contain the recomputed data |
[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 |
[in] | step | length of the step over which the statistical processing is performed |
[in] | full_steps | if provided and .TRUE., process only data having processing interval (p2) equal to a multiple of step |
[in] | start | if provided, together with full_steps, processes data on intervals starting at start +- an integer amount of step intervals |
[in] | clone | if provided and .TRUE. , clone the gaid's from this to that |
Definizione alla linea 778 del file volgrid6d_class_compute.F90.
779 IF (.NOT.((stat_proc_input == 0 .AND. stat_proc == 1) .OR. &
780 (stat_proc_input == 1 .AND. stat_proc == 0))) THEN
782 CALL l4f_category_log(this%category, l4f_warn, &
783 'compute_stat_proc_metamorph, can only be applied to average->accumulated timerange and viceversa')
786 CALL volgrid6d_alloc_vol(that)
791 CALL init(that, griddim=this%griddim, time_definition=this%time_definition)
792 CALL volgrid6d_alloc(that, dim=this%griddim%dim, ntime= SIZE(this%time), &
793 nlevel= SIZE(this%level), nvar= SIZE(this%var), ini=.false.)
794 that%time = this%time
795 that%level = this%level
798 CALL compute_stat_proc_metamorph_common(stat_proc_input, this%timerange, stat_proc, &
799 that%timerange, map_tr)
802 CALL volgrid6d_alloc_vol(that, decode= ASSOCIATED(this%voldati))
804 IF (stat_proc == 0) THEN
805 int_ratio = 1./real(that%timerange(:)%p2)
807 int_ratio = real(that%timerange(:)%p2)
810 DO i6 = 1, SIZE(this%var)
811 DO j = 1, SIZE(map_tr)
812 DO i4 = 1, SIZE(that%time)
813 DO i3 = 1, SIZE(this%level)
816 CALL copy(this%gaid(i3,i4,map_tr(j),i6), that%gaid(i3,i4,j,i6))
818 that%gaid(i3,i4,map_tr(j),i6) = this%gaid(i3,i4,j,i6)
820 CALL volgrid_get_vol_2d(this, i3, i4, map_tr(j), i6, voldatiin)
821 CALL volgrid_get_vol_2d(that, i3, i4, j, i6, voldatiout)
822 WHERE (c_e(voldatiin))
823 voldatiout = voldatiin*int_ratio(j)
827 CALL volgrid_set_vol_2d(that, i3, i4, j, i6, voldatiout)
834 END SUBROUTINE volgrid6d_compute_stat_proc_metamorph
850 SUBROUTINE volgrid6d_compute_vert_coord_var(this, level, volgrid_lev)
851 TYPE(volgrid6d), INTENT(in) :: this
852 TYPE(vol7d_level), INTENT(in) :: level
853 TYPE(volgrid6d), INTENT(out) :: volgrid_lev
855 INTEGER :: nlev, i, ii, iii, iiii
856 TYPE(grid_id) :: out_gaid
857 LOGICAL, ALLOCATABLE :: levmask(:)
858 TYPE(volgrid6d_var) :: lev_var
860 CALL init(volgrid_lev)
861 IF (.NOT. ASSOCIATED(this%gaid)) THEN
862 CALL l4f_log(l4f_error, 'volgrid6d_compute_vert_coord_var: input volume not allocated')
866 IF (c_e(level%level2) .AND. level%level1 /= level%level2) THEN
867 CALL l4f_log(l4f_error, 'volgrid6d_compute_vert_coord_var: requested (mixed) layer type not valid')
872 ALLOCATE(levmask( SIZE(this%level)))
873 levmask = this%level%level1 == level%level1 .AND. &
874 this%level%level2 == level%level2 .AND. c_e(this%level%l1)
875 IF (c_e(level%level2)) levmask = levmask .AND. c_e(this%level%l2)
876 nlev = count(levmask)
878 CALL l4f_log(l4f_error, 'volgrid6d_compute_vert_coord_var: requested level type not available')
882 out_gaid = grid_id_new()
883 gaidloop: DO i=1 , SIZE(this%gaid,1)
884 DO ii=1 , SIZE(this%gaid,2)
885 DO iii=1 , SIZE(this%gaid,3)
886 DO iiii=1 , SIZE(this%gaid,4)
887 IF (c_e(this%gaid(i,ii,iii,iiii))) THEN
888 CALL copy(this%gaid(i,ii,iii,iiii), out_gaid)
897 lev_var = convert(vol7d_var_new(btable=vol7d_level_to_var(level)), &
898 grid_id_template=out_gaid)
899 IF (.NOT.c_e(lev_var)) THEN
900 CALL l4f_log(l4f_error, 'volgrid6d_compute_vert_coord_var: no variable corresponds to requested level type')
905 CALL init(volgrid_lev, griddim=this%griddim, &
906 time_definition=this%time_definition)
907 CALL volgrid6d_alloc(volgrid_lev, ntime= SIZE(this%time), nlevel=nlev, &
908 ntimerange= SIZE(this%timerange), nvar=1)
910 volgrid_lev%time = this%time
911 volgrid_lev%level = pack(this%level, mask=levmask)
912 volgrid_lev%timerange = this%timerange
913 volgrid_lev%var(1) = lev_var
915 CALL volgrid6d_alloc_vol(volgrid_lev, decode=.true.)
918 IF (c_e(level%level2)) THEN
919 volgrid_lev%voldati(:,:,i,:,:,:) = real(volgrid_lev%level(i)%l1 + &
920 volgrid_lev%level(i)%l2)* &
921 vol7d_level_to_var_factor(volgrid_lev%level(i))/2.
923 volgrid_lev%voldati(:,:,i,:,:,:) = real(volgrid_lev%level(i)%l1)* &
924 vol7d_level_to_var_factor(volgrid_lev%level(i))
|