2 |
michaesp |
1 |
#!/bin/csh
|
|
|
2 |
|
|
|
3 |
# -----------------------------------------------------------------------------
|
|
|
4 |
# Set some general parameters
|
|
|
5 |
# -----------------------------------------------------------------------------
|
|
|
6 |
|
|
|
7 |
# Usage
|
|
|
8 |
if ( $#argv == 0 ) then
|
7 |
michaesp |
9 |
echo "install.sh [lib|core|goodies|links|all|clean] "
|
2 |
michaesp |
10 |
exit 0
|
|
|
11 |
endif
|
|
|
12 |
|
|
|
13 |
# Set the mode
|
|
|
14 |
set mode = $1
|
|
|
15 |
|
11 |
michaesp |
16 |
# Set path for development
|
|
|
17 |
set path_devel = "${DYN_TOOLS}/lagranto.wrf/"
|
|
|
18 |
set path_sync = "${DYN_TOOLS}/lagranto/"
|
2 |
michaesp |
19 |
|
|
|
20 |
# Init Fortran compiler and set netCDF acccordingly
|
|
|
21 |
setenv FORTRAN pgf90
|
|
|
22 |
|
|
|
23 |
# Init netCDF library depending on the Fortran compiler
|
|
|
24 |
if ( "${FORTRAN}" == "pgf90" ) then
|
11 |
michaesp |
25 |
module load netcdf/4.2.1-pgf90
|
2 |
michaesp |
26 |
|
|
|
27 |
else if ( "${FORTRAN}" == "gfortran" ) then
|
|
|
28 |
module load gfortran
|
|
|
29 |
module load netcdf/4.1.1
|
|
|
30 |
|
|
|
31 |
else if ( "${FORTRAN}" == "ifort" ) then
|
|
|
32 |
module load ifort/10.1.017
|
|
|
33 |
module load netcdf/4.1.1-ifort
|
|
|
34 |
|
|
|
35 |
else
|
|
|
36 |
echo "Fortran Compiler ${FORTRAN} not supported... Exit"
|
|
|
37 |
exit 1
|
|
|
38 |
|
|
|
39 |
endif
|
|
|
40 |
|
|
|
41 |
# -----------------------------------------------------------------------------
|
|
|
42 |
# Set internal parameters and detailed installation mode
|
|
|
43 |
# -----------------------------------------------------------------------------
|
|
|
44 |
|
|
|
45 |
# Set LAGRANTO environment variable
|
|
|
46 |
setenv LAGRANTO ${path_devel}
|
|
|
47 |
|
|
|
48 |
# Set netCDF paths
|
11 |
michaesp |
49 |
setenv NETCDF_LIB `nc-config --flibs`
|
|
|
50 |
setenv NETCDF_INC `nc-config --fflags`
|
2 |
michaesp |
51 |
|
|
|
52 |
# Set list of core programs
|
|
|
53 |
set core = "caltra trace select"
|
|
|
54 |
|
|
|
55 |
# Set list of goodies
|
|
|
56 |
set tools = "extract gettidiff getvars list2lsl lsl2list mergetra newtime reformat timeres trainfo difference datelist tracal wrfmap"
|
|
|
57 |
|
|
|
58 |
# Set list of libraries
|
|
|
59 |
set libs = "iotra inter times libcdfio libcdfplus libwrf"
|
|
|
60 |
|
|
|
61 |
# Core programs
|
|
|
62 |
foreach prog ( $core )
|
|
|
63 |
if ( "${prog}" == "${mode}" ) then
|
|
|
64 |
set core = ${prog}
|
|
|
65 |
set mode = "core"
|
|
|
66 |
endif
|
|
|
67 |
end
|
|
|
68 |
|
|
|
69 |
# Goodies
|
|
|
70 |
foreach tool ( $tools )
|
|
|
71 |
if ( "${tool}" == "${mode}" ) then
|
|
|
72 |
set tools = ${tool}
|
|
|
73 |
set mode = "goodies"
|
|
|
74 |
endif
|
|
|
75 |
end
|
|
|
76 |
|
|
|
77 |
# Libraries
|
|
|
78 |
foreach lib ( $libs )
|
|
|
79 |
if ( "${lib}" == "${mode}" ) then
|
|
|
80 |
set libs = ${lib}
|
|
|
81 |
set mode = "lib"
|
|
|
82 |
endif
|
|
|
83 |
end
|
|
|
84 |
|
7 |
michaesp |
85 |
# -----------------------------------------------------------------------------
|
|
|
86 |
# Make clean
|
|
|
87 |
# -----------------------------------------------------------------------------
|
2 |
michaesp |
88 |
|
7 |
michaesp |
89 |
if ( "${mode}" == "clean" ) then
|
|
|
90 |
|
|
|
91 |
\rm -f caltra/caltra caltra/caltra.o
|
|
|
92 |
\rm -f select/select select/select.o select/special.o
|
|
|
93 |
\rm -f trace/trace trace/trace.o
|
|
|
94 |
|
|
|
95 |
foreach tool ( $tools )
|
|
|
96 |
\rm -f goodies/${tool} goodies/${tool}.o
|
|
|
97 |
end
|
|
|
98 |
\rm -f goodies/*.mod
|
|
|
99 |
|
|
|
100 |
\rm lib/*.a lib/*.o
|
|
|
101 |
|
|
|
102 |
\rm -f bin/caltra bin/caltra.sh
|
|
|
103 |
\rm -f bin/select bin/select.sh bin/seltra bin/seltra.sh
|
|
|
104 |
\rm -f bin/trace bin/trace.sh
|
|
|
105 |
foreach tool ( $tools )
|
|
|
106 |
\rm -f bin/${tool} bin/${tool}.sh
|
|
|
107 |
end
|
|
|
108 |
\rm -f bin/lagrantohelp.sh
|
|
|
109 |
|
|
|
110 |
exit 0
|
|
|
111 |
|
|
|
112 |
endif
|
|
|
113 |
|
2 |
michaesp |
114 |
# -----------------------------------------------------------------------------
|
|
|
115 |
# Install libraries
|
|
|
116 |
# -----------------------------------------------------------------------------
|
|
|
117 |
|
|
|
118 |
if ( ("${mode}" == "lib") | ("${mode}" == "all" ) ) then
|
|
|
119 |
|
|
|
120 |
echo "-----------------------------------------------------------------"
|
|
|
121 |
echo "Installing libraries"
|
|
|
122 |
echo "-----------------------------------------------------------------"
|
|
|
123 |
echo
|
|
|
124 |
|
|
|
125 |
# Change to library directory
|
|
|
126 |
cd ${LAGRANTO}/lib
|
|
|
127 |
|
|
|
128 |
# Loop over all libraries - compile and make library
|
|
|
129 |
foreach lib ( $libs )
|
|
|
130 |
|
|
|
131 |
\rm -f ${lib}.a
|
|
|
132 |
\rm -f ${lib}.o
|
|
|
133 |
echo ${FORTRAN} -c -O ${lib}.f
|
11 |
michaesp |
134 |
${FORTRAN} -c -O ${NETCDF_INC} ${lib}.f
|
2 |
michaesp |
135 |
ar r ${lib}.a ${lib}.o
|
|
|
136 |
\rm -f ${lib}.l ${lib}.o
|
|
|
137 |
ranlib ${lib}.a
|
|
|
138 |
if ( ! -f ${lib}.a ) then
|
|
|
139 |
echo "Problem in compiling ${lib} ... Stop"
|
|
|
140 |
exit 1
|
|
|
141 |
endif
|
|
|
142 |
|
|
|
143 |
end
|
|
|
144 |
|
|
|
145 |
endif
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
# -----------------------------------------------------------------------------
|
|
|
149 |
# Check that libraries are ok
|
|
|
150 |
# -----------------------------------------------------------------------------
|
|
|
151 |
|
|
|
152 |
echo
|
|
|
153 |
echo "-----------------------------------------------------------------"
|
|
|
154 |
echo "Check that all libraries are available"
|
|
|
155 |
echo "-----------------------------------------------------------------"
|
|
|
156 |
echo
|
|
|
157 |
|
|
|
158 |
# Change to library directory
|
|
|
159 |
cd ${LAGRANTO}/lib
|
|
|
160 |
|
|
|
161 |
# Check whether all libraries are available
|
|
|
162 |
foreach lib ( $libs )
|
|
|
163 |
|
|
|
164 |
if ( ! -f ${lib}.a ) then
|
|
|
165 |
echo "Library ${lib} missing... Stop"
|
|
|
166 |
exit 1
|
|
|
167 |
else
|
|
|
168 |
ls -l ${lib}.a
|
|
|
169 |
endif
|
|
|
170 |
|
|
|
171 |
end
|
|
|
172 |
|
|
|
173 |
# Exit if only libraries shoudl be installed
|
|
|
174 |
if ( "${mode}" == "lib" ) exit 0
|
|
|
175 |
|
|
|
176 |
# -----------------------------------------------------------------------------
|
|
|
177 |
# Compile Lagrango core programs
|
|
|
178 |
# -----------------------------------------------------------------------------
|
|
|
179 |
|
|
|
180 |
if ( ("${mode}" == "all" ) | ("${mode}" == "core" ) ) then
|
|
|
181 |
|
|
|
182 |
echo
|
|
|
183 |
echo "-----------------------------------------------------------------"
|
|
|
184 |
echo "Installing Lagranto core programs"
|
|
|
185 |
echo "-----------------------------------------------------------------"
|
|
|
186 |
|
|
|
187 |
foreach prog ( $core )
|
|
|
188 |
|
|
|
189 |
echo
|
|
|
190 |
echo "----- $prog"
|
|
|
191 |
echo
|
|
|
192 |
cd ${LAGRANTO}/${prog}
|
|
|
193 |
\rm -f ${prog}.o
|
|
|
194 |
\rm -f ${prog}
|
|
|
195 |
if ( "${prog}" == "select" ) \rm special.o
|
|
|
196 |
\rm -f ${prog}
|
|
|
197 |
make -f ${prog}.make
|
|
|
198 |
if ( ! -f ${prog} ) then
|
|
|
199 |
echo "Problem in compiling ${prog} ... Stop"
|
|
|
200 |
exit 1
|
|
|
201 |
endif
|
|
|
202 |
|
|
|
203 |
end
|
|
|
204 |
|
|
|
205 |
endif
|
|
|
206 |
|
|
|
207 |
# -----------------------------------------------------------------------------
|
|
|
208 |
# Check that all Lagranto core programs are available
|
|
|
209 |
# -----------------------------------------------------------------------------
|
|
|
210 |
|
|
|
211 |
echo
|
|
|
212 |
echo "-----------------------------------------------------------------"
|
|
|
213 |
echo "Check that all Lagranto core programs are available"
|
|
|
214 |
echo "-----------------------------------------------------------------"
|
|
|
215 |
echo
|
|
|
216 |
|
|
|
217 |
foreach prog ( $core )
|
|
|
218 |
|
|
|
219 |
cd ${LAGRANTO}/${prog}
|
|
|
220 |
if ( ! -f ${prog} ) then
|
|
|
221 |
echo "${prog} is missing... Stop"
|
|
|
222 |
exit 1
|
|
|
223 |
else
|
|
|
224 |
ls -l ${prog}
|
|
|
225 |
endif
|
|
|
226 |
|
|
|
227 |
end
|
|
|
228 |
|
|
|
229 |
# Exit if only core programs shoudl be installed
|
|
|
230 |
if ( "${mode}" == "core" ) exit 0
|
|
|
231 |
|
|
|
232 |
# -----------------------------------------------------------------------------
|
|
|
233 |
# Compile Lagrango goodies
|
|
|
234 |
# -----------------------------------------------------------------------------
|
|
|
235 |
|
|
|
236 |
if ( ("${mode}" == "all" ) | ("${mode}" == "goodies" ) ) then
|
|
|
237 |
|
|
|
238 |
echo
|
|
|
239 |
echo "-----------------------------------------------------------------"
|
|
|
240 |
echo "Installing Lagranto goodies"
|
|
|
241 |
echo "-----------------------------------------------------------------"
|
|
|
242 |
|
|
|
243 |
cd ${LAGRANTO}/goodies
|
|
|
244 |
|
|
|
245 |
foreach tool ( $tools )
|
|
|
246 |
|
|
|
247 |
echo
|
|
|
248 |
echo "----- ${tool}"
|
|
|
249 |
echo
|
|
|
250 |
\rm -f ${tool}.o
|
|
|
251 |
\rm -f ${tool}
|
|
|
252 |
if ( -f ${tool}.make ) then
|
|
|
253 |
make -f ${tool}.make
|
|
|
254 |
else if ( -f ${tool}.install ) then
|
|
|
255 |
./${tool}.install
|
|
|
256 |
endif
|
|
|
257 |
|
|
|
258 |
if ( ! -f ${tool} ) then
|
|
|
259 |
echo "Problem in compiling ${tool} ... Stop"
|
|
|
260 |
exit 1
|
|
|
261 |
endif
|
|
|
262 |
|
|
|
263 |
end
|
|
|
264 |
|
|
|
265 |
endif
|
|
|
266 |
|
|
|
267 |
# -----------------------------------------------------------------------------
|
|
|
268 |
# Check that all Lagranto goodies are available
|
|
|
269 |
# -----------------------------------------------------------------------------
|
|
|
270 |
|
|
|
271 |
echo
|
|
|
272 |
echo "-----------------------------------------------------------------"
|
|
|
273 |
echo "Check that all Lagranto goodies are available"
|
|
|
274 |
echo "-----------------------------------------------------------------"
|
|
|
275 |
echo
|
|
|
276 |
|
|
|
277 |
cd ${LAGRANTO}/goodies
|
|
|
278 |
|
|
|
279 |
foreach tool ( $tools )
|
|
|
280 |
|
|
|
281 |
if ( ! -f ${tool} ) then
|
|
|
282 |
echo "${tool} is missing... Stop"
|
|
|
283 |
exit 1
|
|
|
284 |
else
|
|
|
285 |
ls -l ${tool}
|
|
|
286 |
endif
|
|
|
287 |
|
|
|
288 |
end
|
|
|
289 |
|
|
|
290 |
endif
|
|
|
291 |
|
|
|
292 |
# Exit if only goodies should be installed
|
|
|
293 |
if ( "${mode}" == "goodies" ) exit 0
|
|
|
294 |
|
|
|
295 |
# -----------------------------------------------------------------------------
|
|
|
296 |
# Create links to programs
|
|
|
297 |
# -----------------------------------------------------------------------------
|
|
|
298 |
|
|
|
299 |
if ( ("${mode}" == "all" ) | ("${mode}" == "links" ) ) then
|
|
|
300 |
|
|
|
301 |
echo
|
|
|
302 |
echo "-----------------------------------------------------------------"
|
|
|
303 |
echo "Create links in ${LAGRANTO}/bin/"
|
|
|
304 |
echo "-----------------------------------------------------------------"
|
|
|
305 |
echo
|
|
|
306 |
|
|
|
307 |
if ( ! -d ${LAGRANTO}/bin ) mkdir ${LAGRANTO}/bin
|
|
|
308 |
cd ${LAGRANTO}/bin
|
|
|
309 |
|
|
|
310 |
ln -svf ${LAGRANTO}/bin/lagrantohelp lagrantohelp.sh
|
11 |
michaesp |
311 |
ln -svf ${LAGRANTO}/bin/lagrantohelp lagrantohelp.wrf
|
2 |
michaesp |
312 |
|
|
|
313 |
ln -svf ${LAGRANTO}/caltra/caltra.sh caltra.sh
|
|
|
314 |
ln -svf ${LAGRANTO}/select/select.sh select.sh
|
|
|
315 |
ln -svf ${LAGRANTO}/trace/trace.sh trace.sh
|
|
|
316 |
|
|
|
317 |
ln -svf ${LAGRANTO}/caltra/caltra.sh caltra
|
|
|
318 |
ln -svf ${LAGRANTO}/select/select.sh select
|
|
|
319 |
ln -svf ${LAGRANTO}/trace/trace.sh trace
|
|
|
320 |
|
11 |
michaesp |
321 |
ln -svf ${LAGRANTO}/caltra/caltra.sh caltra.wrf
|
|
|
322 |
ln -svf ${LAGRANTO}/select/select.sh select.wrf
|
|
|
323 |
ln -svf ${LAGRANTO}/trace/trace.sh trace.wrf
|
|
|
324 |
|
|
|
325 |
|
2 |
michaesp |
326 |
foreach tool ( $tools )
|
|
|
327 |
|
|
|
328 |
ln -svf ${LAGRANTO}/goodies/${tool}.sh ${tool}.sh
|
|
|
329 |
ln -svf ${LAGRANTO}/goodies/${tool}.sh ${tool}
|
11 |
michaesp |
330 |
ln -svf ${LAGRANTO}/goodies/${tool}.sh ${tool}.wrf
|
2 |
michaesp |
331 |
|
|
|
332 |
end
|
|
|
333 |
|
|
|
334 |
# Set extra name for <select> to avoid conflict in BASH
|
|
|
335 |
ln -svf ${LAGRANTO}/select/select.sh seltra
|
|
|
336 |
ln -svf ${LAGRANTO}/select/select.sh seltra.sh
|
11 |
michaesp |
337 |
ln -svf ${LAGRANTO}/select/select.sh seltra.wrf
|
2 |
michaesp |
338 |
|
|
|
339 |
endif
|
|
|
340 |
|
|
|
341 |
# -----------------------------------------------------------------------------
|
11 |
michaesp |
342 |
# Synchronise ( development -> operational )
|
|
|
343 |
# -----------------------------------------------------------------------------
|
|
|
344 |
|
|
|
345 |
if ( ("${mode}" == "all" ) | ("${mode}" == "sync" ) ) then
|
|
|
346 |
|
|
|
347 |
echo
|
|
|
348 |
echo "-----------------------------------------------------------------"
|
|
|
349 |
echo "Sync ( lagranto.wrf -> lagranto )"
|
|
|
350 |
echo "-----------------------------------------------------------------"
|
|
|
351 |
echo
|
|
|
352 |
|
|
|
353 |
cd ${path_sync}/bin/
|
|
|
354 |
|
|
|
355 |
ln -svf ${path_devel}/bin/lagrantohelp.sh lagrantohelp.wrf
|
|
|
356 |
|
|
|
357 |
ln -svf ${path_devel}/caltra/caltra.sh caltra.wrf
|
|
|
358 |
ln -svf ${path_devel}/select/select.sh select.wrf
|
|
|
359 |
ln -svf ${path_devel}/trace/trace.sh trace.wrf
|
|
|
360 |
ln -svf ${path_devel}/lidar/seltra.sh seltra.wrf
|
|
|
361 |
|
|
|
362 |
foreach tool ( $tools )
|
|
|
363 |
|
|
|
364 |
ln -svf ${path_devel}/goodies/${tool}.sh ${tool}.wrf
|
|
|
365 |
|
|
|
366 |
end
|
|
|
367 |
|
|
|
368 |
# Set all permissions
|
|
|
369 |
chmod -R og+rx ${path_sync}/bin/
|
|
|
370 |
|
|
|
371 |
endif
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
# -----------------------------------------------------------------------------
|
2 |
michaesp |
375 |
# Final tasks
|
|
|
376 |
# -----------------------------------------------------------------------------
|
|
|
377 |
|
|
|
378 |
echo
|
|
|
379 |
echo "-----------------------------------------------------------------"
|
|
|
380 |
echo "Installation complete"
|
|
|
381 |
echo "-----------------------------------------------------------------"
|
|
|
382 |
echo
|
|
|
383 |
echo "Please set the environmental variable LAGRANTO"
|
|
|
384 |
echo
|
|
|
385 |
echo " setenv LAGRANTO ${LAGRANTO}"
|
|
|
386 |
echo
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
|
391 |
|