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