source: trunk/src/refdataget.sh @ 48

Last change on this file since 48 was 27, checked in by pinsard, 15 years ago

add refdataget.sh : get reference data files

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
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#
36# EXAMPLES
37# ========
38#
39# If you are working on LOCEAN machine and you don't have any reference data,
40# you just have to run this tool :
41# ::
42#
43# $ refdataget.sh
44#
45#
46# And look at log file wtih :
47# ::
48#
49# $ tlogd.sh refdataget
50#
51# and of course on files in ${IRCAAM_ID}.
52#
53# CAUTIONS
54# ========
55#
56# how to know if the is enough place before ?
57#
58# SEE ALSO
59# ========
60#
61# ircaam_profile.sh_
62#
63# .. _ircaam_profile.sh: ircaam_profile.sh.html
64#
65# FILES
66# =====
67#
68# /usr/home/fplod/incas/ircaam/ircaam_ws/src/refdataget.sh sur aedon.locean-ipsl.upmc.fr
69#
70# TODO
71# ====
72#
73# ++ les fichiers de benjamin
74#
75# ++ la carte du monde
76#
77# ++ pb avec la saisie du mot de passe
78#
79# ++ et si je travaille sur une machine climserv ?
80#
81# EVOLUTIONS
82# ==========
83#
84# $Id$
85#
86# - fplod 2009-01-08T10:40:55Z aedon.locean-ipsl.upmc.fr (Darwin)
87#
88#   * creation from varamma_ws/src/paper01_pre.sh
89#
90#-
91system=$(uname)
92case "${system}" in
93AIX|IRIX64)
94 echo " www : no specific posix checking"
95;;
96*)
97 set -o posix
98;;
99esac
100#
101command=$(basename ${0})
102log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
103#
104usage=" Usage : ${command}"
105#
106hostname=$(hostname)
107#
108set -u
109#
110# check for ${IRCAAM_LOG} definition
111if [ "${IRCAAM_LOG}" = "" ]
112then
113 echo " eee : \${IRCAAM_LOG} not defined"
114 exit 1
115fi
116#
117# check for ${IRCAAM_LOG} existence
118if [ ! -d ${IRCAAM_LOG} ]
119then
120 echo " eee : ${IRCAAM_LOG} not found"
121 exit 1
122fi
123#
124# check for permission access on IRCAAM_LOG
125if [ ! -x ${IRCAAM_LOG} ]
126then
127 echo " eee : ${IRCAAM_LOG} not reachable"
128 exit 1
129fi
130#
131# check for write permission on IRCAAM_LOG
132if [ ! -w ${IRCAAM_LOG} ]
133then
134 echo " eee : ${IRCAAM_LOG} not writable"
135 exit 1
136fi
137#
138log=${IRCAAM_LOG}/$(basename ${0} .sh).log.${log_date}
139echo "command = ${command}" 1>> ${log}
140echo "hostname = ${hostname}" 1>> ${log}
141echo "runtime = ${log_date}" 1>> ${log}
142#
143# check for write permission on IRCAAM_ID
144if [ ! -w ${IRCAAM_ID} ]
145then
146 echo " eee : ${IRCAAM_ID} not writable"
147 exit 1
148fi
149
150# ARPEGE
151list_param="rlut_d zg_d pr_d"
152list_simu="CtIV CtCl AfNQIVIV AsNQIVIV TrNQIVIV" 
153year_min=1971
154year_max=2000
155dirrefb="http://www.cnrm.meteo.fr/dods-ensembles/Datasets/IRCAAM/"
156#
157read -s -p "enter ircaam-dods password : " dods_passwd
158#
159for simu in ${list_simu}
160do
161 case ${simu} in
162 CtIV|CtCl|AfNQIVIV)
163  dirref="${dirrefb}/Sim/"
164 ;;
165 AsNQIVIV)
166  dirref="${dirrefb}/Sim_As/"
167 ;;
168 TrNQIVIV)
169  dirref="${dirrefb}/Sim_Tr/"
170 ;;
171 *)
172  echo "eee : wrong \${simu}"
173  exit 1
174 esac
175 dirref="${dirref}/${simu}/"
176 for param in ${list_param}
177 do
178  year_i=${year_min}
179  while [ ${year_i} -le ${year_max} ]
180  do
181   year_c=$(echo ${year_i} | awk ' {printf "%4.4d",$0}')
182   fileref=${param}.${simu}.${year_c}06-09.nc
183   if  [ -f ${IRCAAM_ID}/${fileref} ]
184   then
185    echo "iii : ${IRCAAM_ID}/${fileref} exist" ${log} 2>&1
186    echo "iii : nothing done" >> ${log} 2>&1
187   else
188    wget --no-verbose --user=ircaam-dods --password=${dods_passwd} \
189    -P ${IRCAAM_ID} \
190    ${dirref}/${fileref} >> ${log} 2>&1
191    # ++ ok ?
192    # ++ si climserv faire ln -s ${dirref}/${fileref} ${VARAMMA_ID}/
193   fi
194   year_i=$(( ${year_i} + 1 ))
195  done
196 done
197done
198
199# OLR
200fileref=olr.day.mean.nc
201dirref=ftp://ftp.climserv.ipsl.polytechnique.fr/noaa-olr/
202if  [ -f ${IRCAAM_ID}/${fileref} ]
203then
204 echo "iii : ${IRCAAM_ID}/${fileref} exist"  >> ${log} 2>&1
205 echo "iii : nothing done" >> ${log} 2>&1
206else
207 wget --no-verbose -P ${IRCAAM_ID} ${dirref}/${fileref} >> ${log}
208 # ++ ok ?
209fi
210#
211# end
212exit 0
Note: See TracBrowser for help on using the repository browser.