1 | #! /bin/sh |
---|
2 | #+ |
---|
3 | # |
---|
4 | # .. _refdataget.sh: |
---|
5 | # |
---|
6 | # ============= |
---|
7 | # refdataget.sh |
---|
8 | # ============= |
---|
9 | # |
---|
10 | # ---------------------- |
---|
11 | # get all reference data |
---|
12 | # ---------------------- |
---|
13 | # |
---|
14 | # SYNOPSIS |
---|
15 | # ======== |
---|
16 | # |
---|
17 | # ``refdataget.sh`` |
---|
18 | # |
---|
19 | # DESCRIPTION |
---|
20 | # =========== |
---|
21 | # |
---|
22 | # Put in ${IRCAAM_ID} all the reference data files |
---|
23 | # |
---|
24 | # This includes : |
---|
25 | # |
---|
26 | # - ARPEGE data |
---|
27 | # 4 parameters (rlut_d zg_d pr_d) in 5 simulations experiences |
---|
28 | # (CtIV CtCl AfNQIVIV AsNQIVIV TrNQIVIV) between 1971 and 2000. |
---|
29 | # |
---|
30 | # You will need password from authorized people to access to ARPEGE |
---|
31 | # simulation files. |
---|
32 | # |
---|
33 | # - OLR observation between 1974 and now. |
---|
34 | # |
---|
35 | # If one of these files already exists (same name), it won't be download again |
---|
36 | # to avoid big transfert. |
---|
37 | # |
---|
38 | # It might be usefull to check revision of original data ... |
---|
39 | # |
---|
40 | # EXAMPLES |
---|
41 | # ======== |
---|
42 | # |
---|
43 | # If you are working on LOCEAN machine and you don't have any reference data, |
---|
44 | # you just have to run this tool : |
---|
45 | # |
---|
46 | # .. code-block:: bash |
---|
47 | # |
---|
48 | # refdataget.sh |
---|
49 | # |
---|
50 | # And look at log file with : |
---|
51 | # |
---|
52 | # .. code-block:: bash |
---|
53 | # |
---|
54 | # tlogd.sh refdataget |
---|
55 | # |
---|
56 | # and of course on files in ${IRCAAM_ID}. |
---|
57 | # |
---|
58 | # CAUTIONS |
---|
59 | # ======== |
---|
60 | # |
---|
61 | # how to know if there is enough place before ? |
---|
62 | # |
---|
63 | # SEE ALSO |
---|
64 | # ======== |
---|
65 | # |
---|
66 | # :ref:`ircaam_profile.sh` |
---|
67 | # |
---|
68 | # TODO |
---|
69 | # ==== |
---|
70 | # |
---|
71 | # ++ les fichiers de benjamin |
---|
72 | # |
---|
73 | # ++ la carte du monde |
---|
74 | # |
---|
75 | # ++ pb avec la saisie du mot de passe |
---|
76 | # |
---|
77 | # ++ et si je travaille sur une machine climserv ? |
---|
78 | # |
---|
79 | # ++ ajouter des options par dataset |
---|
80 | # |
---|
81 | # ++ unset |
---|
82 | # |
---|
83 | # EVOLUTIONS |
---|
84 | # ========== |
---|
85 | # |
---|
86 | # $Id$ |
---|
87 | # |
---|
88 | # - fplod 2009-01-08T10:40:55Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
89 | # |
---|
90 | # * creation from varamma_ws/src/paper01_pre.sh |
---|
91 | # |
---|
92 | #- |
---|
93 | system=$(uname) |
---|
94 | case "${system}" in |
---|
95 | AIX|IRIX64) |
---|
96 | echo " www : no specific posix checking" |
---|
97 | ;; |
---|
98 | *) |
---|
99 | set -o posix |
---|
100 | ;; |
---|
101 | esac |
---|
102 | unset system |
---|
103 | # |
---|
104 | LANG=POSIX |
---|
105 | # |
---|
106 | command=$(basename ${0}) |
---|
107 | log_date=$(date -u +"%Y%m%dT%H%M%SZ") |
---|
108 | # |
---|
109 | usage=" Usage : ${command}" |
---|
110 | # |
---|
111 | hostname=$(hostname) |
---|
112 | # |
---|
113 | set -u |
---|
114 | # |
---|
115 | # check for ${IRCAAM_LOG} definition |
---|
116 | if [ "${IRCAAM_LOG}" = "" ] |
---|
117 | then |
---|
118 | echo " eee : \${IRCAAM_LOG} not defined" |
---|
119 | exit 1 |
---|
120 | fi |
---|
121 | # |
---|
122 | # check for ${IRCAAM_LOG} existence |
---|
123 | if [ ! -d ${IRCAAM_LOG} ] |
---|
124 | then |
---|
125 | echo " eee : ${IRCAAM_LOG} not found" |
---|
126 | exit 1 |
---|
127 | fi |
---|
128 | # |
---|
129 | # check for permission access on IRCAAM_LOG |
---|
130 | if [ ! -x ${IRCAAM_LOG} ] |
---|
131 | then |
---|
132 | echo " eee : ${IRCAAM_LOG} not reachable" |
---|
133 | exit 1 |
---|
134 | fi |
---|
135 | # |
---|
136 | # check for write permission on IRCAAM_LOG |
---|
137 | if [ ! -w ${IRCAAM_LOG} ] |
---|
138 | then |
---|
139 | echo " eee : ${IRCAAM_LOG} not writable" |
---|
140 | exit 1 |
---|
141 | fi |
---|
142 | # |
---|
143 | log=${IRCAAM_LOG}/$(basename ${0} .sh).log.${log_date} |
---|
144 | echo "[Context]" 1>> ${log} |
---|
145 | echo "command=${command}" 1>> ${log} |
---|
146 | echo "hostname=${hostname}" 1>> ${log} |
---|
147 | echo "runtime=${log_date}" 1>> ${log} |
---|
148 | # |
---|
149 | # check for write permission on IRCAAM_ID |
---|
150 | if [ ! -w ${IRCAAM_ID} ] |
---|
151 | then |
---|
152 | echo " eee : ${IRCAAM_ID} not writable" |
---|
153 | exit 1 |
---|
154 | fi |
---|
155 | |
---|
156 | # ARPEGE |
---|
157 | list_param="rlut_d zg_d pr_d" |
---|
158 | list_simu="CtIV CtCl AfNQIVIV AsNQIVIV TrNQIVIV" |
---|
159 | year_min=1971 |
---|
160 | year_max=2000 |
---|
161 | dirrefb="http://www.cnrm.meteo.fr/dods-ensembles/Datasets/IRCAAM/" |
---|
162 | # |
---|
163 | read -s -p "enter ircaam-dods password : " dods_passwd |
---|
164 | # |
---|
165 | for simu in ${list_simu} |
---|
166 | do |
---|
167 | case ${simu} in |
---|
168 | CtIV|CtCl|AfNQIVIV) |
---|
169 | dirref="${dirrefb}/Sim/" |
---|
170 | ;; |
---|
171 | AsNQIVIV) |
---|
172 | dirref="${dirrefb}/Sim_As/" |
---|
173 | ;; |
---|
174 | TrNQIVIV) |
---|
175 | dirref="${dirrefb}/Sim_Tr/" |
---|
176 | ;; |
---|
177 | *) |
---|
178 | echo "eee : wrong \${simu}" |
---|
179 | exit 1 |
---|
180 | ;; |
---|
181 | esac |
---|
182 | dirref="${dirref}/${simu}/" |
---|
183 | for param in ${list_param} |
---|
184 | do |
---|
185 | year_i=${year_min} |
---|
186 | while [ ${year_i} -le ${year_max} ] |
---|
187 | do |
---|
188 | year_c=$(printf "%4.4d" ${year_i}') |
---|
189 | fileref=${param}.${simu}.${year_c}06-09.nc |
---|
190 | if [ -f ${IRCAAM_ID}/${fileref} ] |
---|
191 | then |
---|
192 | echo "iii : ${IRCAAM_ID}/${fileref} exist" ${log} 2>&1 |
---|
193 | echo "iii : nothing done" >> ${log} 2>&1 |
---|
194 | else |
---|
195 | wget --no-verbose --user=ircaam-dods --password=${dods_passwd} \ |
---|
196 | -P ${IRCAAM_ID} \ |
---|
197 | ${dirref}/${fileref} >> ${log} 2>&1 |
---|
198 | # ++ ok ? |
---|
199 | # ++ si climserv faire ln -s ${dirref}/${fileref} ${IRCAAM_ID}/ |
---|
200 | fi |
---|
201 | year_i=$(( ${year_i} + 1 )) |
---|
202 | done |
---|
203 | unset year_i |
---|
204 | done |
---|
205 | unset param |
---|
206 | done |
---|
207 | # OLR |
---|
208 | fileref=olr.day.mean.nc |
---|
209 | dirref=ftp://ftp.climserv.ipsl.polytechnique.fr/noaa-olr/ |
---|
210 | if [ -f ${IRCAAM_ID}/${fileref} ] |
---|
211 | then |
---|
212 | echo "iii : ${IRCAAM_ID}/${fileref} exist" >> ${log} 2>&1 |
---|
213 | echo "iii : nothing done" >> ${log} 2>&1 |
---|
214 | else |
---|
215 | wget --no-verbose -P ${IRCAAM_ID} ${dirref}/${fileref} >> ${log} |
---|
216 | # ++ ok ? |
---|
217 | fi |
---|
218 | unset fileref |
---|
219 | unset dirref |
---|
220 | # |
---|
221 | # end |
---|
222 | set |
---|
223 | exit 0 |
---|