source: trunk/detectbarotropicmode.sh @ 40

Last change on this file since 40 was 40, checked in by pinsard, 14 years ago

project homogenization

  • Property svn:executable set to *
  • Property svn:keyword set to Id
File size: 3.5 KB
Line 
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#
54command=detectbarotropicmode.sh
55#
56usage=" Usage : ${command} -l list -r orcares -exp drakkar_exp -g grid -latmin latmin -latmax latmax -longmin longmin -longmax longmax"
57#
58while [ ! -z "${1}" ] # ++ pb bash
59do
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
98done
99#
100set -u
101#
102# check GEOMAG environement
103if [ ! -d ${GEOMAG_LOG} ]
104then
105 echo " eee : \${GEOMAG_LOG} not found"
106 exit 1
107fi
108# ++ blindage en tout genre
109#
110case ${grid} in
111gridT)
112  echo "iii : grid=${orcares}"
113 ;;
114*)
115  echo "eee : pb \${grid} = ${grid}"
116  exit 1
117;;
118esac
119#
120case ${orcares} in
121ORCA025)
122  echo "iii : orcares=${orcares}"
123 ;;
124*)
125  echo "eee : pb \${orcares} = ${orcares}"
126  exit 1
127;;
128esac
129#
130case ${drakkar_exp} in
131G42)
132  echo "iii : drakkar_exp=${drakkar_exp}"
133 ;;
134*)
135  echo "eee : pb \${drakkar_exp} = ${drakkar_exp}"
136  exit 1
137;;
138esac
139#
140# ++ conversion of latitude and longitude in x and y indexes
141case ${orcares} in
142ORCA025)
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;;
153esac
154#
155# extract ssh and create a new set of files
156list_ssh=""
157for file in  `cat ${list}`
158do
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
172done
173line=`head -n 1  ${list}`
174bfile=`basename ${line}`
175datemin=`echo ${bfile}  | awk -F "_" '{print $2}'`
176line=`tail -n 1  ${list}`
177bfile=`basename ${line}`
178datemax=`echo ${bfile}  | awk -F "_" '{print $2}'`
179#
180# concatenation
181filetot=${GEOMAG_OD}/${orcares}-${drakkar_exp}_${datemin}_${datemax}_${grid}_ssh.nc
182rm -f  ${filetot} 2> /dev/null
183ncrcat ${list_ssh} ${filetot}
184status_ncrcat=${?}
185if [ ${status_ncrcat} -ne 0 ]
186then
187   echo "eee : pb with ncrcat"
188   exit 1
189else
190   echo "iii : result in ${filetot}"
191fi
192#
193# ++ global attributes
194# ++ convention
195# ++ nedtcf output or ascii
196# clean
197rm ${list_ssh}
198#
199# end
200exit 0
Note: See TracBrowser for help on using the repository browser.