Subversion Repositories lagranto.wrf

Rev

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

Rev 2 Rev 7
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] "
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 paths for development 
17
set path_devel = "/home/michaesp/project/lagranto.wrf/"
17
set path_devel = "/home/michaesp/project/lagranto.wrf/"
18
 
18
 
19
# Init Fortran compiler and set netCDF acccordingly
19
# Init Fortran compiler and set netCDF acccordingly
20
setenv FORTRAN pgf90 
20
setenv FORTRAN pgf90 
21
 
21
 
22
# Init netCDF library depending on the Fortran compiler
22
# Init netCDF library depending on the Fortran compiler
23
if ( "${FORTRAN}" == "pgf90" ) then
23
if ( "${FORTRAN}" == "pgf90" ) then
24
  module load pgi/9.0-1
24
  module load pgi/9.0-1
25
  module load netcdf/4.1.1-pgf90
25
  module load netcdf/4.1.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 ${NETCDF}/lib/ 
50
setenv NETCDF_INC ${NETCDF}/include/
50
setenv NETCDF_INC ${NETCDF}/include/
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
# -----------------------------------------------------------------------------
-
 
86
# Make clean 
-
 
87
# -----------------------------------------------------------------------------
-
 
88
 
-
 
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
85
 
113
 
86
# -----------------------------------------------------------------------------
114
# -----------------------------------------------------------------------------
87
# Install libraries 
115
# Install libraries 
88
# -----------------------------------------------------------------------------
116
# -----------------------------------------------------------------------------
89
 
117
 
90
if ( ("${mode}" == "lib") | ("${mode}" == "all" ) ) then
118
if ( ("${mode}" == "lib") | ("${mode}" == "all" ) ) then
91
 
119
 
92
echo "-----------------------------------------------------------------"
120
echo "-----------------------------------------------------------------"
93
echo "Installing libraries"
121
echo "Installing libraries"
94
echo "-----------------------------------------------------------------"
122
echo "-----------------------------------------------------------------"
95
echo
123
echo
96
 
124
 
97
# Change to library directory
125
# Change to library directory
98
cd ${LAGRANTO}/lib
126
cd ${LAGRANTO}/lib
99
 
127
 
100
# Loop over all libraries - compile and make library
128
# Loop over all libraries - compile and make library
101
foreach lib ( $libs )
129
foreach lib ( $libs )
102
 
130
 
103
\rm -f ${lib}.a
131
\rm -f ${lib}.a
104
\rm -f ${lib}.o
132
\rm -f ${lib}.o
105
echo ${FORTRAN} -c -O ${lib}.f
133
echo ${FORTRAN} -c -O ${lib}.f
106
${FORTRAN} -c -O -I ${NETCDF_INC} ${lib}.f
134
${FORTRAN} -c -O -I ${NETCDF_INC} ${lib}.f
107
ar r ${lib}.a ${lib}.o
135
ar r ${lib}.a ${lib}.o
108
\rm -f ${lib}.l ${lib}.o
136
\rm -f ${lib}.l ${lib}.o
109
ranlib ${lib}.a
137
ranlib ${lib}.a
110
if ( ! -f ${lib}.a ) then
138
if ( ! -f ${lib}.a ) then
111
  echo "Problem in compiling ${lib} ... Stop"
139
  echo "Problem in compiling ${lib} ... Stop"
112
  exit 1
140
  exit 1
113
endif
141
endif
114
 
142
 
115
end
143
end
116
 
144
 
117
endif
145
endif
118
 
146
 
119
 
147
 
120
# -----------------------------------------------------------------------------
148
# -----------------------------------------------------------------------------
121
# Check that libraries are ok
149
# Check that libraries are ok
122
# -----------------------------------------------------------------------------
150
# -----------------------------------------------------------------------------
123
 
151
 
124
echo
152
echo
125
echo "-----------------------------------------------------------------"
153
echo "-----------------------------------------------------------------"
126
echo "Check that all libraries are available"
154
echo "Check that all libraries are available"
127
echo "-----------------------------------------------------------------"
155
echo "-----------------------------------------------------------------"
128
echo
156
echo
129
 
