[39] | 1 | #! /bin/sh |
---|
[32] | 2 | # |
---|
[39] | 3 | #+ |
---|
[32] | 4 | # |
---|
[39] | 5 | # NAME |
---|
| 6 | # ==== |
---|
[33] | 7 | # |
---|
[39] | 8 | # detectbarotropicmode.sh - build file for detection of barotropic mode |
---|
| 9 | # |
---|
[40] | 10 | # SYNOPSIS |
---|
[39] | 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 | # |
---|
[32] | 35 | # $Id$ |
---|
[39] | 36 | # |
---|
[32] | 37 | # pas fini ++ |
---|
[33] | 38 | # |
---|
[39] | 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 | # |
---|
[35] | 54 | command=detectbarotropicmode.sh |
---|
[32] | 55 | # |
---|
[35] | 56 | usage=" Usage : ${command} -l list -r orcares -exp drakkar_exp -g grid -latmin latmin -latmax latmax -longmin longmin -longmax longmax" |
---|
[32] | 57 | # |
---|
[33] | 58 | while [ ! -z "${1}" ] # ++ pb bash |
---|
| 59 | do |
---|
| 60 | case ${1} in |
---|
| 61 | -l) |
---|
| 62 | list=${2} |
---|
| 63 | shift |
---|
| 64 | ;; |
---|
[35] | 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 | ;; |
---|
[33] | 93 | *) # other choice |
---|
| 94 | echo "${usage}" |
---|
| 95 | ;; |
---|
| 96 | esac |
---|
| 97 | shift # next flag |
---|
[32] | 98 | done |
---|
| 99 | # |
---|
[33] | 100 | set -u |
---|
[32] | 101 | # |
---|
[33] | 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 |
---|
[32] | 109 | # |
---|
[35] | 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 | # |
---|
[33] | 140 | # ++ conversion of latitude and longitude in x and y indexes |
---|
[35] | 141 | case ${orcares} in |
---|
[33] | 142 | ORCA025) |
---|
[35] | 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 | ;; |
---|
[33] | 149 | *) |
---|
| 150 | echo "eee : pb conversion lat,long to x,y" |
---|
| 151 | exit 1 |
---|
| 152 | ;; |
---|
| 153 | esac |
---|
| 154 | # |
---|
[32] | 155 | # extract ssh and create a new set of files |
---|
[33] | 156 | list_ssh="" |
---|
[32] | 157 | for file in `cat ${list}` |
---|
| 158 | do |
---|
[35] | 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} |
---|
[33] | 164 | status_ncks=${?} |
---|
| 165 | if [ ${status_ncks} -ne 0 ] |
---|
| 166 | then |
---|
| 167 | echo "eee : pb with ncks ${file}" |
---|
| 168 | exit 1 |
---|
| 169 | else |
---|
[35] | 170 | list_ssh="${list_ssh} ${filessh}" |
---|
[33] | 171 | fi |
---|
[32] | 172 | done |
---|
[35] | 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}'` |
---|
[32] | 179 | # |
---|
[35] | 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} |
---|
[33] | 184 | status_ncrcat=${?} |
---|
| 185 | if [ ${status_ncrcat} -ne 0 ] |
---|
| 186 | then |
---|
| 187 | echo "eee : pb with ncrcat" |
---|
| 188 | exit 1 |
---|
[35] | 189 | else |
---|
| 190 | echo "iii : result in ${filetot}" |
---|
[33] | 191 | fi |
---|
[35] | 192 | # |
---|
| 193 | # ++ global attributes |
---|
| 194 | # ++ convention |
---|
| 195 | # ++ nedtcf output or ascii |
---|
| 196 | # clean |
---|
[33] | 197 | rm ${list_ssh} |
---|
[32] | 198 | # |
---|
| 199 | # end |
---|
[35] | 200 | exit 0 |
---|