source: trunk/src/refdataget.sh @ 82

Last change on this file since 82 was 82, checked in by pinsard, 14 years ago

modif. of headers for manuals hyperlinks improvements

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