157
 
130
# Change to library directory
158
# Change to library directory
131
cd ${LAGRANTO}/lib
159
cd ${LAGRANTO}/lib
132
 
160
 
133
# Check whether all libraries are available
161
# Check whether all libraries are available
134
foreach lib ( $libs )
162
foreach lib ( $libs )
135
 
163
 
136
if ( ! -f ${lib}.a ) then
164
if ( ! -f ${lib}.a ) then
137
  echo "Library ${lib} missing... Stop"
165
  echo "Library ${lib} missing... Stop"
138
  exit 1
166
  exit 1
139
else
167
else
140
  ls -l ${lib}.a    
168
  ls -l ${lib}.a    
141
endif
169
endif
142
 
170
 
143
end
171
end
144
 
172
 
145
# Exit if only libraries shoudl be installed
173
# Exit if only libraries shoudl be installed
146
if ( "${mode}" == "lib" ) exit 0
174
if ( "${mode}" == "lib" ) exit 0
147
 
175
 
148
# -----------------------------------------------------------------------------
176
# -----------------------------------------------------------------------------
149
# Compile Lagrango core programs
177
# Compile Lagrango core programs
150
# -----------------------------------------------------------------------------
178
# -----------------------------------------------------------------------------
151
 
179
 
152
if ( ("${mode}" == "all" ) | ("${mode}" == "core" ) ) then
180
if ( ("${mode}" == "all" ) | ("${mode}" == "core" ) ) then
153
 
181
 
154
echo
182
echo
155
echo "-----------------------------------------------------------------"
183
echo "-----------------------------------------------------------------"
156
echo "Installing Lagranto core programs"
184
echo "Installing Lagranto core programs"
157
echo "-----------------------------------------------------------------"
185
echo "-----------------------------------------------------------------"
158
 
186
 
159
foreach prog ( $core )
187
foreach prog ( $core )
160
 
188
 
161
echo
189
echo
162
echo "----- $prog"
190
echo "----- $prog"
163
echo
191
echo
164
cd ${LAGRANTO}/${prog}
192
cd ${LAGRANTO}/${prog}
165
\rm -f ${prog}.o 
193
\rm -f ${prog}.o 
166
\rm -f ${prog}
194
\rm -f ${prog}
167
if ( "${prog}" == "select" ) \rm special.o
195
if ( "${prog}" == "select" ) \rm special.o
168
\rm -f ${prog}
196
\rm -f ${prog}
169
make -f ${prog}.make
197
make -f ${prog}.make
170
if ( ! -f ${prog} ) then
198
if ( ! -f ${prog} ) then
171
  echo "Problem in compiling ${prog} ... Stop"
199
  echo "Problem in compiling ${prog} ... Stop"
172
  exit 1
200
  exit 1
173
endif
201
endif
174
 
202
 
175
end
203
end
176
 
204
 
177
endif
205
endif
178
 
206
 
179
# -----------------------------------------------------------------------------
207
# -----------------------------------------------------------------------------
180
# Check that all Lagranto core programs are available
208
# Check that all Lagranto core programs are available
181
# -----------------------------------------------------------------------------
209
# -----------------------------------------------------------------------------
182
 
210
 
183
echo
211
echo
184
echo "-----------------------------------------------------------------"
212
echo "-----------------------------------------------------------------"
185
echo "Check that all Lagranto core programs are available"
213
echo "Check that all Lagranto core programs are available"
186
echo "-----------------------------------------------------------------"
214
echo "-----------------------------------------------------------------"
187
echo
215
echo
188
 
216
 
189
foreach prog ( $core )
217
foreach prog ( $core )
190
 
218
 
191
  cd ${LAGRANTO}/${prog}
219
  cd ${LAGRANTO}/${prog}
192
  if ( ! -f ${prog} ) then
220
  if ( ! -f ${prog} ) then
