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
RevLine 
[27]1#! /bin/sh
[67]2#+
[27]3#
[82]4# .. _refdataget.sh:
5#
[72]6# =============
7# refdataget.sh
8# =============
[27]9#
[72]10# ----------------------
11# get all reference data
12# ----------------------
[27]13#
14# SYNOPSIS
15# ========
16#
17# ``refdataget.sh``
18#
19# DESCRIPTION
20# ===========
21#
[80]22# Put in ${IRCAAM_ID} all the reference data files
[27]23#
24# This includes :
25#
[80]26# - ARPEGE data
[27]27#   4 parameters (rlut_d zg_d pr_d) in 5 simulations experiences
28#   (CtIV CtCl AfNQIVIV AsNQIVIV TrNQIVIV) between 1971 and 2000.
29#
[80]30#   You will need password from authorized people to access to ARPEGE
[27]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#
[80]43# If you are working on LOCEAN machine and you don't have any reference data,
[75]44# you just have to run this tool ::
[27]45#
[75]46#  $ refdataget.sh
[80]47#
[75]48# And look at log file with ::
[27]49#
[75]50#  $ tlogd.sh refdataget
[80]51#
[27]52# and of course on files in ${IRCAAM_ID}.
53#
54# CAUTIONS
55# ========
56#
[62]57# how to know if there is enough place before ?
[27]58#
59# SEE ALSO
60# ========
61#
[82]62# :ref:`ircaam_profile.sh`
[27]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#
[62]75# ++ ajouter des options par dataset
76#
[81]77# ++ unset
78#
[27]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
[77]91   AIX|IRIX64)
92      echo " www : no specific posix checking"
93   ;;
94   *)
95      set -o posix
96   ;;
[27]97esac
[75]98unset system
[27]99#
[60]100LANG=POSIX
101#
[27]102command=$(basename ${0})
[67]103log_date=$(date -u +"%Y%m%dT%H%M%SZ")
[27]104#
105usage=" Usage : ${command}"
106#
107hostname=$(hostname)
108#
109set -u
110#
111# check for ${IRCAAM_LOG} definition
112if [ "${IRCAAM_LOG}" = "" ]
113then
[77]114   echo " eee : \${IRCAAM_LOG} not defined"
115   exit 1
[27]116fi
117#
118# check for ${IRCAAM_LOG} existence
119if [ ! -d ${IRCAAM_LOG} ]
120then
[77]121   echo " eee : ${IRCAAM_LOG} not found"
122   exit 1
[27]123fi
124#
125# check for permission access on IRCAAM_LOG
126if [ ! -x ${IRCAAM_LOG} ]
127then
[77]128   echo " eee : ${IRCAAM_LOG} not reachable"
129   exit 1
[27]130fi
131#
132# check for write permission on IRCAAM_LOG
133if [ ! -w ${IRCAAM_LOG} ]
134then
[77]135   echo " eee : ${IRCAAM_LOG} not writable"
136   exit 1
[27]137fi
138#
139log=${IRCAAM_LOG}/$(basename ${0} .sh).log.${log_date}
[75]140echo "[Context]" 1>> ${log}
141echo "command=${command}" 1>> ${log}
142echo "hostname=${hostname}" 1>> ${log}
143echo "runtime=${log_date}" 1>> ${log}
[27]144#
145# check for write permission on IRCAAM_ID
146if [ ! -w ${IRCAAM_ID} ]
147then
[77]148   echo " eee : ${IRCAAM_ID} not writable"
149   exit 1
[27]150fi
151
152# ARPEGE
153list_param="rlut_d zg_d pr_d"
[80]154list_simu="CtIV CtCl AfNQIVIV AsNQIVIV TrNQIVIV"
[27]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
[77]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 ?
[81]195            # ++ si climserv faire ln -s ${dirref}/${fileref} ${IRCAAM_ID}/
[77]196         fi
197         year_i=$(( ${year_i} + 1 ))
198      done
[81]199      unset year_i
[77]200   done
[81]201   unset param
[27]202done
203# OLR
204fileref=olr.day.mean.nc
205dirref=ftp://ftp.climserv.ipsl.polytechnique.fr/noaa-olr/
206if  [ -f ${IRCAAM_ID}/${fileref} ]
207then
[77]208   echo "iii : ${IRCAAM_ID}/${fileref} exist"  >> ${log} 2>&1
209   echo "iii : nothing done" >> ${log} 2>&1
[27]210else
[77]211   wget --no-verbose -P ${IRCAAM_ID} ${dirref}/${fileref} >> ${log}
212   # ++ ok ?
[27]213fi
[81]214unset fileref
215unset dirref
[27]216#
217# end
[75]218set
[27]219exit 0
Note: See TracBrowser for help on using the repository browser.