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