193
    echo "${prog} is missing... Stop"
221
    echo "${prog} is missing... Stop"
194
    exit 1
222
    exit 1
195
  else
223
  else
196
    ls -l ${prog}    
224
    ls -l ${prog}    
197
  endif
225
  endif
198
 
226
 
199
end
227
end
200
 
228
 
201
# Exit if only core programs shoudl be installed
229
# Exit if only core programs shoudl be installed
202
if ( "${mode}" == "core" ) exit 0
230
if ( "${mode}" == "core" ) exit 0
203
 
231
 
204
# -----------------------------------------------------------------------------
232
# -----------------------------------------------------------------------------
205
# Compile Lagrango goodies
233
# Compile Lagrango goodies
206
# -----------------------------------------------------------------------------
234
# -----------------------------------------------------------------------------
207
 
235
 
208
if ( ("${mode}" == "all" ) | ("${mode}" == "goodies" ) ) then
236
if ( ("${mode}" == "all" ) | ("${mode}" == "goodies" ) ) then
209
 
237
 
210
echo
238
echo
211
echo "-----------------------------------------------------------------"
239
echo "-----------------------------------------------------------------"
212
echo "Installing Lagranto goodies"
240
echo "Installing Lagranto goodies"
213
echo "-----------------------------------------------------------------"
241
echo "-----------------------------------------------------------------"
214
 
242
 
215
cd ${LAGRANTO}/goodies
243
cd ${LAGRANTO}/goodies
216
 
244
 
217
foreach tool ( $tools )
245
foreach tool ( $tools )
218
 
246
 
219
echo
247
echo
220
echo "----- ${tool}"
248
echo "----- ${tool}"
221
echo
249
echo
222
\rm -f ${tool}.o
250
\rm -f ${tool}.o
223
\rm -f ${tool}
251
\rm -f ${tool}
224
if ( -f ${tool}.make ) then
252
if ( -f ${tool}.make ) then
225
   make -f ${tool}.make
253
   make -f ${tool}.make
226
else if ( -f ${tool}.install ) then
254
else if ( -f ${tool}.install ) then
227
   ./${tool}.install
255
   ./${tool}.install
228
endif
256
endif
229
 
257
 
230
if ( ! -f ${tool} ) then
258
if ( ! -f ${tool} ) then
231
  echo "Problem in compiling ${tool} ... Stop"
259
  echo "Problem in compiling ${tool} ... Stop"
232
  exit 1
260
  exit 1
233
endif
261
endif
234
 
262
 
235
end
263
end
236
 
264
 
237
endif
265
endif
238
 
266
 
239
# -----------------------------------------------------------------------------
267
# -----------------------------------------------------------------------------
240
# Check that all Lagranto goodies are available
268
# Check that all Lagranto goodies are available
241
# -----------------------------------------------------------------------------
269
# -----------------------------------------------------------------------------
242
 
270
 
243
echo
271
echo
244
echo "-----------------------------------------------------------------"
272
echo "-----------------------------------------------------------------"
245
echo "Check that all Lagranto goodies are available"
273
echo "Check that all Lagranto goodies are available"
246
echo "-----------------------------------------------------------------"
274
echo "-----------------------------------------------------------------"
247
echo
275
echo
248
 
276
 
249
cd ${LAGRANTO}/goodies
277
cd ${LAGRANTO}/goodies
250
 
278
 
251
foreach tool ( $tools )
279
foreach tool ( $tools )
252
 
280
 
253
if ( ! -f ${tool} ) then
281
if ( ! -f ${tool} ) then
254
  echo "${tool} is missing... Stop"
282
  echo "${tool} is missing... Stop"
255
  exit 1
283
  exit 1
256
else
284
else
257
  ls -l ${tool} 
285
  ls -l ${tool} 
258
endif
286
endif
259
 
287
 
260
end
288
end
261
 
289
 
262
endif
290
endif
263
 
291
 
