libsim  Versione 7.2.6
Tipi di dato | Funzioni/Subroutine
Riferimenti per il modulo volgrid6d_class

This module defines objects and methods for managing data volumes on rectangular georeferenced grids. Continua...

Tipi di dato

type  volgrid6d
 Object describing a rectangular, homogeneous gridded dataset. Continua...
 
interface  init
 Constructor, it creates a new instance of the object. Continua...
 
interface  delete
 Destructor, it releases every information and memory buffer associated with the object. Continua...
 
interface  import
 Import an object dirctly from a native file, from a gridinfo object or from a supported file format through a gridinfo object. Continua...
 
interface  export
 Export an object dirctly to a native file, to a gridinfo object or to a supported file format through a gridinfo object. Continua...
 
interface  transform
 Transform between any combination of volgrid6d and vol7d objects by means of a transform_def object describing the transformation. Continua...
 
interface  display
 Display on standard output a description of the volgrid6d object provided. Continua...
 
interface  rounding
 Reduce some dimensions (level and timerage) for semplification (rounding). Continua...
 

Funzioni/Subroutine

subroutine volgrid6d_init (this, griddim, time_definition, categoryappend)
 Constructor, it creates a new instance of the object. Continua...
 
subroutine, public volgrid6d_alloc (this, dim, ntime, nlevel, ntimerange, nvar, ini)
 Allocate the dimension descriptors of the volgrid6d object. Continua...
 
subroutine, public volgrid6d_alloc_vol (this, ini, inivol, decode)
 Allocate the data array of the volgrid6d object. Continua...
 
subroutine, public volgrid_get_vol_2d (this, ilevel, itime, itimerange, ivar, voldati)
 Return a 2-d pointer to a x-y slice of a volume. Continua...
 
subroutine, public volgrid_get_vol_3d (this, itime, itimerange, ivar, voldati)
 Return a 3-d pointer to a x-y-z slice of a volume. Continua...
 
subroutine, public volgrid_set_vol_2d (this, ilevel, itime, itimerange, ivar, voldati)
 Reset a 2-d x-y slice of a volume after the data have been modified. Continua...
 
subroutine, public volgrid_set_vol_3d (this, itime, itimerange, ivar, voldati)
 Reset a 3-d x-y-z slice of a volume after the data have been modified. Continua...
 
subroutine volgrid6d_delete (this)
 Destructor, it releases every information and memory buffer associated with the object. Continua...
 
subroutine volgrid6d_write_on_file (this, unit, description, filename, filename_auto)
 Scrittura su file di un volume Volgrid6d. Continua...
 
subroutine volgrid6d_read_from_file (this, unit, filename, description, tarray, filename_auto)
 Lettura da file di un volume Volgrid6d. Continua...
 
subroutine import_from_gridinfo (this, gridinfo, force, dup_mode, clone, isanavar)
 Import a single gridinfo object into a volgrid6d object. Continua...
 
subroutine export_to_gridinfo (this, gridinfo, itime, itimerange, ilevel, ivar, gaid_template, clone)
 Export a single grid of a volgrid6d object to a gridinfo_def object. Continua...
 
subroutine import_from_gridinfovv (this, gridinfov, dup_mode, clone, decode, time_definition, anavar, categoryappend)
 Import an array of gridinfo objects into an array of volgrid6d objects. Continua...
 
subroutine export_to_gridinfov (this, gridinfov, gaid_template, clone)
 Export a volgrid6d object to an arrayof_gridinfo object. Continua...
 
subroutine export_to_gridinfovv (this, gridinfov, gaid_template, clone)
 Export an array of volgrid6d objects to an arrayof_gridinfo object. Continua...
 
subroutine volgrid6d_import_from_file (this, filename, dup_mode, decode, time_definition, anavar, categoryappend)
 Import the content of a supported file (like grib or gdal-supported format) into an array of volgrid6d objects. Continua...
 
subroutine volgrid6d_export_to_file (this, filename, gaid_template, categoryappend)
 High level method for exporting a volume array to file. Continua...
 
subroutine volgrid6dv_delete (this)
 Array destructor for volgrid6d class. Continua...
 
subroutine volgrid6d_transform (this, griddim, volgrid6d_in, volgrid6d_out, lev_out, volgrid6d_coord_in, maskgrid, maskbounds, clone, decode, categoryappend)
 Performs the specified abstract transformation on the data provided. Continua...
 
subroutine volgrid6dv_transform (this, griddim, volgrid6d_in, volgrid6d_out, lev_out, volgrid6d_coord_in, maskgrid, maskbounds, clone, decode, categoryappend)
 Performs the specified abstract transformation on the arrays of data provided. Continua...
 
subroutine volgrid6d_v7d_transform_compute (this, volgrid6d_in, vol7d_out, networkname, noconvert)
 
