libsim  Versione8.0.0
esempio_v7ddballe_move_and_collapse.f90

! Example program to reduce to one the dimensions of levels and time without loss of data

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 v7ddballe_move_and_collapse
19 ! Example program to reduce to one the dimensions of levels and time without loss of data
20 ! read from in.bufr and write to out.bufr
21 
22 USE vol7d_class
24 
25 IMPLICIT NONE
26 
27 TYPE(vol7d_dballe) :: v7d_in,v7d_out
28 
29 integer :: indana,indtime,indlevel,indtimerange,indnetwork
30 integer :: indananew,indtimenew,indlevelnew,indtimerangenew,indnetworknew
31 integer :: inddativar,inddatiattr,inddativarattr
32 
33 
34 CHARACTER(len=80) :: filein="../data/in.bufr",fileout="../data/out.bufr"
35 
36 character(len=512):: a_name
37 integer :: ier
38 type(l4f_handle) :: category
39 
40 !questa chiamata prende dal launcher il nome univoco
41 call l4f_launcher(a_name,a_name_force="ensascii")
42 
43 !init di log4fortran
44 ier=l4f_init()
45 
46 !imposta a_name
47 category=l4f_category_get_handle(trim(a_name)//".main")
48 call l4f_category_log(category,l4f_info,"start")
49 
50 
51 ! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto in import
52 CALL init(v7d_in,filename=filein,file=.true.)
53 
54 ! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto in export
55 CALL init(v7d_out,filename=fileout,write=.true.,wipe=.true.,file=.true.)
56 
57 CALL import(v7d_in)
58 call display(v7d_in%vol7d)
59 
60 ! move data to the firth index for time and level
61 do indana=1,size(v7d_in%vol7d%ana)
62  do indtime=2,size(v7d_in%vol7d%time)
63  do indlevel=2,size(v7d_in%vol7d%level)
64  do indtimerange=1,size(v7d_in%vol7d%timerange)
65  do indnetwork=1,size(v7d_in%vol7d%network)
66  indananew=indana
67  indtimenew=1
68  indlevelnew=1
69  indtimerangenew=indtimerange
70  indnetworknew=indnetwork
71 
72  call move_datac (v7d_in%vol7d,&
73  indana,indtime,indlevel,indtimerange,indnetwork,&
74  indananew,indtimenew,indlevelnew,indtimerangenew,indnetworknew)
75 
76  end do
77  end do
78  end do
79  end do
80 end do
81 
82 ! set to missing level and time > 1
83 do indlevel=2,size(v7d_in%vol7d%level)
84  call init (v7d_in%vol7d%level(indlevel))
85 end do
86 
87 do indtime=2,size(v7d_in%vol7d%time)
88  call init (v7d_in%vol7d%time(indtime))
89 end do
90 
91 !copy with remove
92 call vol7d_copy(v7d_in%vol7d,v7d_out%vol7d,miss=.true.)
93 CALL delete (v7d_in)
94 
95 !set to missing the ambigous descriptions
96 call init (v7d_out%vol7d%level(1))
97 call init (v7d_out%vol7d%time(1))
98 
99 call display(v7d_out%vol7d)
100 CALL export(v7d_out)
101 CALL delete(v7d_out)
102 
103 !chiudo il logger
104 call l4f_category_log(category,l4f_info,"end")
105 call l4f_category_delete(category)
106 ier=l4f_fini()
107 
108 END PROGRAM v7ddballe_move_and_collapse

Generated with Doxygen.