Subversion Repositories lagranto.ocean

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
#!/bin/csh
2
 
3
# -----------------------------------------------------------------------------
4
# Set some general parameters
5
# -----------------------------------------------------------------------------
6
 
7
# Usage
8
if ( $#argv == 0 ) then
9
  echo "install.sh [lib|core|goodies|links|all|docu|clean|tag] "
10
  exit 0
11
endif
12
 
13
# Set the mode
14
set mode = $1
15
 
16
# Set path to SVN repository
17
#set svnpath=https://svn.iac.ethz.ch/pub/lagranto.ecmwf/
18
 
19
# Set paths for development and for synchronisation (operational)
20
#set path_devel = "${DYN_TOOLS}/lagranto.ecmwf/"
21
#set path_sync  = "${DYN_TOOLS}/lagranto/"
22
set path_devel  = "/home/schemms/lagranto.ocean"
23
 
24
 
25
# Init Fortran compiler and set netCDF acccordingly
26
setenv FORTRAN  gfortran
27
 
28
# Init netCDF library depending on the Fortran compiler
29
#if ( "${FORTRAN}" == "pgf90" ) then
30
#  module load netcdf/4.2.1-pgf90
31
#  module list
32
 
33
if ( "${FORTRAN}" == "gfortran" ) then
34
#  module load gfortran
35
  module load netcdf/4.3.2
36
 
37
#else if ( "${FORTRAN}" == "ifort" ) then
38
#  module load ifort/10.1.017
39
#  module load netcdf/4.1.1-ifort
40
 
41
else
42
  echo "Fortran Compiler ${FORTRAN} not supported... Exit"
43
  exit 1
44
 
45
endif
46
 
47
# -----------------------------------------------------------------------------
48
# Create a new tag in SVN repository
49
# -----------------------------------------------------------------------------
50
 
51
#if ( "${mode}" == "tag" ) then
52
#   svn info
53
#   if ( "${#argv}" != 2 ) then
54
#     echo "Usage: install.csh tag id <id=tag number>"
55
#   else
56
#     set tagnr = $2
57
#   endif
58
#   svn copy ${svnpath}/trunk ${svnpath}/tags/${tagnr} -m "Release ${tagnr}"
59
#   exit 0
60
#endif
61
 
62
# -----------------------------------------------------------------------------
63
# Set internal parameters and detailed installation mode
64
# -----------------------------------------------------------------------------
65
 
66
# Set LAGRANTO environment variable
67
setenv LAGRANTO ${path_devel}
68
 
69
# Set netCDF paths
70
setenv NETCDF_LIB `nc-config --flibs`
71
setenv NETCDF_INC `nc-config --fflags`
72
 
73
# Set list of core programs
74
set core  = "create_startf caltra trace select density lidar"
75
 
76
# Set list of goodies
77
set tools = "changecst changet extract getmima gettidiff getvars list2lsl lsl2list mergetra newtime reformat timeres trainfo difference datelist tracal"
78
 
79
# Set list of libraries
80
# set libs  = "iotra ioinp inter times libcdfio libcdfplus"
81
set libs  = "iotra ioinp inter times libcdfioplus_ocean_cf"
82
 
83
 
84
# Core programs
85
foreach prog ( $core )
86
   if ( "${prog}" == "${mode}" ) then
87
      set core  = ${prog}
88
      set mode  = "core"
89
   endif
90
end
91
 
92
# Goodies
93
foreach tool ( $tools )
94
   if ( "${tool}" == "${mode}" ) then
95
      set tools = ${tool}
96
      set mode  = "goodies"
97
   endif
98
end
99
 
100
# Libraries
101
foreach lib ( $libs )
102
   if ( "${lib}" == "${mode}" ) then
103
      set libs  = ${lib}
104
      set mode  = "lib"
105
   endif
106
end
107
 
108
# Check that the mode is ok
109
if ( "${mode}" == "all"     ) goto modeok
110
if ( "${mode}" == "lib"     ) goto modeok
111
if ( "${mode}" == "core"    ) goto modeok
112
if ( "${mode}" == "goodies" ) goto modeok
113
if ( "${mode}" == "links"   ) goto modeok
114
if ( "${mode}" == "clean"   ) goto modeok
115
if ( "${mode}" == "docu"    ) goto modeok
116
if ( "${mode}" == "sync"    ) goto modeok
117
echo "Unsupported mode ${mode} ... Stop"
118
exit 1
119
 
120
modeok:
121
 
122
# -----------------------------------------------------------------------------
123
# Make clean
124
# -----------------------------------------------------------------------------
125
 
126
if ( "${mode}" == "clean" ) then
127
 
128
cd ${LAGRANTO}/
129
 
130
foreach prog ( $core )
131
   \rm -f ${prog}/${prog} ${prog}/${prog}.o
132
end
133
\rm -f trace/calvar.o select/special.o
134
 
135
foreach tool ( $tools )
136
  \rm -f goodies/${tool} goodies/${tool}.o
137
end
138
\rm -f goodies/*.mod goodies/*.o
139
 
140
\rm lib/*.a lib/*.o
141
 
142
foreach prog ( $core )
143
   \rm -f bin/${prog} bin/${prog}.sh  bin/${prog}.ocean
144
end
145
\rm -f bin/seltra bin/seltra.sh bin/seltra.ocean
146
foreach tool ( $tools )
147
  \rm -f bin/${tool} bin/${tool}.sh bin/${tool}.ocean
148
end
149
\rm -f bin/lagrantohelp.sh bin/lagrantohelp.ocean
150
\rm -f bin/startf bin/startf.sh bin/startf.ocean
151
\rm -f bin/lagranto.sh bin/lagranto.ocean
152
 
153
\rm ${LAGRANTO}/startf
154
 
155
exit 0
156
 
157
endif
158
 
159
# -----------------------------------------------------------------------------
160
# Install reference
161
# -----------------------------------------------------------------------------
162
 
163
#if ( ("${mode}" == "docu") | ("${mode}" == "all" ) ) then
164
#
165
#echo "-----------------------------------------------------------------"
166
#echo "Installing documentation"
167
#echo "-----------------------------------------------------------------"
168
#echo
169
#
170
#cd ${LAGRANTO}/docu/reference/
171
#
172
#\rm -f reference.ps
173
#\rm -f reference2.ps
174
#groff -man ../man/*.0 > reference2.ps
175
#ps2pdf reference2.ps
176
#
177
#latex title
178
#dvips title
179
#ps2pdf title.ps
180
#
181
#gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=reference.pdf title.pdf reference2.pdf
182
#
183
#\rm -f *.aux *.log *.dvi
184
#\rm -f title.ps  reference2.ps
185
#\rm -f title.pdf reference2.pdf
186
#
187
#endif
188
#
189
#if ( "${mode}" == "docu" ) exit 0
190
#
191
 
192
 
193
# -----------------------------------------------------------------------------
194
# Install libraries
195
# -----------------------------------------------------------------------------
196
 
197
if ( ("${mode}" == "lib") | ("${mode}" == "all" ) ) then
198
 
199
echo "-----------------------------------------------------------------"
200
echo "Installing libraries"
201
echo "-----------------------------------------------------------------"
202
echo
203
 
204
# Change to library directory
205
cd ${LAGRANTO}/lib
206
 
207
# Loop over all libraries - compile and make library
208
foreach lib ( $libs )
209
 
210
\rm -f ${lib}.a
211
\rm -f ${lib}.o
212
echo ${FORTRAN} -c -O2 ${lib}.f
213
${FORTRAN} -fcheck='all' -g -c -O2 ${NETCDF_INC} ${lib}.f
214
ar r ${lib}.a ${lib}.o
215
\rm -f ${lib}.l ${lib}.o
216
ranlib ${lib}.a
217
if ( ! -f ${lib}.a ) then
218
  echo "Problem in compiling ${lib} ... Stop"
219
  exit 1
220
endif
221
 
222
end
223
 
224
endif
225
 
226
if ( "${mode}" == "lib" ) exit 0
227
 
228
# -----------------------------------------------------------------------------
229
# Check that libraries are ok
230
# -----------------------------------------------------------------------------
231
 
232
echo
233
echo "-----------------------------------------------------------------"
234
echo "Check that all libraries are available"
235
echo "-----------------------------------------------------------------"
236
echo
237
 
238
# Change to library directory
239
cd ${LAGRANTO}/lib
240
 
241
# Check whether all libraries are available
242
foreach lib ( $libs )
243
 
244
if ( ! -f ${lib}.a ) then
245
  echo "Library ${lib} missing... Stop"
246
  exit 1
247
else
248
  ls -l ${lib}.a
249
endif
250
 
251
end
252
 
253
# Exit if only libraries shoudl be installed
254
if ( "${mode}" == "lib" ) exit 0
255
 
256
# -----------------------------------------------------------------------------
257
# Compile Lagrango core programs
258
# -----------------------------------------------------------------------------
259
 
260
if ( ("${mode}" == "all" ) | ("${mode}" == "core" ) ) then
261
 
262
echo
263
echo "-----------------------------------------------------------------"
264
echo "Installing Lagranto core programs"
265
echo "-----------------------------------------------------------------"
266
 
267
foreach prog ( $core )
268
 
269
echo
270
echo "----- $prog"
271
echo
272
cd ${LAGRANTO}/${prog}
273
\rm -f ${prog}.o
274
\rm -f ${prog}
275
if ( "${prog}" == "trace"  ) \rm calvar.o
276
if ( "${prog}" == "select" ) \rm special.o
277
\rm -f ${prog}
278
make -f ${prog}.make
279
if ( ! -f ${prog} ) then
280
  echo "Problem in compiling ${prog} ... Stop"
281
  exit 1
282
endif
283
 
284
end
285
 
286
endif
287
 
288
if ( "${mode}" == "core" ) exit 0
289
 
290
# -----------------------------------------------------------------------------
291
# Check that all Lagranto core programs are available
292
# -----------------------------------------------------------------------------
293
 
294
echo
295
echo "-----------------------------------------------------------------"
296
echo "Check that all Lagranto core programs are available"
297
echo "-----------------------------------------------------------------"
298
echo
299
 
300
foreach prog ( $core )
301
 
302
  cd ${LAGRANTO}/${prog}
303
  if ( ! -f ${prog} ) then
304
    echo "${prog} is missing... Stop"
305
    exit 1
306
  else
307
    ls -l ${prog}
308
  endif
309
 
310
end
311
 
312
# Exit if only core programs shoudl be installed
313
if ( "${mode}" == "core" ) exit 0
314
 
315
# -----------------------------------------------------------------------------
316
# Compile Lagrango goodies
317
# -----------------------------------------------------------------------------
318
 
319
if ( ("${mode}" == "all" ) | ("${mode}" == "goodies" ) ) then
320
 
321
echo
322
echo "-----------------------------------------------------------------"
323
echo "Installing Lagranto goodies"
324
echo "-----------------------------------------------------------------"
325
 
326
cd ${LAGRANTO}/goodies
327
 
328
foreach tool ( $tools )
329
 
330
echo
331
echo "----- ${tool}"
332
echo
333
\rm -f ${tool}.o
334
\rm -f ${tool}
335
if ( -f ${tool}.make ) then
336
   make -f ${tool}.make
337
else if ( -f ${tool}.install ) then
338
   ./${tool}.install
339
endif
340
 
341
if ( ! -f ${tool} ) then
342
  echo "Problem in compiling ${tool} ... Stop"
343
  exit 1
344
endif
345
 
346
end
347
 
348
endif
349
 
350
if ( "${mode}" == "goodies" ) exit 0
351
 
352
# -----------------------------------------------------------------------------
353
# Check that all Lagranto goodies are available
354
# -----------------------------------------------------------------------------
355
 
356
echo
357
echo "-----------------------------------------------------------------"
358
echo "Check that all Lagranto goodies are available"
359
echo "-----------------------------------------------------------------"
360
echo
361
 
362
cd ${LAGRANTO}/goodies
363
 
364
foreach tool ( $tools )
365
 
366
if ( ! -f ${tool} ) then
367
  echo "${tool} is missing... Stop"
368
  exit 1
369
else
370
  ls -l ${tool}
371
endif
372
 
373
end
374
 
375
endif
376
 
377
# Exit if only goodies should be installed
378
if ( "${mode}" == "goodies" ) exit 0
379
 
380
# -----------------------------------------------------------------------------
381
# Create links to programs
382
# -----------------------------------------------------------------------------
383
 
384
if ( ("${mode}" == "all" ) | ("${mode}" == "links" )  ) then
385
 
386
echo
387
echo "-----------------------------------------------------------------"
388
echo "Create links in ${LAGRANTO}/bin/"
389
echo "-----------------------------------------------------------------"
390
echo
391
 
392
if ( ! -d ${LAGRANTO}/bin ) mkdir ${LAGRANTO}/bin
393
cd ${LAGRANTO}/bin
394
 
395
#ln -svf ${LAGRANTO}/bin/lagranto            lagranto.sh
396
ln -svf ${LAGRANTO}/bin/lagranto            lagranto.ocean
397
#ln -svf ${LAGRANTO}/bin/lagrantohelp        lagrantohelp.sh
398
ln -svf ${LAGRANTO}/bin/lagrantohelp        lagrantohelp.ocean
399
 
400
#ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra.sh
401
#ln -svf ${LAGRANTO}/startf/create_startf.sh create_startf.sh
402
#ln -svf ${LAGRANTO}/select/select.sh        select.sh
403
#ln -svf ${LAGRANTO}/select/select.sh        seltra.sh
404
#ln -svf ${LAGRANTO}/trace/trace.sh          trace.sh
405
#ln -svf ${LAGRANTO}/density/density.sh      density.sh
406
#ln -svf ${LAGRANTO}/startf/create_startf.sh startf.sh
407
#ln -svf ${LAGRANTO}/lidar/lidar.sh          lidar.sh
408
 
409
ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra.ocean
410
ln -svf ${LAGRANTO}/startf/create_startf.sh create_startf.ocean
411
ln -svf ${LAGRANTO}/select/select.sh        select.ocean
412
ln -svf ${LAGRANTO}/select/select.sh        seltra.ocean
413
ln -svf ${LAGRANTO}/trace/trace.sh          trace.ocean
414
ln -svf ${LAGRANTO}/density/density.sh      density.ocean
415
ln -svf ${LAGRANTO}/startf/create_startf.sh startf.ocean
416
ln -svf ${LAGRANTO}/lidar/lidar.sh          lidar.ocean
417
 
418
#ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra
419
#ln -svf ${LAGRANTO}/startf/create_startf.sh create_startf
420
#ln -svf ${LAGRANTO}/select/select.sh        select
421
#ln -svf ${LAGRANTO}/select/select.sh        seltra
422
#ln -svf ${LAGRANTO}/trace/trace.sh          trace
423
#ln -svf ${LAGRANTO}/density/density.sh      density
424
#ln -svf ${LAGRANTO}/startf/create_startf.sh startf
425
#ln -svf ${LAGRANTO}/lidar/lidar.sh          lidar
426
 
427
foreach tool ( $tools )
428
 
429
#ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}.sh
430
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}.ocean
431
#ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}
432
 
433
end
434
 
435
# Set link for create_startf / startf
436
\rm -f ${LAGRANTO}/startf
437
ln -svf ${LAGRANTO}/create_startf ${LAGRANTO}/startf
438
 
439
# Set extra name for <select> to avoid conflict in BASH
440
ln -svf ${LAGRANTO}/select/select.sh        seltra
441
ln -svf ${LAGRANTO}/select/select.sh        seltra.sh
442
ln -svf ${LAGRANTO}/select/select.sh        seltra.ocean
443
 
444
endif
445
 
446
 
447
# -----------------------------------------------------------------------------
448
# Synchronise ( development -> operational )
449
# -----------------------------------------------------------------------------
450
 
451
#if ( ("${mode}" == "all" ) | ("${mode}" == "sync" )  ) then
452
#
453
#echo
454
#echo "-----------------------------------------------------------------"
455
#echo "Sync ( lagranto.ecmwf -> lagranto )"
456
#echo "-----------------------------------------------------------------"
457
#echo
458
#
459
#cd ${path_sync}/bin/
460
#
461
#ln -svf ${path_devel}/bin/lagranto.sh            lagranto.ecmwf
462
#ln -svf ${path_devel}/bin/lagrantohelp.sh        lagrantohelp.ecmwf
463
#
464
#ln -svf ${path_devel}/caltra/caltra.sh           caltra.ecmwf
465
#ln -svf ${path_devel}/startf/create_startf.sh    create_startf.ecmwf
466
#ln -svf ${path_devel}/select/select.sh           select.ecmwf
467
#ln -svf ${path_devel}/trace/trace.sh             trace.ecmwf
468
#ln -svf ${path_devel}/density/density.sh         density.ecmwf
469
#ln -svf ${path_devel}/startf/create_startf.sh    startf.ecmwf
470
#ln -svf ${path_devel}/lidar/lidar.sh             lidar.ecmwf
471
#ln -svf ${path_devel}/lidar/seltra.sh            seltra.ecmwf
472
#
473
#foreach tool ( $tools )
474
#
475
#ln -svf ${path_devel}/goodies/${tool}.sh         ${tool}.ecmwf
476
#
477
#end
478
#
479
## Set all permissions
480
#chmod -R og+rx ${path_sync}/bin/
481
#
482
#endif
483
 
484
# -----------------------------------------------------------------------------
485
# Final tasks
486
# -----------------------------------------------------------------------------
487
 
488
echo
489
echo "-----------------------------------------------------------------"
490
echo "Installation complete"
491
echo "-----------------------------------------------------------------"
492
echo
493
echo "Please set the environmental variable LAGRANTO"
494
echo
495
echo "    setenv LAGRANTO ${LAGRANTO}"
496
echo