Subversion Repositories lagranto.arpege

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
#!/bin/csh
2
 
3
# ---------------------------------------------------------------------
4
# Usage, parameter settings
5
# ---------------------------------------------------------------------
6
 
7
# Write usage information
8
if ( (${#argv} == 0) | (${#argv} < 4) ) then
9
  echo 
10
  /home/binderh/prog/programs/lagranto.mf/bin/lagrantohelp caltra short 
11
  echo  
12
  exit 0
13
endif
14
 
15
# Write title
16
echo 
17
echo '========================================================='
18
echo '       *** START OF PREPROCESSOR CALTRA ***              '
19
echo
20
 
21
 
22
# Get the arguments
23
set startdate = $1
24
set enddate   = $2
25
set startf    = $3
26
set outfile   = $4
27
if ( ${#argv} > 4 ) then
28
   set flags = $5
29
else
30
   set flags=
31
endif 
32
 
33
# Set base directories (run+prog)
34
set cdfdir=${PWD}
35
set tradir=${PWD}
36
 
37
# Set program paths and filenames 
38
set parfile = ${tradir}/caltra.param 
39
 
40
# Set the prefix of the primary and secondary data files
41
set charp = 'P'
42
set chars = 'S'
43
 
44
echo '---- DIRECTORIES AND PROGRAMS ---------------------------'
45
echo    
46
echo "CDF directory         : ${cdfdir}"
47
echo "TRA directory         : ${tradir}"
48
echo "PROGRAM CALTRA        : /home/binderh/prog/programs/lagranto.mf/caltra/caltra"
49
echo "PARAMETER file        : ${parfile}"
50
echo
51
 
52
# ---------------------------------------------------------------------
53
# Set optional flags
54
# ---------------------------------------------------------------------
55
 
56
echo '---- OPTIONAL FLAGS -------------------------------------'
57
echo
58
 
59
# Set some default values ("nil" must be set according to input files)
60
set flag_j     = "nil"
61
set flag_i     = "nil"
62
set flag_t     = "nil"
63
set flag_o     = "nil"
64
set flag_p     = "nil"
65
set changet    = 'false'
66
set noclean    = 'false'
67
set timecheck  = 'no' 
68
set isen       = 'no'
69
set modlev     = 'no'
70
 
71
while ( $#argv > 0 )
72
 
73
  switch ( $argv[1] )
74
 
75
   case -j
76
     set flag_j=1
77
     echo "Flag '-j'     -> ${flag_j} (user defined)"
78
   breaksw
79
 
80
   case -i
81
     set flag_i=$argv[2]
82
     echo "Flag '-i'     -> ${flag_i} (user defined)"
83
     shift;
84
   breaksw
85
 
86
   case -t
87
     set flag_t=$argv[2]
88
     echo "Flag '-t'     -> ${flag_t} (user defined)"
89
     shift;
90
   breaksw
91
 
92
   case -o
93
     set flag_o=$argv[2]
94
     echo "Flag '-o'     -> ${flag_o} (user defined)"
95
     shift;
96
   breaksw
97
 
98
   case -p
99
     set flag_p=1
100
     echo "Flag '-p'     -> ${flag_p} (user defined)"
101
   breaksw
102
 
103
   case -changet
104
     set changet = 'true'
105
     echo "changet       -> true (user defined)"
106
   breaksw
107
 
108
   case -noclean
109
     set noclean = 'true'
110
     echo "noclean       -> true (user defined)"
111
   breaksw
112
 
113
   case -timecheck
114
     set timecheck = 'yes'
115
     echo "timecheck               -> yes (user defined)"
116
   breaksw
117
 
118
   case -isen
119
     set isen = 'yes'
120
     echo "isen                    -> yes (user defined)"
121
   breaksw
122
 
123
   case -2d
124
     set modlev = 'yes'
125
     echo "2d (model level)        -> yes (user defined)"
126
   breaksw
127
 
128
  endsw
129
 
130
  shift;
131
 
132
end
133
 
134
# No change of times necessary if no check requested
135
if ( "${timecheck}" == "no" ) then
136
   set  changet = 'false'
137
endif
138
 
139
# Set some defaults
140
if ( "${flag_j}"     == "nil" ) then
141
    set flag_j     = 0
142
    echo "Flag '-j'     -> 0 (default)"
143
endif
144
if ( "${flag_p}"     == "nil" ) then
145
    set flag_p     = 0
146
    echo "Flag '-p'     -> 0 (default)"
147
endif
148
 
149
# ---------------------------------------------------------------------
150
# Handle the time specifier - startdate, enddate
151
# ---------------------------------------------------------------------
152
 
153
echo
154
echo '---- TIME RANGE -----------------------------------------'
155
echo
156
 
157
# Check format of start and end date - must be the same
158
set ns=`echo $startdate | sed -e 's/_[0-9]*//' | wc -c`
159
set ne=`echo $enddate   | sed -e 's/_[0-9]*//' | wc -c`
160
if ( $ns != $ne ) then
161
  echo " ERROR: start and end date must be in the same format ***"
162
  exit 1
163
endif
164
if ( $ns != 9 ) then
165
  echo " ERROR: Date format must be yyyymmdd ***"
166
  exit 1
167
endif
168
set ns=`echo $startdate | sed -e 's/[0-9]*_//' | wc -c`
169
set ne=`echo $enddate   | sed -e 's/[0-9]*_//' | wc -c`
170
if ( $ns != $ne ) then
171
  echo " ERROR: start and end date must be in the same format ***"
172
  exit 1
173
endif
174
if ( ( $ns != 5 ) & ( $ns != 3 ) ) then
175
  echo " ERROR: Time format must be hh(mm) ***"
176
  exit 1
177
endif
178
 
179
# Split the start and end date into <yymmdd_hh and mm>
180
set startdate_ymdh = `echo $startdate | cut -c 1-11`
181
set startdate_min  = `echo $startdate | cut -c 12-13`
182
if ( $startdate_min == "" ) set startdate_min = 00
183
 
184
set enddate_ymdh = `echo $enddate | cut -c 1-11`
185
set enddate_min  = `echo $enddate | cut -c 12-13`
186
if ( $enddate_min == "" ) set enddate_min = 00
187
 
188
# Get the time difference between <start_ymdh> and <end_ymdh> date
189
# Decide whether trajectoriesare forward or backward
190
set timediff_hh = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${enddate_ymdh} ${startdate_ymdh}`
191
 
192
if ( $timediff_hh == 0 ) then
193
  if ( $enddate_min > $startdate_min ) then
194
    set direction = f
195
    set idir      = 1
196
  else
197
    set direction = b
198
    set idir      = -1
199
  endif
200
else if ( $timediff_hh > 0 ) then
201
  set direction = f
202
  set idir      = 1
203
else
204
  set direction = b
205
  set idir      = -1
206
  @ timediff_hh = $idir * $timediff_hh
207
endif
208
 
209
# Get also minutes for time difference, if <start_min> or <end_min> != 0
210
set timediff_mm=
211
 
212
if ( $startdate_min != 00 || $enddate_min != 00 ) then
213
  @ min = ( $enddate_min - $startdate_min )
214
  if ( $min == 0 ) then
215
    set timediff_mm=
216
  else if ( $min > 0 ) then
217
    if ( $idir == 1 ) then
218
      set timediff_mm=$min
219
    else
220
      @ timediff_hh --
221
      @ timediff_mm = 60 - $min
222
    endif
223
  else
224
    if ( $idir == 1 ) then
225
      @ timediff_hh --
226
      @ timediff_mm = 60 + $min
227
    else
228
      @ timediff_mm = 0 - $min
229
    endif
230
  endif
231
endif
232
 
233
# Set the reference date equal to the satrtdate
234
set refdate=${startdate}
235
 
236
# Write status information
237
echo "Time range      : ${startdate} -> ${enddate}"
238
if ( ${timediff_mm} !=  "" ) then
239
   echo "Time difference : ${timediff_hh} h ${timediff_mm} min"
240
else
241
   echo "Time difference : ${timediff_hh} h"
242
endif
243
echo "Direction       : ${direction} (${idir})"
244
echo "Reference date  : ${refdate}"
245
 
246
# ---------------------------------------------------------------------
247
# Check availability of input data 
248
# ---------------------------------------------------------------------
249
 
250
echo
251
echo '---- INPUT FILES ----------------------------------------'
252
echo
253
 
254
# Take the time increment from flag list ('nil', if not defined)
255
set timeinc = ${flag_i}
256
 
257
# Find a first data file (if possible corresponding to start/end date
258
# If starttime is not a data time, take the first file in the direectory
259
if ( $direction == "f" ) then
260
  set file=${charp}${startdate_ymdh}
261
else
262
  set file=${charp}${enddate_ymdh}
263
endif
264
if ( ! -f $file ) then
265
  set file=`ls ${charp}[0-9_]*[0-9] | head -1 | sed -e 's/@//'`
266
  ls $file
267
endif
268
 
269
# Determine timeinc (the time difference in hours between two data file)
270
# if not already defined with option -i
271
if ( ${timeinc} == "nil" ) then
272
  set date1=`echo $file | cut -c 2-12`
273
  set n=`ls ${charp}[0-9_]*[0-9] | grep -n $date1 | awk -F: '{print $1}'`
274
  @ n ++
275
  set date2=`ls ${charp}[0-9_]*[0-9] | head -$n | tail -1 | cut -c 2-12`
276
  set timeinc=`/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff $date2 $date1`
277
endif
278
if ( $timeinc == 0 ) then
279
    echo " ERROR: cannot set the time increment between input files ***"
280
    exit 1
281
endif
282
 
283
# Search the first file to use: We step through all P files and see whether they are
284
# good P files. Let's first do the test for the first data file found. If it's ok, we 
285
# take it; if not, we step through all P files and find the good one  
286
set flag=0
287
set td=
288
 
289
set date = `echo $file | cut -c 2-12`
290
set td1  = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${startdate_ymdh} ${date}`
291
set td2  = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${enddate_ymdh}   ${date}`
292
 
293
if (( $td1 < $timeinc || $td2 < $timeinc ) && ( $td1 >= 0 || $td2 >= 0 )) then
294
   set datfiles=$date
295
   if ( $td1 < $timeinc    ) set td=$td1
296
   if ( $td2 < $timeinc    ) set td=$td2
297
   if ( ( $startdate_min > 0 ) || ( $enddate_min > 0 ) ) @ td ++
298
   goto label2      
299
endif
300
 
301
foreach i ( ${charp}????????_?? )
302
 
303
  set date = `echo $i | cut -c 2-12`
304
  set td1  = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${startdate_ymdh} ${date}`
305
  set td2  = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${enddate_ymdh}   ${date}`
306
  if (( $td1 < $timeinc || $td2 < $timeinc ) && ( $td1 >= 0 || $td2 >= 0 )) then
307
     set datfiles=$date
308
     if ( $td1 < $timeinc    ) set td=$td1
309
     if ( $td2 < $timeinc    ) set td=$td2
310
     if ( ( $startdate_min > 0 ) || ( $enddate_min > 0 ) ) @ td ++
311
     goto label2      
312
  endif
313
 
314
end
315
 
316
# if no P/T-files are available for the specified time period, then $td is
317
# still undefined
318
if ( $td == "" ) then
319
  echo " ERROR: no data files available for the specified time period"
320
  exit 1
321
endif
322
 
323
# Everything is fine so far: proceed
324
label2:
325
 
326
# Check whether first date is ok - before or at needed dates
327
if ( $direction == "f" ) then
328
  set tdiff0 = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${startdate_ymdh} ${date}`
329
else
330
  set tdiff0 = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff ${enddate_ymdh} ${date}`
331
endif
332
  if ( $tdiff0 < 0 ) then
333
  echo " ERROR: data files missing for the specified time period"
334
  exit 1
335
endif
336
 
337
# Calculate the number of further files
338
@ num = ( $timediff_hh + $td ) / $timeinc + 1
339
@ dum1 = ( $num - 1 ) * $timeinc
340
@ dum2 = $timediff_hh + $td
341
if ( $dum1 != $dum2 ) @ num ++
342
 
343
# Get a list of all needed files
344
set numfiles=$num
345
set sfiles=1
346
echo $datfiles
347
while ( $num > 1 )
348
  set date=`/home/binderh/prog/programs/lagranto.mf/goodies/newtime $date $timeinc`
349
 
350
  echo $date
351
 
352
  if ( ! -f ${charp}${date} ) then
353
    echo " ERROR: file with primary data is missing for $date"
354
    exit 1
355
  else if ( ! -f ${chars}${date} ) then
356
    set sfiles=0
357
    set datfiles=`echo $datfiles $date`
358
  else
359
    set datfiles=`echo $datfiles $date`
360
  endif
361
  @ num --
362
end
363
 
364
# Special handling for isentropic trajectories - check whether TH can be read from S files
365
set thonS = 1
366
if ( "${isen}" == "yes" ) then  
367
   foreach date ( ${datfiles} )
368
      if ( -f ${chars}${date} ) then
369
         set ok = `/home/binderh/prog/programs/lagranto.mf/goodies/getvars ${chars}${date} | grep TH` 
370
         if ( "${ok}" == "" ) set thonS = 0
371
      else
372
         set thonS = 0
373
      endif
374
   end
375
endif
376
 
377
# Special handling for 2d trajectories - check whether P,PS are available
378
if ( "${modlev}" == "yes" ) then  
379
   set flonp = 1
380
   foreach date ( ${datfiles} )
381
       set ok = `/home/binderh/prog/programs/lagranto.mf/goodies/getvars ${charp}${date} | grep P` 
382
       if ( "${ok}" == "" ) set flonp = 0
383
       set ok = `/home/binderh/prog/programs/lagranto.mf/goodies/getvars ${charp}${date} | grep PS` 
384
       if ( "${ok}" == "" ) set flonp = 0
385
   end
386
   if ( ${flonp} == 0 ) then
387
      echo ' ERROR: P and PS must be available on P files for 2D mode'
388
      exit 1
389
   endif
390
endif
391
 
392
# Write some status information
393
echo "Primary file prefix            : ${charp}"
394
echo "Secondary file prefix          : ${chars}"
395
echo "Time increment for input files : ${timeinc}"
396
echo "# input files                  : ${numfiles}"
397
echo "${charp} files availability           : 1"  
398
echo "${chars} files availability           : ${sfiles}"     
399
echo "First input file               : $datfiles[1] " 
400
echo "Last input file                : $datfiles[$numfiles] " 
401
if ( "${isen}" == "yes" ) then
402
    echo "TH available on S              : ${thonS} "
403
endif 
404
 
405
# ---------------------------------------------------------------------
406
# Handle vertical wind - scaling factor
407
# ---------------------------------------------------------------------
408
 
409
# No vertical wind scaling is needed for isentropic and 2d trajectories
410
set wfactor = 1
411
if ( "${isen}"   == "yes" ) goto next1
412
if ( "${modlev}" == "yes" ) goto next1
413
 
414
echo
415
echo '---- VERTICAL WIND SCALING ------------------------------'
416
echo
417
 
418
# Check whether OMEGA is avialbale on first file
419
set first=$datfiles[1]
420
set file="${charp}${first}"
421
set omflag=`/home/binderh/prog/programs/lagranto.mf/goodies/getvars $file | grep " OMEGA " | wc -l`
422
if ( $omflag != 1 ) then
423
   echo " ERROR: variable OMEGA is not on file $file"
424
   exit 1
425
endif
426
 
427
# Get the maximum and minimum wind on 850 hPa and decide the <wfactor>
428
#ls $file
429
# HB: getmima slightly adapted such that output is written into file fort.10 rather than just printed on screen
430
rm -rf fort.10
431
/home/binderh/prog/programs/lagranto.mf/goodies/getmima $file OMEGA P850
432
set wmin  = `awk '{print $1}' ${PWD}/fort.10`
433
set wmax  = `awk '{print $2}' ${PWD}/fort.10`
434
rm -rf fort.10
435
#set wmin  = `/home/binderh/prog/programs/lagranto.mf/goodies/getmima $file OMEGA P850 | awk '{print $1}'`
436
#set wmax  = `/home/binderh/prog/programs/lagranto.mf/goodies/getmima $file OMEGA P850 | awk '{print $2}'`
437
# end HB
438
 
439
set wmin  = `echo $wmin | sed -e 's/\.//'`
440
set wmax  = `echo $wmax | sed -e 's/\.//'`
441
set wdiff = `echo $wmax - $wmin | bc`
442
 
443
if ( $wdiff > 400 ) then
444
    set wfactor=1.
445
endif
446
if ( $wdiff < 400 ) then
447
    set wfactor=100.
448
endif
449
 
450
# HB
451
#set wfactor=1.
452
echo "wmin" $wmin
453
echo "wmax" $wmax
454
echo "wdiff" $wdiff
455
 
456
# Write status information
457
echo "Vertical scaling factor (wfactor)  : ${wfactor}"
458
 
459
next1:
460
 
461
# ---------------------------------------------------------------------
462
# Time step and output interval
463
# ---------------------------------------------------------------------
464
 
465
echo
466
echo '---- TIME STEPS -----------------------------------------'
467
echo
468
 
469
# Take the time step and output step from flag list ('nil', if not defined)
470
set timestep = ${flag_t}
471
set deltout  = ${flag_o}
472
 
473
# Calculate the time step
474
if ( $timestep == "nil" ) @ timestep = ( 60 * $timeinc ) / 12
475
 
476
# Take the output interval from time increment
477
if ( $deltout == "nil" ) @ deltout = 60 * ${timeinc}
478
 
479
# Check whether the timestep is an integer ratio of deltout
480
@ flag = $deltout / $timestep
481
@ flag = $deltout - ( $flag * $timestep )
482
if ( $flag != 0 ) then
483
  echo " ERROR: output time interval should be multiple of timestep"
484
  echo 
485
  echo "           $deltout min  : output time interval"
486
  echo "           $timestep min  : time step"
487
  exit 1
488
endif
489
 
490
# Calculate the start and the end time relative to the first datfile
491
if ( $direction == f ) then
492
  set tstart = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff $startdate $datfiles[1]`
493
  set tend   = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff $datfiles[$numfiles] $enddate`
494
else
495
  set tstart = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff $datfiles[$numfiles] $startdate`
496
  set tend   = `/home/binderh/prog/programs/lagranto.mf/goodies/gettidiff $enddate $datfiles[1]`
497
endif
498
 
499
# Check whether tstart and tend are a multiple of the output time interval
500
if ( $tstart != 0 ) then
501
  if ( `echo $tstart | grep "\."` != "" ) then
502
    set dum=`echo $tstart | sed -e 's/[-0-9]*\.//'`
503
    @ flag = $dum / $deltout
504
    @ flag = $dum - ( $flag * $deltout )
505
    if ( $flag != 0 ) then
506
      echo " ERROR : the start time should be shifted relative to the first"
507
      echo "         datafile by a multiple of the output time interval"
508
      echo "         hint:  set the latter with the option -o"
509
      exit 1
510
    endif
511
  endif
512
endif
513
if ( `echo $tend | grep "\."` != "" ) then
514
  set dum=`echo $tend | sed -e 's/[-0-9]*\.//'`
515
  @ flag = $dum / $deltout
516
  @ flag = $dum - ( $flag * $deltout )
517
  if ( $flag != 0 ) then
518
    echo " ERROR : the end time should be shifted relative to the first"
519
    echo "         datafile by a multiple of the output time interval"
520
    echo "         hint:  set the latter with the option -o"
521
    exit 1
522
  endif
523
endif
524
 
525
# Write status information
526
echo "Trajectory calculation time step [min] : ${timestep}"
527
echo "Output time step [min]                 : ${deltout}"
528
if ( $direction == f ) then
529
  echo "Start time relative to first file      : $datfiles[1] + ${tstart} "
530
  echo "End time relative to first file        : $datfiles[$numfiles] - ${tend} "  
531
else
532
  echo "Start time relative to first file      : $datfiles[$numfiles] - ${tstart} "
533
  echo "End time relative to last file         : $datfiles[1] + ${tend} "
534
endif
535
 
536
# ---------------------------------------------------------------------
537
# Start file
538
# ---------------------------------------------------------------------
539
 
540
echo
541
echo '---- START FILE -----------------------------------------'
542
echo
543
 
544
# Check if start file is available
545
if ( ! -f ${startf} ) then
546
   echo " ERROR : start file ${startf} is missing"
547
   exit 1
548
endif
549
 
550
# Decide whether startfile has an explicit format specifier
551
set format = "0"
552
foreach app ( 1 2 3 4 5 6 7 8 9 )
553
  set flag = `echo ${startf} | grep "\.${app}"`
554
  if ( "${flag}" != "" ) set format = "${app}"
555
end
556
 
557
# If format is 0, it might nevertheless be a hidden format 1
558
if ( "${format}" == "0" ) then
559
    set ncol = `awk "{print NF}" ${startf} | tail -1` 
560
    if ( "${ncol}" != "3" ) then
561
        set format = "1"
562
        echo " WARNING: ${startf} is a hidden trajectory file of format 1"
563
        echo "          it will be renamed: ${startf} -> ${startf}.1"
564
        echo
565
        ln -sf ${startf} ${startf}.1
566
        set startf = "${startf}.1"
567
    endif
568
endif
569
 
570
# Get the number of trajectories
571
if ( "${format}" == "0" ) then
572
   set ntra = `wc -l ${startf} | awk '{print $1}' `
573
   set ncol = 3
574
else
575
   set ntra = `/home/binderh/prog/programs/lagranto.mf/goodies/trainfo.sh ${startf} ntra`
576
   set ncol = `/home/binderh/prog/programs/lagranto.mf/goodies/trainfo.sh ${startf} ncol`
577
   set ntim = `/home/binderh/prog/programs/lagranto.mf/goodies/trainfo.sh ${startf} ntim`
578
 
579
   if ( "${ntim}" != "1" ) then
580
      echo " ERROR: starting trajectory file must only have one time... Stop (${ntim})"
581
      exit 1
582
   endif
583
 
584
endif
585
 
586
# Write status information
587
echo "Start file                  : ${startf} "
588
if ( "${format}" == "0" ) then 
589
   echo "Format                      : (lon,lat,p) list"
590
else
591
   echo "Format                      : trajectory file (${format})"
592
endif
593
echo "# coordinates (lon,lat,lev) : ${ntra} "  
594
echo "# columns                   : ${ncol} "  
595
 
596
# ---------------------------------------------------------------------
597
# Prepare input file for caltra and run it
598
# ---------------------------------------------------------------------
599
 
600
# Set times relative to the reference date
601
if ( "${changet}" == "true" ) then
602
 echo
603
 echo '---- CHANGE TIMES ON DATA FILES  ------------------------'
604
 echo   
605
 foreach i ( $datfiles )
606
   /home/binderh/prog/programs/lagranto.mf/goodies/changet.sh ${refdate} ${charp}${i}
607
 end
608
 if ( ${sfiles} == 1 ) then
609
   foreach i ( $datfiles )
610
     /home/binderh/prog/programs/lagranto.mf/goodies/changet.sh ${refdate} ${chars}${i}
611
   end
612
 endif
613
endif
614
 
615
# Split the reference date
616
set yyyy=`echo ${refdate}   | cut -c 1-4` 
617
set   mm=`echo ${refdate}   | cut -c 5-6` 
618
set   dd=`echo ${refdate}   | cut -c 7-8` 
619
set   hh=`echo ${refdate}   | cut -c 10-11` 
620
set  min=`echo ${refdate}00 | cut -c 12-13` 
621
 
622
# Get the total tiem range
623
if ( ${timediff_mm} != '' ) then
624
   @ timerange = 60 * ${timediff_hh} + ${timediff_mm}
625
else
626
   @ timerange = 60 * ${timediff_hh}
627
endif
628
 
629
# Write parameter file
630
\rm -f ${parfile}
631
touch ${parfile}
632
 
633
\echo $idir                   >> $parfile
634
echo $numfiles                >> $parfile
635
foreach i ( $datfiles )
636
  echo $i                     >> $parfile
637
end
638
echo $timeinc                 >> $parfile
639
echo $flag_p                  >> $parfile
640
echo \"${startf}\"            >> $parfile
641
echo ${ntra}                  >> $parfile
642
echo ${ncol}                  >> $parfile
643
echo \"${outfile}\"           >> $parfile
644
echo $timestep                >> $parfile
645
echo $tstart                  >> $parfile
646
echo $tend                    >> $parfile
647
echo $deltout                 >> $parfile
648
echo $flag_j                  >> $parfile
649
echo $wfactor                 >> $parfile
650
echo $yyyy                    >> $parfile
651
echo $mm                      >> $parfile
652
echo $dd                      >> $parfile
653
echo $hh                      >> $parfile
654
echo $min                     >> $parfile
655
echo $timerange               >> $parfile
656
echo \"${timecheck}\"         >> $parfile
657
echo \"${isen}\" ${thonS}     >> $parfile
658
echo \"${modlev}\"            >> $parfile
659
 
660
# Finish the preprocessor
661
echo 
662
echo '       *** END OF PREPROCESSOR CALTRA ***              '
663
echo '========================================================='
664
echo
665
 
666
# Run caltra
667
/home/binderh/prog/programs/lagranto.mf/caltra/caltra
668
 
669
if ( "${status}" != "0" ) then
670
  echo "ERROR:  Program <caltra> failed"
671
  exit 1
672
endif
673
 
674
# ----------------------------------------------------------
675
# Final tasks (make clean)
676
# ----------------------------------------------------------
677
 
678
finish:
679
 
680
if ( "${noclean}" == "false" ) then
681
  \rm -f ${parfile}
682
 endif
683
 
684
exit 0 
685