264
# Exit if only goodies should be installed
292
# Exit if only goodies should be installed
265
if ( "${mode}" == "goodies" ) exit 0
293
if ( "${mode}" == "goodies" ) exit 0
266
 
294
 
267
# -----------------------------------------------------------------------------
295
# -----------------------------------------------------------------------------
268
# Create links to programs
296
# Create links to programs
269
# -----------------------------------------------------------------------------
297
# -----------------------------------------------------------------------------
270
 
298
 
271
if ( ("${mode}" == "all" ) | ("${mode}" == "links" )  ) then
299
if ( ("${mode}" == "all" ) | ("${mode}" == "links" )  ) then
272
 
300
 
273
echo
301
echo
274
echo "-----------------------------------------------------------------"
302
echo "-----------------------------------------------------------------"
275
echo "Create links in ${LAGRANTO}/bin/"
303
echo "Create links in ${LAGRANTO}/bin/"
276
echo "-----------------------------------------------------------------"
304
echo "-----------------------------------------------------------------"
277
echo
305
echo
278
 
306
 
279
if ( ! -d ${LAGRANTO}/bin ) mkdir ${LAGRANTO}/bin
307
if ( ! -d ${LAGRANTO}/bin ) mkdir ${LAGRANTO}/bin
280
cd ${LAGRANTO}/bin
308
cd ${LAGRANTO}/bin
281
 
309
 
282
ln -svf ${LAGRANTO}/bin/lagrantohelp        lagrantohelp.sh
310
ln -svf ${LAGRANTO}/bin/lagrantohelp        lagrantohelp.sh
283
 
311
 
284
ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra.sh
312
ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra.sh
285
ln -svf ${LAGRANTO}/select/select.sh        select.sh
313
ln -svf ${LAGRANTO}/select/select.sh        select.sh
286
ln -svf ${LAGRANTO}/trace/trace.sh          trace.sh
314
ln -svf ${LAGRANTO}/trace/trace.sh          trace.sh
287
 
315
 
288
ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra
316
ln -svf ${LAGRANTO}/caltra/caltra.sh        caltra
289
ln -svf ${LAGRANTO}/select/select.sh        select
317
ln -svf ${LAGRANTO}/select/select.sh        select
290
ln -svf ${LAGRANTO}/trace/trace.sh          trace
318
ln -svf ${LAGRANTO}/trace/trace.sh          trace
291
 
319
 
292
foreach tool ( $tools )
320
foreach tool ( $tools )
293
 
321
 
294
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}.sh 
322
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}.sh 
295
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool} 
323
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool} 
296
 
324
 
297
end
325
end
298
 
326
 
299
# Set extra name for <select> to avoid conflict in BASH
327
# Set extra name for <select> to avoid conflict in BASH
300
ln -svf ${LAGRANTO}/select/select.sh        seltra
328
ln -svf ${LAGRANTO}/select/select.sh        seltra
301
ln -svf ${LAGRANTO}/select/select.sh        seltra.sh
329
ln -svf ${LAGRANTO}/select/select.sh        seltra.sh
302
 
330
 
303
endif
331
endif
304
 
332
 
305
# -----------------------------------------------------------------------------
333
# -----------------------------------------------------------------------------
306
# Final tasks
334
# Final tasks
307
# -----------------------------------------------------------------------------
335
# -----------------------------------------------------------------------------
308
 
336
 
309
echo
337
echo
310
echo "-----------------------------------------------------------------"
338
echo "-----------------------------------------------------------------"
311
echo "Installation complete"
339
echo "Installation complete"
312
echo "-----------------------------------------------------------------"
340
echo "-----------------------------------------------------------------"
313
echo
341
echo
314
echo "Please set the environmental variable LAGRANTO"
342
echo "Please set the environmental variable LAGRANTO"
315
echo
343
echo
316
echo "    setenv LAGRANTO ${LAGRANTO}"
344
echo "    setenv LAGRANTO ${LAGRANTO}"
317
echo
345
echo
318
 
346
 
319
 
347
 
320
 
348
 
321
 
349
 
322
 
350