libsim  Versione7.1.6
esempio_v7ddballe.f90

/brief Programma esempio semplice per l'uso di vol7d con DB-All.e

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
19 ! Programma di esempio di estrazione dall'archivio DB-all.e
21 USE vol7d_class
23 
24 IMPLICIT NONE
25 
26 TYPE(vol7d_dballe) :: v7d
27 TYPE(datetime) :: ti, tf
28 TYPE(vol7d_network):: network
29 CHARACTER(len=12) :: c
30 INTEGER :: i, n
31 REAL, POINTER :: vol2d(:,:)
32 
33 ! Definisco le date iniziale e finale e network
34 CALL init(ti, year=2007, month=3, day=18, hour=12)
35 CALL init(tf, year=2007, month=3, day=21, hour=00)
36 call init(network,name='generic')
37 
38 ! Chiamo il costruttore della classe vol7d_dballe per il mio oggetto
39 CALL init(v7d)
40 
41 ! Importo i dati, variabile 'B13011' della btable (precipitazione),
42 CALL import(v7d, var=(/'B13011'/),set_network=network,varkind=(/"r"/), attr=(/"*B33192","*B33007"/))
43 !CALL import(v7d, 'B13011', network=network, timei=ti, timef=tf, timerange=vol7d_timerange(4,-1800,0), attr=(/"*B33192","*B33007"/))
44 
45 print *,v7d%vol7d%dativar%r
46 print *,v7d%vol7d%datiattr%c
47 
48 
49 ! Creo una vista su un array bidimensionale che scorre le dimensioni
50 ! dell'anagrafica e del tempo (vol7d_ana_d, vol7d_time_d)
51 CALL vol7d_get_voldatir(v7d%vol7d, (/vol7d_ana_d,vol7d_time_d/), vol2dp=vol2d)
52 ! Calcolo la media e la stampo assieme all'istante
53 DO i = 1, SIZE(v7d%vol7d%time)
54  CALL getval(v7d%vol7d%time(i), simpledate=c)
55  n = count(vol2d(:,i) /= rmiss)
56  IF (n > 0) THEN
57  print*, c, ' prec. media:', sum(vol2d(:,i), mask=(vol2d(:,i) /= rmiss))/n,n
58 ! if (c=="200703202030" ) print *, vol2d(:,i)
59 
60  ENDIF
61 ENDDO
62 
63 CALL delete(v7d)
64 
65 END PROGRAM v7ddballe

Generated with Doxygen.