libsim Versione 7.1.11
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 :: category,ier
29character(len=512):: a_name
30type(arrayof_gridinfo) :: gridinfoin, gridinfoout
31type(volgrid6d),pointer :: volgrid(:)
32
33TYPE(grid_file_id) :: ifile
34TYPE(grid_id) :: gaid, gaid_template
35INTEGER :: ngrib
36
37!questa chiamata prende dal launcher il nome univoco
38call l4f_launcher(a_name,a_name_force="demo3")
39
40!init di log4fortran
41ier=l4f_init()
42
43!imposta a_name
44category=l4f_category_get(a_name//".main")
45
46
47ngrib=0
48
49ifile = grid_file_id_new('../data/in.grb','r')
50ngrib = grid_file_id_count(ifile)
51
52call l4f_category_log(category,l4f_info,&
53 "Numero totale di grib: "//to_char(ngrib))
54
55! aggiungo ngrib elementi vuoti
56CALL insert(gridinfoin, nelem=ngrib)
57
58ngrib=0
59
60! Loop on all the messages in a file.
61DO WHILE (.true.)
62 gaid = grid_id_new(ifile)
63 IF (.NOT.c_e(gaid)) EXIT
64
65 CALL l4f_category_log(category,l4f_info,"import gridinfoin")
66 ngrib = ngrib + 1
67 CALL init (gridinfoin%array(ngrib), gaid=gaid, categoryappend=trim(to_char(ngrib)))
68 CALL import(gridinfoin%array(ngrib))
69ENDDO
70
71call delete(ifile)
72call display(gridinfoin)
73
74call l4f_category_log(category,l4f_info,"import")
75
76call import(volgrid, gridinfoin, categoryappend="volume di test")
77
78call l4f_category_log(category,l4f_info,"delete gridinfoin")
79
80CALL delete(gridinfoin)
81
82! qui posso fare tutti i conti possibili
83
84gaid_template = grid_id_new(grib_api_template="regular_ll_sfc_grib1")
85
86call l4f_category_log(category,l4f_info,"export a un grib fatto come voglio io")
87
88call export(volgrid, gridinfoout, gaid_template=gaid_template)
89
90ifile = grid_file_id_new('out.grb','w')
91
92do ngrib=1,gridinfoout%arraysize
93 ! write the new message to a file
94
95 if(c_e(gridinfoout%array(ngrib)%gaid)) then
96 call export(gridinfoout%array(ngrib))
97 call export(gridinfoout%array(ngrib)%gaid,ifile)
98 end if
99end do
100
101call delete(ifile)
102
103call l4f_category_log(category,l4f_info,"terminato")
104
105call delete(gridinfoout)
106
107!chiudo il logger
108call l4f_category_delete(category)
109ier=l4f_fini()
110
111end 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.
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.