Subversion Repositories lagranto.um

Rev

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