1 | #! /bin/sh |
---|
2 | # |
---|
3 | #+ |
---|
4 | # .. _getmodelout.sh: |
---|
5 | # |
---|
6 | # ============== |
---|
7 | # getmodelout.sh |
---|
8 | # ============== |
---|
9 | # |
---|
10 | # ------------------------------------------ |
---|
11 | # get model data output file in ${GEOMAG_ID} |
---|
12 | # ------------------------------------------ |
---|
13 | # |
---|
14 | # SYNOPSIS |
---|
15 | # ======== |
---|
16 | # |
---|
17 | # .. code-block:: bash |
---|
18 | # |
---|
19 | # getmodelout.sh -r orcares -exp drakkar_exp -g grid -yearmin yyyy -yearmax yyyy -o list |
---|
20 | # |
---|
21 | # DESCRIPTION |
---|
22 | # =========== |
---|
23 | # |
---|
24 | # get model data output file in ${GEOMAG_ID} |
---|
25 | # |
---|
26 | # EXAMPLES |
---|
27 | # ======== |
---|
28 | # |
---|
29 | # To get DRAKKAR G42 experiment output on grid T points between year 9 and 10: |
---|
30 | # |
---|
31 | # .. code-block:: bash |
---|
32 | # |
---|
33 | # getmodelout.sh -r ORCA025 -exp G42 -g gridT -yearmin 9 -yearmax 10 -o ${GEOMAG_OD}/list_G42 |
---|
34 | # |
---|
35 | # EVOLUTIONS |
---|
36 | # ========== |
---|
37 | # |
---|
38 | # $Id$ |
---|
39 | # |
---|
40 | # - fplod 20100318T073947Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
41 | # |
---|
42 | # * unset |
---|
43 | # |
---|
44 | # - reee522 2007-11-26T11:21:37Z rhodes (IRIX64) |
---|
45 | # |
---|
46 | # * creation |
---|
47 | #- |
---|
48 | # |
---|
49 | command=getmodelout.sh |
---|
50 | # |
---|
51 | usage=" Usage : ${command} -r orcares -exp drakkar_exp -g grid -o list" |
---|
52 | # |
---|
53 | set -u |
---|
54 | while [ ${#} -gt 0 ] |
---|
55 | do |
---|
56 | case ${1} in |
---|
57 | -r) |
---|
58 | orcares=${2} |
---|
59 | shift |
---|
60 | ;; |
---|
61 | -exp) |
---|
62 | drakkar_exp=${2} |
---|
63 | shift |
---|
64 | ;; |
---|
65 | -g) |
---|
66 | grid=${2} |
---|
67 | shift |
---|
68 | ;; |
---|
69 | -yearmin) |
---|
70 | yearmin=${2} |
---|
71 | shift |
---|
72 | ;; |
---|
73 | -yearmax) |
---|
74 | yearmax=${2} |
---|
75 | shift |
---|
76 | ;; |
---|
77 | -o) |
---|
78 | list=${2} |
---|
79 | shift |
---|
80 | ;; |
---|
81 | *) |
---|
82 | # other choice |
---|
83 | echo "eee : unknown option ${1}" |
---|
84 | echo "${usage}" |
---|
85 | ;; |
---|
86 | esac |
---|
87 | # next flag |
---|
88 | shift |
---|
89 | done |
---|
90 | unset usage |
---|
91 | # |
---|
92 | # check GEOMAG environement |
---|
93 | if [ ! -d ${GEOMAG_LOG} ] |
---|
94 | then |
---|
95 | echo " eee : \${GEOMAG_LOG} not found" |
---|
96 | exit 1 |
---|
97 | fi |
---|
98 | # |
---|
99 | if [ -f ${list} ] |
---|
100 | then |
---|
101 | echo "eee : ${list} exist" |
---|
102 | exit 1 |
---|
103 | fi |
---|
104 | # ++ blindage en tout genre |
---|
105 | # |
---|
106 | case ${orcares} in |
---|
107 | ORCA025) |
---|
108 | # sur l'idris |
---|
109 | dirref=/u/rech/cli/rcli002/ |
---|
110 | ;; |
---|
111 | *) |
---|
112 | echo "eee : pb \${orcares} = ${orcares}" |
---|
113 | ;; |
---|
114 | esac |
---|
115 | # |
---|
116 | listfull=${GEOMAG_LOG}/lisfull${$} |
---|
117 | # |
---|
118 | iyear=${yearmin} |
---|
119 | while [ ${iyear} -le ${yearmax} ] |
---|
120 | do |
---|
121 | cyear=`printf "%4.4d" ${iyear}` |
---|
122 | ls ${dirref}/${orcares}/${orcares}-${drakkar_exp}-S/${cyear}/${orcares}-${drakkar_exp}_y${cyear}m??d??_${grid}.nc >> ${listfull} |
---|
123 | unset cyear |
---|
124 | # ++ calcul taille cf myls dans faq es dods |
---|
125 | # iyear=$(( ${iyear} + 1 )) ++ pas ok sur rhodes |
---|
126 | # iyear=$(expr ${iyear} + 1 ) ++ pas ok sur rhodes |
---|
127 | iyear=`expr ${iyear} + 1 ` |
---|
128 | done |
---|
129 | unset iyear |
---|
130 | unset dirref |
---|
131 | unset orcares |
---|
132 | unset drakkar_exp |
---|
133 | unset grid |
---|
134 | # |
---|
135 | # print total size of model files |
---|
136 | # ++ pb syntaxe unitsop="1024**2" # Mo |
---|
137 | #ls -l `cat ${listfull}` | \ |
---|
138 | #awk 'NF>4 {print $5, $9}' | \ |
---|
139 | #awk 'sum=$1/'$unitsop'+sum {printf("%08.3f '$units' -- %s\n",$1/'$unitsop', $2)} |
---|
140 | # |
---|
141 | # put files in ${GEOMAG_ID} |
---|
142 | # ++ ln cp ou scp |
---|
143 | # ++ -f ou test si deja existant |
---|
144 | for file in `cat ${listfull}` |
---|
145 | do |
---|
146 | ln -sf ${file} ${GEOMAG_ID} |
---|
147 | echo ${GEOMAG_ID}/`basename ${file}` >> ${list} |
---|
148 | done |
---|
149 | unset listfull |
---|
150 | # |
---|
151 | # end |
---|
152 | exit 0 |
---|