|
|
◆ volgrid6d_transform()
| subroutine volgrid6d_class::volgrid6d_transform |
( |
type(transform_def), intent(in) |
this, |
|
|
type(griddim_def), intent(in), optional |
griddim, |
|
|
type(volgrid6d), intent(inout) |
volgrid6d_in, |
|
|
type(volgrid6d), intent(out) |
volgrid6d_out, |
|
|
type(vol7d_level), dimension(:), intent(in), optional, target |
lev_out, |
|
|
type(volgrid6d), intent(in), optional |
volgrid6d_coord_in, |
|
|
real, dimension(:,:), intent(in), optional |
maskgrid, |
|
|
real, dimension(:), intent(in), optional |
maskbounds, |
|
|
logical, intent(in), optional |
clone, |
|
|
logical, intent(in), optional |
decode, |
|
|
character(len=*), intent(in), optional |
categoryappend |
|
) |
| |
|
private |
Performs the specified abstract transformation on the data provided.
The abstract transformation is specified by this parameter; the corresponding specifical transformation (grid_transform object) is created and destroyed internally. The output transformed object is created internally and it does not require preliminary initialisation.
- Parametri
-
| [in] | this | object specifying the abstract transformation |
| [in] | griddim | griddim specifying the output grid (required by most transformation types) |
| [in,out] | volgrid6d_in | object to be transformed, it is not modified, despite the INTENT(inout) |
| [out] | volgrid6d_out | transformed object, it does not require initialisation |
| [in] | lev_out | vol7d_level object defining target vertical grid, for vertical interpolations |
| [in] | volgrid6d_coord_in | object providing time constant input vertical coordinate for some kind of vertical interpolations |
| [in] | maskgrid | 2D field to be used for defining subareas according to its values, it must have the same shape as the field to be interpolated (for transformation subtype 'maskfill') |
| [in] | maskbounds | array of boundary values for defining a subset of valid points where the values of maskgrid are within the first and last value of maskbounds (for transformation type 'metamorphosis:maskfill') |
| [in] | clone | if provided and .TRUE. , clone the gaid's from volgrid6d_in to volgrid6d_out |
| [in] | decode | determine whether the data in volgrid6d_out should be decoded or remain coded in gaid, if not provided, the decode status is taken from volgrid6d_in |
| [in] | categoryappend | append this suffix to log4fortran namespace category |
Definizione alla linea 1851 del file volgrid6d_class.F90.
1852 CALL init(volgrid6d_out, griddim=volgrid6d_in%griddim, & 1853 time_definition=volgrid6d_in%time_definition, categoryappend=categoryappend) 1854 IF (c_e(var_coord_in)) THEN 1855 CALL init(grid_trans, this, lev_in=volgrid6d_in%level, lev_out=lev_out, & 1856 coord_3d_in=coord_3d_in, categoryappend=categoryappend) 1858 CALL init(grid_trans, this, lev_in=volgrid6d_in%level, lev_out=lev_out, & 1859 categoryappend=categoryappend) 1862 CALL get_val(grid_trans, output_level_auto=llev_out) 1863 IF (.NOT. ASSOCIATED(llev_out)) llev_out => lev_out 1864 nlevel = SIZE(llev_out) 1866 CALL l4f_category_log(volgrid6d_in%category, l4f_error, & 1867 'volgrid6d_transform: vertint requested but lev_out not provided') 1868 CALL init(volgrid6d_out) 1874 CALL init(volgrid6d_out, griddim=griddim, & 1875 time_definition=volgrid6d_in%time_definition, categoryappend=categoryappend) 1876 CALL init(grid_trans, this, in=volgrid6d_in%griddim, out=volgrid6d_out%griddim, & 1877 maskgrid=maskgrid, maskbounds=maskbounds, categoryappend=categoryappend) 1881 IF (c_e(grid_trans)) THEN 1883 CALL volgrid6d_alloc(volgrid6d_out, ntime=ntime, nlevel=nlevel, & 1884 ntimerange=ntimerange, nvar=nvar) 1886 IF ( PRESENT(decode)) THEN 1889 ldecode = ASSOCIATED(volgrid6d_in%voldati) 1892 decode_loop: DO i6 = 1,nvar 1893 DO i5 = 1, ntimerange 1896 IF (c_e(volgrid6d_in%gaid(i3,i4,i5,i6))) THEN 1897 ldecode = ldecode .OR. grid_id_readonly(volgrid6d_in%gaid(i3,i4,i5,i6)) 1905 IF ( PRESENT(decode)) THEN 1906 IF (ldecode.NEQV.decode) THEN 1907 CALL l4f_category_log(volgrid6d_in%category, l4f_warn, & 1908 'volgrid6d_transform: decode status forced to .TRUE. because driver does not allow copy') 1912 CALL volgrid6d_alloc_vol(volgrid6d_out, decode=ldecode) 1917 IF (trans_type == 'vertint') THEN 1919 CALL l4f_category_log(volgrid6d_in%category, l4f_debug, & 1920 "volgrid6d_transform: vertint to "//t2c(nlevel)// " levels") 1922 CALL compute(grid_trans, volgrid6d_in, volgrid6d_out, lev_out=llev_out, & 1923 var_coord_vol=var_coord_vol, clone=clone) 1925 CALL compute(grid_trans, volgrid6d_in, volgrid6d_out, clone=clone) 1928 IF (cf_out == 0) THEN 1929 CALL wind_unrot(volgrid6d_out) 1930 ELSE IF (cf_out == 1) THEN 1931 CALL wind_rot(volgrid6d_out) 1936 CALL l4f_category_log(volgrid6d_in%category, l4f_error, & 1937 'volgrid6d_transform: transformation not valid') 1941 CALL delete (grid_trans) 1943 END SUBROUTINE volgrid6d_transform 1954 SUBROUTINE volgrid6dv_transform(this, griddim, volgrid6d_in, volgrid6d_out, & 1955 lev_out, volgrid6d_coord_in, maskgrid, maskbounds, clone, decode, categoryappend) 1956 TYPE(transform_def), INTENT(in) :: this 1957 TYPE(griddim_def), INTENT(in), OPTIONAL :: griddim 1958 TYPE(volgrid6d), INTENT(inout) :: volgrid6d_in(:) 1959 TYPE(volgrid6d), POINTER :: volgrid6d_out(:) 1960 TYPE(vol7d_level), INTENT(in), OPTIONAL :: lev_out(:) 1961 TYPE(volgrid6d), INTENT(in), OPTIONAL :: volgrid6d_coord_in 1962 REAL, INTENT(in), OPTIONAL :: maskgrid(:,:) 1963 REAL, INTENT(in), OPTIONAL :: maskbounds(:) 1964 LOGICAL, INTENT(in), OPTIONAL :: clone 1965 LOGICAL, INTENT(in), OPTIONAL :: decode 1966 CHARACTER(len=*), INTENT(in), OPTIONAL :: categoryappend 1968 INTEGER :: i, stallo 1971 allocate(volgrid6d_out( size(volgrid6d_in)),stat=stallo) 1972 if (stallo /= 0) then 1973 call l4f_log(l4f_fatal, "allocating memory") 1974 call raise_fatal_error() 1977 do i=1, size(volgrid6d_in) 1978 call transform(this, griddim, volgrid6d_in(i), volgrid6d_out(i), & 1979 lev_out=lev_out, volgrid6d_coord_in=volgrid6d_coord_in, & 1980 maskgrid=maskgrid, maskbounds=maskbounds, & 1981 clone=clone, decode=decode, categoryappend=categoryappend) 1984 END SUBROUTINE volgrid6dv_transform 1988 SUBROUTINE volgrid6d_v7d_transform_compute(this, volgrid6d_in, vol7d_out, & 1989 networkname, noconvert) 1990 TYPE(grid_transform), INTENT(in) :: this 1991 type(volgrid6d), INTENT(in) :: volgrid6d_in 1992 type(vol7d), INTENT(inout) :: vol7d_out 1993 CHARACTER(len=*), OPTIONAL, INTENT(in) :: networkname 1994 LOGICAL, OPTIONAL, INTENT(in) :: noconvert 1996 INTEGER :: nntime, nana, ntime, ntimerange, nlevel, nvar, stallo 1997 INTEGER :: itime, itimerange, ivar, inetwork 1998 REAL, ALLOCATABLE :: voldatir_out(:,:,:) 1999 TYPE(conv_func), POINTER :: c_func(:) 2000 TYPE(datetime), ALLOCATABLE :: validitytime(:,:) 2001 REAL, POINTER :: voldatiin(:,:,:) 2004 call l4f_category_log(volgrid6d_in%category,l4f_debug, "start volgrid6d_v7d_transform_compute") 2013 if ( present(networkname)) then 2014 call init(vol7d_out%network(1),name=networkname) 2016 call init(vol7d_out%network(1),name= 'generic') 2019 if ( associated(volgrid6d_in%timerange)) then 2020 ntimerange= size(volgrid6d_in%timerange) 2021 vol7d_out%timerange=volgrid6d_in%timerange 2024 if ( associated(volgrid6d_in%time)) then 2025 ntime= size(volgrid6d_in%time) 2027 if (vol7d_out%time_definition == volgrid6d_in%time_definition) then 2030 vol7d_out%time=volgrid6d_in%time 2034 allocate (validitytime(ntime,ntimerange),stat=stallo) 2036 call l4f_category_log(volgrid6d_in%category,l4f_fatal, "allocating memory") 2037 call raise_fatal_error() 2041 do itimerange=1,ntimerange 2042 if (vol7d_out%time_definition > volgrid6d_in%time_definition) then 2043 validitytime(itime,itimerange) = & 2044 volgrid6d_in%time(itime) + timedelta_new(sec=volgrid6d_in%timerange(itimerange)%p1) 2046 validitytime(itime,itimerange) = & 2047 volgrid6d_in%time(itime) - timedelta_new(sec=volgrid6d_in%timerange(itimerange)%p1) 2052 nntime = count_distinct(reshape(validitytime,(/ntime*ntimerange/)), back=.true.) 2053 vol7d_out%time=pack_distinct(reshape(validitytime,(/ntime*ntimerange/)), nntime,back=.true.) 2058 IF ( ASSOCIATED(volgrid6d_in%level)) THEN 2059 nlevel = SIZE(volgrid6d_in%level) 2060 vol7d_out%level=volgrid6d_in%level 2063 IF ( ASSOCIATED(volgrid6d_in%var)) THEN 2064 nvar = SIZE(volgrid6d_in%var) 2065 IF (.NOT. optio_log(noconvert)) THEN 2066 CALL vargrib2varbufr(volgrid6d_in%var, vol7d_out%dativar%r, c_func) 2070 nana = SIZE(vol7d_out%ana) 2073 IF (.NOT. ASSOCIATED(volgrid6d_in%voldati)) THEN 2074 ALLOCATE(voldatiin(volgrid6d_in%griddim%dim%nx, volgrid6d_in%griddim%dim%ny, & 2078 ALLOCATE(voldatir_out(nana,1,nlevel),stat=stallo) 2079 IF (stallo /= 0) THEN 2080 CALL l4f_category_log(volgrid6d_in%category,l4f_fatal, "allocating memory") 2081 CALL raise_fatal_error() 2086 do itimerange=1,ntimerange 2098 CALL volgrid_get_vol_3d(volgrid6d_in, itime, itimerange, ivar, & 2101 CALL compute(this, voldatiin, voldatir_out, vol7d_out%dativar%r(ivar)) 2103 if (vol7d_out%time_definition == volgrid6d_in%time_definition) then 2104 vol7d_out%voldatir(:,itime,:,itimerange,ivar,inetwork) = & 2107 vol7d_out%voldatir(:, index(vol7d_out%time,validitytime(itime,itimerange)),:,itimerange,ivar,inetwork)=& 2108 reshape(voldatir_out,(/nana,nlevel/)) 2123 deallocate(voldatir_out) 2124 IF (.NOT. ASSOCIATED(volgrid6d_in%voldati)) THEN 2125 DEALLOCATE(voldatiin) 2127 if ( allocated(validitytime)) deallocate(validitytime) 2130 IF ( ASSOCIATED(c_func)) THEN 2132 CALL compute(c_func(ivar), vol7d_out%voldatir(:,:,:,:,ivar,:)) 2137 end SUBROUTINE volgrid6d_v7d_transform_compute
|