-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFSTD_Y2Z_SUM.tcl
More file actions
96 lines (74 loc) · 2.97 KB
/
Copy pathFSTD_Y2Z_SUM.tcl
File metadata and controls
96 lines (74 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# the next line restarts using tclsh \
exec $SPI_PATH/tclsh "$0" "$@"
#============================================================================
# Environnement Canada
# Centre Meteorologique Canadien
# 2100 Trans-Canadienne
# Dorval, Quebec
#
# Projet : Exemple de scripts.
# Fichier : FSTD_Y2Z_SUM.tcl
# Creation : Novembre 2011 - J.P. Gauthier - CMC/CMOE
# Description: Interpoler un champ sur grille Y (nuage de points) sur un grille
# en faisant le somme par point de grille.
#
# Parametres :
# <File> : Fichier standard
#
# Retour:
#
# Remarques :
#
#============================================================================
package require TclData
#package require TclGeoEER
package require Logger
Log::Start [info script] 0.1
#-- Liste des especes incluses dans les fichiers d'emissions
set Species { S2 S4 NO N2 }
set Hours 24
set Days 2
file delete $env(CI_DATA_OUT)/FSTD_Y2Z_SUM.fstd
fstdfile open YFILE read $env(CI_DATA_IN)/major.fstd
fstdfile open GRIDFILE read $env(CI_DATA_IN)/2005120600_012
fstdfile open RESULTFILE write $env(CI_DATA_OUT)/FSTD_Y2Z_SUM.fstd
#-- Copie des tictac
foreach tictac { >> ^^ } {
fstdfield read GRID GRIDFILE -1 "" -1 -1 -1 "" "$tictac"
fstdfield write GRID RESULTFILE 0 True
fstdfield read GRID YFILE -1 "" -1 -1 -1 "" "$tictac"
fstdfield write GRID RESULTFILE 0 True
}
#-- Champ de travail
fstdfield read GRID GRIDFILE -1 "" -1 -1 -1 "" AC
fstdfield stats GRID -nodata 0.0
# -- On boucle sur les jours de 1 a 7
for { set d 1 } { $d <= $Days } { incr d } {
# -- On boucle sur les heures de 1 a 24
for { set t 0 } { $t < $Hours } { incr t } {
set ip2 [format "%i%02i" $d $t]
Log::Print INFO "Processing IP2 $ip2"
foreach specie $Species {
Log::Print INFO "Processing specie $specie"
fstdfield read YFIELD YFILE -1 "" 12001 $ip2 -1 "" $specie
fstdfield clear GRID 0.0
fstdfield gridinterp GRID YFIELD SUM True
fstdfield define GRID -NOMVAR $specie -IP1 12001 -IP2 $ip2 -DATEO [fstdfield define YFIELD -DATEO] -ETIKET [fstdfield define YFIELD -ETIKET]
fstdfield write GRID RESULTFILE -32 True
}
}
}
Log::Print INFO "Processing point cloud"
fstdfield read GRID GRIDFILE -1 "" -1 -1 -1 "" O3
fstdfield gridinterp YFIELD GRID MAXIMUM True
fstdfield define YFIELD -NOMVAR MAX -IP1 12001 -IP2 $ip2 -DATEO [fstdfield define YFIELD -DATEO] -ETIKET [fstdfield define YFIELD -ETIKET]
fstdfield write YFIELD RESULTFILE -32 True
fstdfield gridinterp YFIELD GRID MINIMUM True
fstdfield define YFIELD -NOMVAR MIN -IP1 12001 -IP2 $ip2 -DATEO [fstdfield define YFIELD -DATEO] -ETIKET [fstdfield define YFIELD -ETIKET]
fstdfield write YFIELD RESULTFILE -32 True
fstdfield gridinterp YFIELD GRID AVERAGE True
fstdfield define YFIELD -NOMVAR AVG -IP1 12001 -IP2 $ip2 -DATEO [fstdfield define YFIELD -DATEO] -ETIKET [fstdfield define YFIELD -ETIKET]
fstdfield write YFIELD RESULTFILE -32 True
fstdfile close YFILE GRIDFILE RESULTFILE
Log::End