Subversion Repositories lagranto.wrf

Rev

Rev 7 | Rev 13 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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