libsim Versione 8.0.0
example_vg6d_3.f90

Programma esempio semplice per gridinfo e volgrid6d.

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.

1! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
2! authors:
3! Davide Cesari <dcesari@arpa.emr.it>
4! Paolo Patruno <ppatruno@arpa.emr.it>
5
6! This program is free software; you can redistribute it and/or
7! modify it under the terms of the GNU General Public License as
8! published by the Free Software Foundation; either version 2 of
9! the License, or (at your option) any later version.
10
11! This program is distributed in the hope that it will be useful,
12! but WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14! GNU General Public License for more details.
15
16! You should have received a copy of the GNU General Public License
17! along with this program. If not, see <http://www.gnu.org/licenses/>.
18program demo3
19
26implicit none
27
28integer :: ier
29type(l4f_handle) :: category
30character(len=512):: a_name
31type(arrayof_gridinfo) :: gridinfoin, gridinfoout
32type(volgrid6d),pointer :: volgrid(:)
33
34TYPE(grid_file_id) :: ifile
35TYPE(grid_id) :: gaid, gaid_template
36INTEGER :: ngrib
37
38!questa chiamata prende dal launcher il nome univoco
39call l4f_launcher(a_name,a_name_force="demo3")
40
41!init di log4fortran
42ier=l4f_init()
43
44!imposta a_name
45category=l4f_category_get_handle(a_name//".main")
46
47
48ngrib=0
49
50ifile = grid_file_id_new('../data/in.grb','r')
51ngrib = grid_file_id_count(ifile)
52
53call l4f_category_log(category,l4f_info,&
54 "Numero totale di grib: "//to_char(ngrib))
55
56! aggiungo ngrib elementi vuoti
57CALL insert(gridinfoin, nelem=ngrib)
58
59ngrib=0
60
61! Loop on all the messages in a file.
62DO WHILE (.true.)
63 gaid = grid_id_new(ifile)
64 IF (.NOT.c_e(gaid)) EXIT
65
66 CALL l4f_category_log(category,l4f_info,"import gridinfoin")
67 ngrib = ngrib + 1
68 CALL init (gridinfoin%array(ngrib), gaid=gaid, categoryappend=trim(to_char(ngrib)))
69 CALL import(gridinfoin%array(ngrib))
70ENDDO
71
72call delete(ifile)
73call display(gridinfoin)
74
75call l4f_category_log(category,l4f_info,"import")
76
77call import(volgrid, gridinfoin, categoryappend="volume di test")
78
79call l4f_category_log(category,l4f_info,"delete gridinfoin")
80
81CALL delete(gridinfoin)
82
83! qui posso fare tutti i conti possibili
84
85gaid_template = grid_id_new(grib_api_template="regular_ll_sfc_grib1")
86
87call l4f_category_log(category,l4f_info,"export a un grib fatto come voglio io")
88
89call export(volgrid, gridinfoout, gaid_template=gaid_template)
90
91ifile = grid_file_id_new('out.grb','w')
92
93do ngrib=1,gridinfoout%arraysize
94 ! write the new message to a file
95
96 if(c_e(gridinfoout%array(ngrib)%gaid)) then
97 call export(gridinfoout%array(ngrib))
98 call export(gridinfoout%array(ngrib)%gaid,ifile)
99 end if
100end do
101
102call delete(ifile)
103
104call l4f_category_log(category,l4f_info,"terminato")
105
106call delete(gridinfoout)
107
108!chiudo il logger
109call l4f_category_delete(category)
110ier=l4f_fini()
111
112end program demo3
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.
Export a grid to a file.
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.
Global 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
Definitions of constants and functions for working with missing values.
This module defines objects and methods for managing data volumes on rectangular georeferenced grids.

Generated with Doxygen.