Subversion Repositories lagranto.um

Rev

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