libsim Versione 8.0.0

◆ volgrid6d_v7d_transform()

subroutine volgrid6d_v7d_transform ( type(transform_def), intent(in) this,
type(volgrid6d), intent(inout) volgrid6d_in,
type(vol7d), intent(out) vol7d_out,
type(vol7d), intent(in), optional v7d,
real, dimension(:,:), intent(in), optional maskgrid,
real, dimension(:), intent(in), optional maskbounds,
character(len=*), intent(in), optional networkname,
logical, intent(in), optional noconvert,
procedure(basic_find_index), optional, pointer find_index,
character(len=*), intent(in), optional categoryappend )

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]thisobject specifying the abstract transformation
[in,out]volgrid6d_inobject to be transformed, it is not modified, despite the INTENT(inout)
[out]vol7d_outtransformed object, it does not requires initialisation
[in]v7dobject containing a list of points over which transformation has to be done (required by some transformation types)
[in]maskgrid2D 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 type 'maskinter')
[in]maskboundsarray of boundary values for defining subareas from the values of maskgrid, the number of subareas is SIZE(maskbounds) - 1, if not provided a default based on extreme values of makgrid is used
[in]networknameset the output network name in vol7d_out (default='generic')
[in]noconvertdo not try to match variable and convert values during transform
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 2334 del file volgrid6d_class.F90.

2336 inetwork = index(vol7d_in%network,network)
2337 IF (inetwork <= 0) THEN
2338 CALL l4f_category_log(volgrid6d_out%category,l4f_warn, &
2339 'network '//trim(networkname)//' not found, first network will be transformed')
2340 inetwork = 1
2341 ENDIF
2342ELSE
2343 inetwork = 1
2344ENDIF
2345
2346! no time_definition conversion implemented, output will be the same as input
2347if (associated(vol7d_in%time))then
2348 ntime=size(vol7d_in%time)
2349 volgrid6d_out%time=vol7d_in%time
2350end if
2351
2352if (associated(vol7d_in%timerange))then
2353 ntimerange=size(vol7d_in%timerange)
2354 volgrid6d_out%timerange=vol7d_in%timerange
2355end if
2356
2357if (associated(vol7d_in%level))then
2358 nlevel=size(vol7d_in%level)
2359 volgrid6d_out%level=vol7d_in%level
2360end if
2361
2362if (associated(vol7d_in%dativar%r))then
2363 nvar=size(vol7d_in%dativar%r)
2364 CALL varbufr2vargrib(vol7d_in%dativar%r, volgrid6d_out%var, c_func, gaid_template)
2365end if
2366
2367nana=SIZE(vol7d_in%voldatir, 1)
2368! allocate once for speed
2369IF (.NOT.ASSOCIATED(volgrid6d_out%voldati)) THEN
2370 ALLOCATE(voldatiout(volgrid6d_out%griddim%dim%nx, volgrid6d_out%griddim%dim%ny, &
2371 nlevel))
2372ENDIF
2373
2374DO ivar=1,nvar
2375 DO itimerange=1,ntimerange
2376 DO itime=1,ntime
2377
2378! clone the gaid template where I have data
2379 IF (PRESENT(gaid_template)) THEN
2380 DO ilevel = 1, nlevel
2381 IF (any(c_e(vol7d_in%voldatir(:,itime,ilevel,itimerange,ivar,inetwork)))) THEN
2382 CALL copy(gaid_template, volgrid6d_out%gaid(ilevel,itime,itimerange,ivar))
2383 ELSE
2384 volgrid6d_out%gaid(ilevel,itime,itimerange,ivar) = grid_id_new()
2385 ENDIF
2386 ENDDO
2387 ENDIF
2388
2389! get data
2390 IF (ASSOCIATED(volgrid6d_out%voldati)) & ! improve!!!!
2391 CALL volgrid_get_vol_3d(volgrid6d_out, itime, itimerange, ivar, &
2392 voldatiout)
2393! do the interpolation
2394 CALL compute(this, &
2395 vol7d_in%voldatir(:,itime,:,itimerange,ivar,inetwork), voldatiout, &
2396 vol7d_in%dativar%r(ivar))
2397! rescale valid data according to variable conversion table
2398 IF (ASSOCIATED(c_func)) THEN
2399 CALL compute(c_func(ivar), voldatiout(:,:,:))
2400 ENDIF
2401! put data
2402 CALL volgrid_set_vol_3d(volgrid6d_out, itime, itimerange, ivar, &
2403 voldatiout)
2404
2405 ENDDO
2406 ENDDO
2407ENDDO
2408
2409IF (.NOT.ASSOCIATED(volgrid6d_out%voldati)) THEN
2410 DEALLOCATE(voldatiout)
2411ENDIF
2412IF (ASSOCIATED(c_func)) THEN
2413 DEALLOCATE(c_func)
2414ENDIF
2415
2416END SUBROUTINE v7d_volgrid6d_transform_compute
2417
2418
2419!> Performs the specified abstract transformation on the data provided.
2420!! The abstract transformation is specified by \a this parameter; the
2421!! corresponding specifical transformation (\a grid_transform object)
2422!! is created and destroyed internally. The output transformed object
2423!! is created internally and it does not require preliminary
2424!! initialisation.
2425SUBROUTINE v7d_volgrid6d_transform(this, griddim, vol7d_in, volgrid6d_out, &
2426 networkname, gaid_template, categoryappend)
2427TYPE(transform_def),INTENT(in) :: this !< object specifying the abstract transformation
2428TYPE(griddim_def),INTENT(in),OPTIONAL :: griddim !< griddim specifying the output grid (required by most transformation types)
2429! TODO ripristinare intent(in) dopo le opportune modifiche in grid_class.F90
2430TYPE(vol7d),INTENT(inout) :: vol7d_in !< object to be transformed, it is not modified, despite the INTENT(inout)
2431TYPE(volgrid6d),INTENT(out) :: volgrid6d_out !< transformed object, it does not require initialisation
2432CHARACTER(len=*),OPTIONAL,INTENT(in) :: networkname !< select the network to be processed from the \a vol7d input object, default the first network
2433TYPE(grid_id),OPTIONAL,INTENT(in) :: gaid_template !< the template (typically grib_api) to be associated with output data, it also helps in improving variable conversion
2434CHARACTER(len=*),INTENT(in),OPTIONAL :: categoryappend !< append this suffix to log4fortran namespace category
2435
2436type(grid_transform) :: grid_trans
2437integer :: ntime, ntimerange, nlevel, nvar
2438
2439
2440!TODO la category sarebbe da prendere da vol7d
2441!call l4f_category_log(vol7d_out%category,L4F_DEBUG,"start volgrid6d_transform")
2442
2443CALL vol7d_alloc_vol(vol7d_in) ! be safe
2444ntime=SIZE(vol7d_in%time)
2445ntimerange=SIZE(vol7d_in%timerange)
2446nlevel=SIZE(vol7d_in%level)
2447nvar=0
2448if (associated(vol7d_in%dativar%r)) nvar=size(vol7d_in%dativar%r)
2449
2450IF (nvar <= 0) THEN ! use vol7d category once it will be implemented
2451 CALL l4f_log(l4f_error, &
2452 "trying to transform a vol7d object incomplete or without real variables")
2453 CALL init(volgrid6d_out) ! initialize to empty
2454 CALL raise_error()
Index method.

Generated with Doxygen.