libsim  Versione8.0.0
example_vg6d_5.f90

Programma trasformazione da volgrid6d a volgrid6d Legge grib da un file e li organizza in un vettore di strutture volgrid6d mettendoli a disposizione per eventuali elaborazioni; vengono poi riesportati a un file grib

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/>.
18 program demo5
19 
20 use log4fortran
21 use grib_api
23 use grid_class
26 implicit none
27 
28 integer :: ier,gaid_template
29 type(l4f_handle) :: category
30 integer :: i,j
31 character(len=512):: a_name
32 type(volgrid6d),pointer :: volgrid(:),volgrid_out(:)
33 type(transform_def) :: trans
34 
35 !questa chiamata prende dal launcher il nome univoco
36 call l4f_launcher(a_name,a_name_force="demo5")
37 
38 !init di log4fortran
39 ier=l4f_init()
40 
41 !imposta a_name
42 category=l4f_category_get_handle(a_name//".main")
43 
44 call l4f_category_log(category,l4f_info,"inizio")
45 
46 call import (volgrid,filename="../data/in.grb",categoryappend="volume letto")
47 
48 ! qui posso fare tutti i conti possibili
49 !!$print*,"-------------"
50 !!$
51 !!$call griddim_unproj(volgrid(1)%griddim)
52 !!$
53 !!$print*,"sotto"
54 !!$
55 !!$do i=1,volgrid(1)%griddim%dim%nx,10
56 !!$ j=1
57 !!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
58 !!$end do
59 !!$
60 !!$print*,"destra"
61 !!$
62 !!$do j=1,volgrid(1)%griddim%dim%ny,10
63 !!$ i=volgrid(1)%griddim%dim%nx
64 !!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
65 !!$end do
66 !!$
67 !!$print*,"sopra"
68 !!$
69 !!$do i=volgrid(1)%griddim%dim%nx,1,-10
70 !!$ j=volgrid(1)%griddim%dim%ny
71 !!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
72 !!$end do
73 !!$
74 !!$print*,"sinistra"
75 !!$
76 !!$do j=volgrid(1)%griddim%dim%ny,1,-10
77 !!$ i=1
78 !!$ print*,volgrid(1)%griddim%dim%lon(i,j),volgrid(1)%griddim%dim%lat(i,j)
79 !!$end do
80 !!$
81 !!$
82 !!$print*,"-------------"
83 
84 call init(trans, trans_type="zoom",sub_type="coord", &
85  ilon=-10.d0,ilat=40.d0,flon=10.d0,flat=50.d0,&
86  categoryappend="trasformation")
87 
88 !call transform(trans,griddim, volgrid, volgrid_out,categoryappend="trasforma")
89 call transform(trans, volgrid6d_in=volgrid, volgrid6d_out=volgrid_out,clone=.true.,categoryappend="trasforma")
90 
91 call display(volgrid_out(1)%griddim)
92 
93 call l4f_category_log(category,l4f_info,"trasformato")
94 
95 if (associated(volgrid)) call delete(volgrid)
96 
97 !call grib_new_from_template (gaid_template,"regular_ll_sfc_grib1")
98 
99 call l4f_category_log(category,l4f_info,"export a un nuovo file grib")
100 
101 !call export (volgrid,filename="out.grb",gaid_template=gaid_template,categoryappend="exportazione")
102 call export (volgrid_out,filename="out.grb",categoryappend="exportazione")
103 
104 call l4f_category_log(category,l4f_info,"terminato")
105 
106 if (associated(volgrid_out)) call delete(volgrid_out)
107 
108 !chiudo il logger
109 call l4f_category_delete(category)
110 ier=l4f_fini()
111 
112 end program demo5

Generated with Doxygen.