source: trunk/src/refdataget.sh @ 67

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

project homogenization

  • 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# 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#-
92system=$(uname)
93case "${system}" in
94AIX|IRIX64)
95 echo " www : no specific posix checking"
96;;
97*)
98 set -o posix
99;;
100esac
101#
102LANG=POSIX
103#
104command=$(basename ${0})
105log_date=$(date -u +"%Y%m%dT%H%M%SZ")
106#
107usage=" Usage : ${command}"
108#
109hostname=$(hostname)
110#
111set -u
112#
113# check for ${IRCAAM_LOG} definition
114if [ "${IRCAAM_LOG}" = "" ]
115then
116 echo " eee : \${IRCAAM_LOG} not defined"
117 exit 1
118fi
119#
120# check for ${IRCAAM_LOG} existence
121if [ ! -d ${IRCAAM_LOG} ]
122then
123 echo " eee : ${IRCAAM_LOG} not found"
124 exit 1
125fi
126#
127# check for permission access on IRCAAM_LOG
128if [ ! -x ${IRCAAM_LOG} ]
129then
130 echo " eee : ${IRCAAM_LOG} not reachable"
131 exit 1
132fi
133#
134# check for write permission on IRCAAM_LOG
135if [ ! -w ${IRCAAM_LOG} ]
136then
137 echo " eee : ${IRCAAM_LOG} not writable"
138 exit 1
139fi
140#
141log=${IRCAAM_LOG}/$(basename ${0} .sh).log.${log_date}
142echo "command = ${command}" 1>> ${log}
143echo "hostname = ${hostname}" 1>> ${log}
144echo "runtime = ${log_date}" 1>> ${log}
145#
146# check for write permission on IRCAAM_ID
147if [ ! -w ${IRCAAM_ID} ]
148then
149 echo " eee : ${IRCAAM_ID} not writable"
150 exit 1
151fi
152
153# ARPEGE
154list_param="rlut_d zg_d pr_d"
155list_simu="CtIV CtCl AfNQIVIV AsNQIVIV TrNQIVIV" 
156year_min=1971
157year_max=2000
158dirrefb="http://www.cnrm.meteo.fr/dods-ensembles/Datasets/IRCAAM/"
159#
160read -s -p "enter ircaam-dods password : " dods_passwd
161#
162for simu in ${list_simu}
163do
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
200done
201
202# OLR
203fileref=olr.day.mean.nc
204dirref=ftp://ftp.climserv.ipsl.polytechnique.fr/noaa-olr/
205if  [ -f ${IRCAAM_ID}/${fileref} ]
206then
207 echo "iii : ${IRCAAM_ID}/${fileref} exist"  >> ${log} 2>&1
208 echo "iii : nothing done" >> ${log} 2>&1
209else
210 wget --no-verbose -P ${IRCAAM_ID} ${dirref}/${fileref} >> ${log}
211 # ++ ok ?
212fi
213#
214# end
215exit 0
Note: See TracBrowser for help on using the repository browser.