libsim  Versione7.1.6
Tipi di dato | Membri privati | Elenco di tutti i membri
Riferimenti per il modulogridinfo_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...
 

Membri privati

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

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

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

Definizione alla linea 239 del file gridinfo_class.F90.


Generated with Doxygen.