subroutine volgrid6d_v7d_transform (this, volgrid6d_in, vol7d_out, v7d, maskgrid, maskbounds, networkname, noconvert, find_index, categoryappend)
 Performs the specified abstract transformation on the data provided. Continua...
 
subroutine volgrid6dv_v7d_transform (this, volgrid6d_in, vol7d_out, v7d, maskgrid, maskbounds, networkname, noconvert, find_index, categoryappend)
 Performs the specified abstract transformation on the arrays of data provided. Continua...
 
subroutine v7d_volgrid6d_transform (this, griddim, vol7d_in, volgrid6d_out, networkname, gaid_template, categoryappend)
 Performs the specified abstract transformation on the data provided. Continua...
 
subroutine v7d_v7d_transform (this, vol7d_in, vol7d_out, v7d, maskbounds, lev_out, vol7d_coord_in, categoryappend)
 Performs the specified abstract transformation on the data provided. Continua...
 
subroutine vg6d_wind_unrot (this)
 Unrotate the wind components. Continua...
 
subroutine vg6d_wind_rot (this)
 Rotate the wind components. Continua...
 
subroutine, public vg6d_c2a (this)
 Convert grids type C to type A. Continua...
 
subroutine display_volgrid6d (this)
 Display object on screen. Continua...
 
subroutine display_volgrid6dv (this)
 Display vector of object on screen. Continua...
 
subroutine vg6dv_rounding (vg6din, vg6dout, level, timerange, nostatproc, merge)
 Reduce some dimensions (level and timerage) for semplification (rounding). Continua...
 
subroutine vg6d_rounding (vg6din, vg6dout, level, timerange, nostatproc, merge)
 Reduce some dimensions (level and timerage) for semplification (rounding). Continua...
 
subroutine, public vg6d_reduce (vg6din, vg6dout, roundlevel, roundtimerange, merge)
 Reduce some dimensions (level and timerage). Continua...
 

Descrizione dettagliata

This module defines objects and methods for managing data volumes on rectangular georeferenced grids.

The data are accomodated in a multi-dimensional array with 6 predefined dimensions. Different geographic coordinates and projections are supported, mainly inspired by grib coding standards. The volgrid6d object contains information and data on an homogeneous grid definition, while different grids are managed as arrays of volgrid6d objects. Every object contains also an identificator of the grid (grid_id object), carrying information about the driver used or which has to be used for import/export from/to file. With the help of gridinfo_def class, data can be imported and exported to the supported formats, mainly grib1 and grib2 through grib_api and many GIS-style formats through gdal.

Simple example program

! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
! authors:
! Davide Cesari <dcesari@arpa.emr.it>
! Paolo Patruno <ppatruno@arpa.emr.it>
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
program demo3
implicit none
integer :: category,ier
character(len=512):: a_name
type(arrayof_gridinfo) :: gridinfoin, gridinfoout
type(volgrid6d),pointer :: volgrid(:)
TYPE(grid_file_id) :: ifile
TYPE(grid_id) :: gaid, gaid_template
INTEGER :: ngrib
!questa chiamata prende dal launcher il nome univoco
call l4f_launcher(a_name,a_name_force="demo3")
!init di log4fortran
ier=l4f_init()
!imposta a_name
category=l4f_category_get(a_name//".main")
ngrib=0
ifile = grid_file_id_new('../data/in.grb','r')
ngrib = grid_file_id_count(ifile)
call l4f_category_log(category,l4f_info,&
"Numero totale di grib: "//to_char(ngrib))
! aggiungo ngrib elementi vuoti
CALL insert(gridinfoin, nelem=ngrib)
ngrib=0
! Loop on all the messages in a file.
DO WHILE (.true.)
gaid = grid_id_new(ifile)
IF (.NOT.c_e(gaid)) EXIT
CALL l4f_category_log(category,l4f_info,import gridinfoin")
ngrib = ngrib + 1
CALL init (gridinfoin%array(ngrib), gaid=gaid, categoryappend=TRIM(to_char(ngrib)))
CALL import(gridinfoin%array(ngrib))
ENDDO
call delete(ifile)
call display(gridinfoin)
call l4f_category_log(category,L4F_INFO,"import")
call import(volgrid, gridinfoin, categoryappend="volume di test")
call l4f_category_log(category,L4F_INFO,"delete gridinfoin")
CALL delete(gridinfoin)
! qui posso fare tutti i conti possibili
gaid_template = grid_id_new(grib_api_template="regular_ll_sfc_grib1")
call l4f_category_log(category,L4F_INFO,"export a un grib fatto come voglio io")
call export(volgrid, gridinfoout, gaid_template=gaid_template)
ifile = grid_file_id_new('out.grb','w')
do ngrib=1,gridinfoout%arraysize
! write the new message to a file
if(c_e(gridinfoout%array(ngrib)%gaid)) then
call export(gridinfoout%array(ngrib))
call export(gridinfoout%array(ngrib)%gaid,ifile)
end if
end do
call delete(ifile)
call l4f_category_log(category,L4F_INFO,"terminato")
call delete(gridinfoout)
!chiudo il logger
call l4f_category_delete(category)
ier=l4f_fini()
end program demo3
Set of functions that return a CHARACTER representation of the input variable.
Destructor, it releases every information associated with the object.
Export gridinfo descriptors information into a grid_id object.
Import information from a file or grid_id object into the gridinfo descriptors.
Method for inserting elements of the array at a desired position.
Emit log message for a category with specific priority.
Global log4fortran constructor.
Function to check whether a value is missing or not.
Utilities for CHARACTER variables.
This module defines an abstract interface to different drivers for access to files containing gridded...
Class for managing information about a single gridded georeferenced field, typically imported from an...
classe per la gestione del logging
Definitions of constants and functions for working with missing values.
This module defines objects and methods for managing data volumes on rectangular georeferenced grids.

Example of transformation from volgrid6d to volgrid6d

! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
! authors:
! Davide Cesari <dcesari@arpa.emr.it>
! Paolo Patruno <ppatruno@arpa.emr.it>
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
program demo5
use grib_api
implicit none
integer :: category,ier,gaid_template
integer :: i,j
character(len=512):: a_name
type (volgrid6d),pointer :: volgrid(:),volgrid_out(:)
type(transform_def) :: trans
!questa chiamata prende dal launcher il nome univoco
call l4f_launcher(a_name,a_name_force="demo5")
!init di log4fortran
ier=l4f_init()
!imposta a_name
category=l4f_category_get(a_name//".main")
call l4f_category_log(category,l4f_info,"inizio")
call import (volgrid,filename="../data/in.grb",categoryappend="volume letto")
! qui posso fare tutti i conti possibili
!!$print*,"-------------"
!!$
!!$call griddim_unproj(volgrid(1)%griddim)
!!$
!!$print*,"sotto"
!!$
!!$do i=1,volgrid(1)%griddim%dim%nx,10
!!$ j=1
!!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
!!$end do
!!$
!!$print*,"destra"
!!$
!!$do j=1,volgrid(1)%griddim%dim%ny,10
!!$ i=volgrid(1)%griddim%dim%nx
!!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
!!$end do
!!$
!!$print*,"sopra"
!!$
!!$do i=volgrid(1)%griddim%dim%nx,1,-10
!!$ j=volgrid(1)%griddim%dim%ny
!!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
!!$end do
!!$
!!$print*,"sinistra"
!!$
!!$do j=volgrid(1)%griddim%dim%ny,1,-10
!!$ i=1
!!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
!!$end do
!!$
!!$
!!$print*,"-------------"
call init(trans, trans_type="zoom",sub_type="coord", &
ilon=-10.d0,ilat=40.d0,flon=10.d0,flat=50.d0,&
categoryappend="trasformation")
!call transform(trans,griddim, volgrid, volgrid_out,categoryappend="trasforma")
call transform(trans, volgrid6d_in=volgrid, volgrid6d_out=volgrid_out,clone=.true.,categoryappend="trasforma")
call display(volgrid_out(1)%griddim)
call l4f_category_log(category,l4f_info,"trasformato")
if (associated(volgrid)) call delete(volgrid)
!call grib_new_from_template (gaid_template,"regular_ll_sfc_grib1")
call l4f_category_log(category,l4f_info,"export a un nuovo file grib")
!call export (volgrid,filename="out.grb",gaid_template=gaid_template,categoryappend="exportazione")
call export (volgrid_out,filename="out.grb",categoryappend="exportazione")
call l4f_category_log(category,l4f_info,"terminato")
if (associated(volgrid_out)) call delete(volgrid_out)
!chiudo il logger
call l4f_category_delete(category)
ier=l4f_fini()
end program demo5
Clone the object, creating a new independent instance of the object exactly equal to the starting one...
Display on standard output a description of the gridinfo object provided.
Constructor, it creates a new instance of the object.
log4fortran destructor
Transform between any combination of volgrid6d and vol7d objects by means of a transform_def object d...
Module for describing geographically referenced regular grids.
Definition: grid_class.F90:247
Module for defining transformations between rectangular georeferenced grids and between grids and spa...

Example of transformation from volgrid6d to vol7d

! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
! authors:
! Davide Cesari <dcesari@arpa.emr.it>
! Paolo Patruno <ppatruno@arpa.emr.it>
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
program demo6
implicit none
integer :: category,ier,i,nana
character(len=512):: a_name,filename="out.bufr"
type (volgrid6d),pointer :: volgrid(:),volgrid_out(:)
type(transform_def) :: trans
type(vol7d) :: v7d
type(vol7d) :: vol7d_out
TYPE(vol7d_dballe) :: v7d_exp
!questa chiamata prende dal launcher il nome univoco
call l4f_launcher(a_name,a_name_force="demo6")
!init di log4fortran
ier=l4f_init()
!imposta a_name
category=l4f_category_get(a_name//".main")
call l4f_category_log(category,l4f_info,"inizio")
!!$ nana=5
!!$ allocate(ana(nana))
!!$ !target points
!!$ call init(ana(1),lat=45.D0,lon=11.D0)
!!$ call init(ana(2),lat=45.6D0,lon=11.8D0)
!!$ call init(ana(3),lat=46.6D0,lon=12.8D0)
!!$ call init(ana(4),lat=40.6D0,lon=11.8D0)
!!$ call init(ana(5),lat=40.0D0,lon=10.0D0)
call init(v7d)
call import (v7d,filename="ana.v7d")
call display(v7d)
!trasformation object
call init(trans, trans_type="inter",sub_type="bilin", categoryappend="trasformation")
call import (volgrid,filename="in.grb",categoryappend="volume letto")
call transform(trans, volgrid6d_in=volgrid, vol7d_out=vol7d_out, v7d=v7d, categoryappend="trasforma")
call l4f_category_log(category,l4f_info,"trasformato")
if (associated(volgrid)) call delete(volgrid)
call l4f_category_log(category,l4f_info,"export to BUFR")
! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto in export
CALL init(v7d_exp,file=.true.,write=.true.,wipe=.true.,filename=filename,&
categoryappend="exportBUFR",format="BUFR",template="synop")
CALL display(vol7d_out)
v7d_exp%vol7d = vol7d_out
CALL export(v7d_exp)
CALL l4f_category_log(category,l4f_info,"terminato")
CALL delete (v7d_exp)
!chiudo il logger
CALL l4f_category_delete(category)
ier=l4f_fini()
end program demo6
Classe per la gestione di un volume completo di dati osservati.
classe per import ed export di volumi da e in DB-All.e

Example of transformation from vol7d to volgrid6d

! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
! authors:
! Davide Cesari <dcesari@arpa.emr.it>
! Paolo Patruno <ppatruno@arpa.emr.it>
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
program demo7
implicit none
integer :: category,ier
character(len=512):: a_name,filename="out.bufr"
type (volgrid6d),pointer :: volgrid(:)
type(transform_def) :: trans
TYPE(vol7d_dballe) :: v7d_import
type(griddim_def) :: griddim_out
integer :: nx=40,ny=40,component_flag=0
type(grid_id) :: gaid_template
doubleprecision :: xmin=0., xmax=30., ymin=30., ymax=60.
doubleprecision :: latitude_south_pole=-32.5,longitude_south_pole=10.,angle_rotation=0.
character(len=80) :: type='regular_ll',trans_type='inter',sub_type='linear'
!questa chiamata prende dal launcher il nome univoco
call l4f_launcher(a_name,a_name_force="demo7")
!init di log4fortran
ier=l4f_init()
!imposta a_name
category=l4f_category_get(a_name//".main")
call l4f_category_log(category,l4f_info,"inizio")
allocate (volgrid(1))
call init(griddim_out,&
proj_type=type,nx=nx,ny=ny, &
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, component_flag=component_flag, &
latitude_south_pole=latitude_south_pole,longitude_south_pole=longitude_south_pole,angle_rotation=angle_rotation, &
categoryappend=type)
call griddim_unproj(griddim_out)
print*,'grid di interpolazione >>>>>>>>>>>>>>>>>>>>'
call display(griddim_out)
gaid_template = grid_id_new(grib_api_template="regular_ll_sfc_grib1")
!trasformation object
call init(trans, trans_type=trans_type,sub_type=sub_type, categoryappend="trasformation")
! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto in import
CALL init(v7d_import,file=.true.,write=.false.,filename=filename,&
categoryappend="importBUFR",format="BUFR")
call import (v7d_import,var=(/"B12101"/),varkind=(/"r"/))
call display(v7d_import%vol7d)
call l4f_category_log(category,l4f_info,"trasformato")
call transform(trans,griddim_out, vol7d_in=v7d_import%vol7d, &
volgrid6d_out=volgrid(1), gaid_template=gaid_template, &
categoryappend="trasform->")
call l4f_category_log(category,l4f_info,"export to GRIB")
CALL export(volgrid, 'examp[le_v7d.grb', gaid_template=gaid_template,&
categoryappend="volume scritto")
if (associated(volgrid)) call delete(volgrid)
call l4f_category_log(category,l4f_info,"terminato")
call delete (v7d_import)
!chiudo il logger
call l4f_category_delete(category)
ier=l4f_fini()
end program demo7

Generated with Doxygen.