libsim Versione 7.2.1
Tipi di dato | Funzioni/Subroutine
Riferimenti per il modulo gridinfo_class

Class for managing information about a single gridded georeferenced field, typically imported from an on-disk dataset like a grib file (grib_api driver) or a file in a gdal-supported format (gdal driver). Continua...

Tipi di dato

interface  append
 Quick method to append an element to the array. Continua...
 
type  arrayof_gridinfo
 Derived type defining a dynamically extensible array of TYPE(gridinfo_def) elements. Continua...
 
interface  clone
 Clone the object, creating a new independent instance of the object exactly equal to the starting one. Continua...
 
interface  decode_gridinfo
 Decode and return the data array from a grid_id object associated to a gridinfo object. Continua...
 
interface  delete
 Destructor, it releases every information associated with the object. Continua...
 
interface  display
 Display on standard output a description of the gridinfo object provided. Continua...
 
interface  encode_gridinfo
 Encode a data array into a grid_id object associated to a gridinfo object. Continua...
 
interface  export
 Export gridinfo descriptors information into a grid_id object. Continua...
 
type  gridinfo_def
 Object describing a single gridded message/band. Continua...
 
interface  import
 Import information from a file or grid_id object into the gridinfo descriptors. Continua...
 
interface  init
 Constructor, it creates a new instance of the object. Continua...
 
interface  insert
 Method for inserting elements of the array at a desired position. Continua...
 
interface  packarray
 Method for packing the array object reducing at a minimum the memory occupation, without destroying its contents. Continua...
 
interface  remove
 Method for removing elements of the array at a desired position. Continua...
 

Funzioni/Subroutine

subroutine, private arrayof_gridinfo_insert_array (this, content, nelem, pos)
 Method for inserting a number of elements of the array at a desired position.
 
subroutine, private arrayof_gridinfo_insert (this, content, pos)
 Method for inserting an element of the array at a desired position.
 
integer function, private arrayof_gridinfo_append (this, content)
 Quick method to append an element to the array.
 
subroutine, private arrayof_gridinfo_remove (this, nelem, pos, nodestroy)
 Method for removing elements of the array at a desired position.
 
subroutine, private arrayof_gridinfo_delete (this, nodestroy, nodealloc)
 Destructor for finalizing an array object.
 
subroutine, private arrayof_gridinfo_packarray (this)
 Method for packing the array object reducing at a minimum the memory occupation, without destroying its contents.
 
subroutine gridinfo_init (this, gaid, griddim, time, timerange, level, var, clone, categoryappend)
 Constructor, it creates a new instance of the object.
 
subroutine gridinfo_delete (this)
 Destructor, it releases every information associated with the object.
 
subroutine gridinfo_display (this, namespace)
 Display on standard output a description of the gridinfo object provided.
 
subroutine gridinfov_display (this, namespace)
 The same as gridinfo_display(), but it receives an array of gridinfo objects.
 
subroutine gridinfo_clone (this, that, categoryappend)
 Clone the object, creating a new independent instance of the object exactly equal to the starting one.
 
subroutine gridinfo_import (this)
 Import grid_id information into a gridinfo object.
 
subroutine gridinfo_import_from_file (this, filename, categoryappend)
 Import an array of gridinfo from a file.
 
subroutine gridinfo_export (this)
 Export gridinfo descriptors information into a message/band on file.
 
subroutine gridinfo_export_to_file (this, filename, categoryappend)
 Export an arrayof_gridinfo object to a file.
 
real function, dimension(this%griddim%dim%nx, this%griddim%dim%ny) gridinfo_decode_data (this)
 Decode and return the data array from a grid_id object associated to a gridinfo object.
 
subroutine gridinfo_encode_data (this, field)
 Encode a data array into a grid_id object associated to a gridinfo object.
 

Descrizione dettagliata

Class for managing information about a single gridded georeferenced field, typically imported from an on-disk dataset like a grib file (grib_api driver) or a file in a gdal-supported format (gdal driver).

This module defines a gridinfo (gridinfo_def TYPE) class which can contain information about a single field on a rectangular georeferenced grid, including:

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. The identificator should be associated to the gridinfo object at initialization time.

The main methods of this class allow to:

Simple example of use:

! 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 demo2
implicit none
integer :: category,ier
character(len=512):: a_name
type(arrayof_gridinfo) :: gridinfo
TYPE(grid_file_id) :: ifile
TYPE(grid_id) :: gaid
INTEGER :: ngrib
!questa chiamata prende dal launcher il nome univoco
call l4f_launcher(a_name,a_name_force="demo2")
!imposta a_name
category=l4f_category_get(a_name//".main")
!init di log4fortran
ier=l4f_init()
ngrib=0
ifile = grid_file_id_new('../data/in.grb','r')
! Loop on all the messages in a file.
DO WHILE (.true.)
gaid = grid_id_new(ifile)
IF (.NOT.c_e(gaid)) EXIT
ngrib = ngrib + 1
CALL delete(gaid)
ENDDO
CALL delete(ifile)
CALL l4f_category_log(category,l4f_info,&
"Numero totale di grib: "//to_char(ngrib))
! aggiungo ngrib elementi vuoti
CALL insert(gridinfo, nelem=ngrib)
ngrib=0
ifile = grid_file_id_new('../data/in.grb','r')
! 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 grib")
ngrib = ngrib + 1
CALL init (gridinfo%array(ngrib), gaid=gaid)
CALL import(gridinfo%array(ngrib))
ENDDO
call delete(ifile)
call display(gridinfo)
CALL delete(gridinfo)
call l4f_category_log(category,l4f_info,"terminato ")
!chiudo il logger
call l4f_category_delete(category)
ier=l4f_fini()
end program demo2
Destructor for the line_split class.
Set of functions that return a CHARACTER representation of the input variable.
Check whether the corresponding object has been correctly associated.
Display on standard output a description of the grid_id object provided.
Constructors for the corresponding classes in SUBROUTINE form.
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.
log4fortran destructor
Global log4fortran constructor.
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

More complex example:

! 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 demo4
implicit none
integer :: category,ier
character(len=512):: a_name,infile='../data/in.grb',outfile='out.grb'
type (gridinfo_def) :: gridinfo
type(grid_file_id) :: ifile,ofile
type(grid_id) :: gaid
doubleprecision :: ilon=0.,ilat=30.,flon=30.,flat=60.
REAL, ALLOCATABLE :: field(:,:,:),fieldz(:,:,:)
type(griddim_def) :: griddim_out
type(transform_def) :: trans
type(grid_transform) :: grid_trans
integer :: nx=30,ny=30,component_flag=0
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='near'
!questa chiamata prende dal launcher il nome univoco
call l4f_launcher(a_name,a_name_force="demo4")
!init di log4fortran
ier=l4f_init()
!imposta a_name
category=l4f_category_get(a_name//".main")
call l4f_category_log(category,l4f_info,"transforming from file:"//trim(infile))
call l4f_category_log(category,l4f_info,"transforming to file:"//trim(outfile))
if(trans_type == 'inter')then
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="regular_ll")
call griddim_unproj(griddim_out)
print*,'grid di interpolazione >>>>>>>>>>>>>>>>>>>>'
call display(griddim_out)
end if
call init(trans, trans_type=trans_type,sub_type=sub_type, &
ilon=ilon,ilat=ilat,flon=flon,flat=flat,&
categoryappend="trasformation")
ifile = grid_file_id_new(trim(infile),'r')
ofile = grid_file_id_new(trim(outfile),'w')
! 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 gridinfo")
call init (gridinfo,gaid=gaid,categoryappend="importato")
call import(gridinfo)
call display(gridinfo,namespace="")
call l4f_category_log(category,l4f_info,"import")
ALLOCATE (field(gridinfo%griddim%dim%nx,gridinfo%griddim%dim%ny,1))
field(:,:,1)=decode_gridinfo(gridinfo)
call init(grid_trans, trans, in=gridinfo%griddim,out=griddim_out,categoryappend="gridtrasformato")
call display(griddim_out)
ALLOCATE (fieldz(griddim_out%dim%nx,griddim_out%dim%ny,1))
call compute(grid_trans, field, fieldz)
call delete(gridinfo%griddim)
call copy(griddim_out,gridinfo%griddim,categoryappend="clonato")
! oppure per mantenere il vecchio gridinfo
! call clone(gridinfo , gridinfo_out)
! call delete(gridinfo_out%griddim)
! call copy(griddim_out,gridinfo_out%griddim)
call encode_gridinfo(gridinfo,fieldz(:,:,1))
call export (gridinfo)
call display(gridinfo,namespace="")
call export(gridinfo%gaid,ofile)
call delete (grid_trans)
call delete (gridinfo)
deallocate (field,fieldz)
end do
call delete (trans)
call delete(griddim_out)
call delete(ifile)
call delete(ofile)
call l4f_category_log(category,l4f_info,"terminato")
!chiudo il logger
call l4f_category_delete(category)
ier=l4f_fini()
end program demo4
Copy an object, creating a fully new instance.
Definition: grid_class.F90:302
Print a brief description on stdout.
Definition: grid_class.F90:349
Export griddim object to grid_id.
Definition: grid_class.F90:344
Import griddim object from grid_id.
Definition: grid_class.F90:339
Constructors of the corresponding objects.
Definition: grid_class.F90:292
Compute the output data array from input data array according to the defined transformation.
Decode and return the data array from a grid_id object associated to a gridinfo object.
Encode a data array into a grid_id object associated to a gridinfo object.
Module for describing geographically referenced regular grids.
Definition: grid_class.F90:237
Module for defining transformations between rectangular georeferenced grids and between grids and spa...
This module defines objects and methods for managing data volumes on rectangular georeferenced grids.

Generated with Doxygen.