1 | #! /bin/sh |
---|
2 | # |
---|
3 | #+ |
---|
4 | # |
---|
5 | # NAME |
---|
6 | # ==== |
---|
7 | # |
---|
8 | # detectbarotropicmode.sh - build file for detection of barotropic mode |
---|
9 | # |
---|
10 | # SYNOPSIS |
---|
11 | # ======== |
---|
12 | # |
---|
13 | # :: |
---|
14 | # |
---|
15 | # $ detectbarotropicmode.sh -l list -r resolution -exp experience -g grid \ |
---|
16 | # -latmin latmin -latmax latmax -longmin longmin -longmax longmax |
---|
17 | # |
---|
18 | # DESCRIPTION |
---|
19 | # =========== |
---|
20 | # |
---|
21 | # |
---|
22 | # EXAMPLES |
---|
23 | # ======== |
---|
24 | # |
---|
25 | # For detection on DRAKKAR G42 experiment with ORCA025 resolution on T points |
---|
26 | # in the box [-50,30] [295,335]: |
---|
27 | # :: |
---|
28 | # |
---|
29 | # $ detectbarotropicmode.sh -l ${GEOMAG_OD}/list_G42 -r ORCA025 -exp G42 -g gridT \ |
---|
30 | # -latmin -50 -latmax -30 -longmin 295 -longmax 335 |
---|
31 | # |
---|
32 | # EVOLUTIONS |
---|
33 | # ========== |
---|
34 | # |
---|
35 | # $Id$ |
---|
36 | # |
---|
37 | # pas fini ++ |
---|
38 | # |
---|
39 | # - reee522 2007-11-26T11:33:42Z rhodes (IRIX64) |
---|
40 | # |
---|
41 | # * externalization of copy of data file in getmodelout.sh |
---|
42 | # |
---|
43 | # - reee522 2007-11-26T10:55:44Z rhodes (IRIX64) |
---|
44 | # |
---|
45 | # * add ncks, ncrcat and some informations inspired by |
---|
46 | # http://dods.ipsl.jussieu.fr/projets_ES/misc/myls |
---|
47 | # |
---|
48 | # - fplod 2007-11-23T17:02:56Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
49 | # |
---|
50 | # * creation |
---|
51 | # |
---|
52 | #- |
---|
53 | # |
---|
54 | command=detectbarotropicmode.sh |
---|
55 | # |
---|
56 | usage=" Usage : ${command} -l list -r orcares -exp drakkar_exp -g grid -latmin latmin -latmax latmax -longmin longmin -longmax longmax" |
---|
57 | # |
---|
58 | while [ ! -z "${1}" ] # ++ pb bash |
---|
59 | do |
---|
60 | case ${1} in |
---|
61 | -l) |
---|
62 | list=${2} |
---|
63 | shift |
---|
64 | ;; |
---|
65 | -r) |
---|
66 | orcares=${2} |
---|
67 | shift |
---|
68 | ;; |
---|
69 | -exp) |
---|
70 | drakkar_exp=${2} |
---|
71 | shift |
---|
72 | ;; |
---|
73 | -g) |
---|
74 | grid=${2} |
---|
75 | shift |
---|
76 | ;; |
---|
77 | -latmin) |
---|
78 | latmin=${2} |
---|
79 | shift |
---|
80 | ;; |
---|
81 | -latmax) |
---|
82 | latmax=${2} |
---|
83 | shift |
---|
84 | ;; |
---|
85 | -longmin) |
---|
86 | longmin=${2} |
---|
87 | shift |
---|
88 | ;; |
---|
89 | -longmax) |
---|
90 | longmax=${2} |
---|
91 | shift |
---|
92 | ;; |
---|
93 | *) # other choice |
---|
94 | echo "${usage}" |
---|
95 | ;; |
---|
96 | esac |
---|
97 | shift # next flag |
---|
98 | done |
---|
99 | # |
---|
100 | set -u |
---|
101 | # |
---|
102 | # check GEOMAG environement |
---|
103 | if [ ! -d ${GEOMAG_LOG} ] |
---|
104 | then |
---|
105 | echo " eee : \${GEOMAG_LOG} not found" |
---|
106 | exit 1 |
---|
107 | fi |
---|
108 | # ++ blindage en tout genre |
---|
109 | # |
---|
110 | case ${grid} in |
---|
111 | gridT) |
---|
112 | echo "iii : grid=${orcares}" |
---|
113 | ;; |
---|
114 | *) |
---|
115 | echo "eee : pb \${grid} = ${grid}" |
---|
116 | exit 1 |
---|
117 | ;; |
---|
118 | esac |
---|
119 | # |
---|
120 | case ${orcares} in |
---|
121 | ORCA025) |
---|
122 | echo "iii : orcares=${orcares}" |
---|
123 | ;; |
---|
124 | *) |
---|
125 | echo "eee : pb \${orcares} = ${orcares}" |
---|
126 | exit 1 |
---|
127 | ;; |
---|
128 | esac |
---|
129 | # |
---|
130 | case ${drakkar_exp} in |
---|
131 | G42) |
---|
132 | echo "iii : drakkar_exp=${drakkar_exp}" |
---|
133 | ;; |
---|
134 | *) |
---|
135 | echo "eee : pb \${drakkar_exp} = ${drakkar_exp}" |
---|
136 | exit 1 |
---|
137 | ;; |
---|
138 | esac |
---|
139 | # |
---|
140 | # ++ conversion of latitude and longitude in x and y indexes |
---|
141 | case ${orcares} in |
---|
142 | ORCA025) |
---|
143 | xmin=529 |
---|
144 | xmax=689 |
---|
145 | ymin=266 |
---|
146 | ymax=372 |
---|
147 | echo "iii : forcage xmin xmax ymin ymax : ${xmin} ${xmax} ${ymin} ${ymax}" |
---|
148 | ;; |
---|
149 | *) |
---|
150 | echo "eee : pb conversion lat,long to x,y" |
---|
151 | exit 1 |
---|
152 | ;; |
---|
153 | esac |
---|
154 | # |
---|
155 | # extract ssh and create a new set of files |
---|
156 | list_ssh="" |
---|
157 | for file in `cat ${list}` |
---|
158 | do |
---|
159 | echo "iii : extraction from ${file}" # ++ voir seulement si debug demandé |
---|
160 | filessh=${GEOMAG_OD}/`basename ${file} .nc`_ssh.nc |
---|
161 | rm -f ${filessh} 2> /dev/null |
---|
162 | ncks --dimension x,${xmin},${xmax} --dimension y,${ymin},${ymax} -v sossheig,nav_lon,nav_lat \ |
---|
163 | ${file} ${filessh} |
---|
164 | status_ncks=${?} |
---|
165 | if [ ${status_ncks} -ne 0 ] |
---|
166 | then |
---|
167 | echo "eee : pb with ncks ${file}" |
---|
168 | exit 1 |
---|
169 | else |
---|
170 | list_ssh="${list_ssh} ${filessh}" |
---|
171 | fi |
---|
172 | done |
---|
173 | line=`head -n 1 ${list}` |
---|
174 | bfile=`basename ${line}` |
---|
175 | datemin=`echo ${bfile} | awk -F "_" '{print $2}'` |
---|
176 | line=`tail -n 1 ${list}` |
---|
177 | bfile=`basename ${line}` |
---|
178 | datemax=`echo ${bfile} | awk -F "_" '{print $2}'` |
---|
179 | # |
---|
180 | # concatenation |
---|
181 | filetot=${GEOMAG_OD}/${orcares}-${drakkar_exp}_${datemin}_${datemax}_${grid}_ssh.nc |
---|
182 | rm -f ${filetot} 2> /dev/null |
---|
183 | ncrcat ${list_ssh} ${filetot} |
---|
184 | status_ncrcat=${?} |
---|
185 | if [ ${status_ncrcat} -ne 0 ] |
---|
186 | then |
---|
187 | echo "eee : pb with ncrcat" |
---|
188 | exit 1 |
---|
189 | else |
---|
190 | echo "iii : result in ${filetot}" |
---|
191 | fi |
---|
192 | # |
---|
193 | # ++ global attributes |
---|
194 | # ++ convention |
---|
195 | # ++ nedtcf output or ascii |
---|
196 | # clean |
---|
197 | rm ${list_ssh} |
---|
198 | # |
---|
199 | # end |
---|
200 | exit 0 |
---|