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