libsim  Versione7.2.6
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 :: category,ier
38 
39 !questa chiamata prende dal launcher il nome univoco
40 call l4f_launcher(a_name,a_name_force="ensascii")
41 
42 !init di log4fortran
43 ier=l4f_init()
44 
45 !imposta a_name
46 category=l4f_category_get(trim(a_name)//".main")
47 call l4f_category_log(category,l4f_info,"start")
48 
49 
50 ! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto in import
51 CALL init(v7d_in,filename=filein,file=.true.)
52 
53 ! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto in export
54 CALL init(v7d_out,filename=fileout,write=.true.,wipe=.true.,file=.true.)
55 
56 CALL import(v7d_in)
57 call display(v7d_in%vol7d)
58 
59 ! move data to the firth index for time and level
60 do indana=1,size(v7d_in%vol7d%ana)
61  do indtime=2,size(v7d_in%vol7d%time)
62  do indlevel=2,size(v7d_in%vol7d%level)
63  do indtimerange=1,size(v7d_in%vol7d%timerange)
64  do indnetwork=1,size(v7d_in%vol7d%network)
65  indananew=indana
66  indtimenew=1
67  indlevelnew=1
68  indtimerangenew=indtimerange
69  indnetworknew=indnetwork
70 
71  call move_datac (v7d_in%vol7d,&
72  indana,indtime,indlevel,indtimerange,indnetwork,&
73  indananew,indtimenew,indlevelnew,indtimerangenew,indnetworknew)
74 
75  end do
76  end do
77  end do
78  end do
79 end do
80 
81 ! set to missing level and time > 1
82 do indlevel=2,size(v7d_in%vol7d%level)
83  call init (v7d_in%vol7d%level(indlevel))
84 end do
85 
86 do indtime=2,size(v7d_in%vol7d%time)
87  call init (v7d_in%vol7d%time(indtime))
88 end do
89 
90 !copy with remove
91 call vol7d_copy(v7d_in%vol7d,v7d_out%vol7d,miss=.true.)
92 CALL delete (v7d_in)
93 
94 !set to missing the ambigous descriptions
95 call init (v7d_out%vol7d%level(1))
96 call init (v7d_out%vol7d%time(1))
97 
98 call display(v7d_out%vol7d)
99 CALL export(v7d_out)
100 CALL delete(v7d_out)
101 
102 !chiudo il logger
103 call l4f_category_log(category,l4f_info,"end")
104 call l4f_category_delete(category)
105 ier=l4f_fini()
106 
107 END PROGRAM v7ddballe_move_and_collapse

Generated with Doxygen.