Programma esempio semplice per gridinfo e volgrid6d. Programma che importa da file un vettore di gridinfo poi lo importa in volgrid6d. Da volgrid6d viene di nuovo creato un vettore di gridinfo per poi exportare su file.
28 integer :: category,ier
29 character(len=512):: a_name
30 type(arrayof_gridinfo) :: gridinfoin, gridinfoout
31 type(volgrid6d),
pointer :: volgrid(:)
33 TYPE(grid_file_id) :: ifile
34 TYPE(grid_id) :: gaid, gaid_template
38 call l4f_launcher(a_name,a_name_force=
"demo3")
44 category=l4f_category_get(a_name//
".main")
49 ifile = grid_file_id_new(
'../data/in.grb',
'r')
50 ngrib = grid_file_id_count(ifile)
53 "Numero totale di grib: "//
to_char(ngrib))
56 CALL insert(gridinfoin, nelem=ngrib)
62 gaid = grid_id_new(ifile)
63 IF (.NOT.
c_e(gaid))
EXIT
67 CALL init (gridinfoin%array(ngrib), gaid=gaid, categoryappend=TRIM(to_char(ngrib)))
68 CALL import(gridinfoin%array(ngrib))
72 call display(gridinfoin)
74 call l4f_category_log(category,L4F_INFO,"import")
76 call import(volgrid, gridinfoin, categoryappend="volume di test
")
78 call l4f_category_log(category,L4F_INFO,"delete gridinfoin
")
80 CALL delete(gridinfoin)
82 ! qui posso fare tutti i conti possibili
84 gaid_template = grid_id_new(grib_api_template="regular_ll_sfc_grib1
")
86 call l4f_category_log(category,L4F_INFO,"export a un grib fatto come voglio io
")
88 call export(volgrid, gridinfoout, gaid_template=gaid_template)
90 ifile = grid_file_id_new('out.grb','w')
92 do ngrib=1,gridinfoout%arraysize
93 ! write the new message to a file
95 if(c_e(gridinfoout%array(ngrib)%gaid)) then
96 call export(gridinfoout%array(ngrib))
97 call export(gridinfoout%array(ngrib)%gaid,ifile)
103 call l4f_category_log(category,L4F_INFO,"terminato
")
105 call delete(gridinfoout)
108 call l4f_category_delete(category)
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.