Subversion Repositories lagranto.icon

Rev

Go to most recent revision | 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
# Set Lagranto 
8
set LAGRANTO = ${LAGRANTOBASE}.${MODEL}/
9
 
10
# Write usage information
11
if ( (${#argv} == 0) | (${#argv} < 4) ) then
12
  echo 
13
  ${LAGRANTO}/bin/lagrantohelp caltra short 
14
  echo  
15
  exit 0
16
endif
17
 
18
# Write title
19
echo 
20
echo '========================================================='
21
echo '       *** START OF PREPROCESSOR CALTRA ***              '
22
echo
23
 
24
# Get the arguments
25
set startdate = $1
26
set enddate   = $2
27
set startf    = $3
28
set outfile   = $4
29
if ( ${#argv} > 4 ) then
30
   set flags = $5
31
else
32
   set flags=
33
endif 
34
 
35
# Set base directories (run+prog)
36
set cdfdir=${PWD}
37
set tradir=${PWD}
38
 
39
# Set program paths and filenames 
40
set parfile = ${tradir}/caltra.param 
41
 
42
# Set the prefix of the primary and secondary data files
43
set charp = 'P'
44
set chars = 'S'
45
 
46
echo '---- DIRECTORIES AND PROGRAMS ---------------------------'
47
echo    
48
echo "CDF directory         : ${cdfdir}"
49
echo "TRA directory         : ${tradir}"
50
echo "PROGRAM CALTRA        : ${LAGRANTO}/caltra/caltra"
51
echo "PARAMETER file        : ${parfile}"
52
echo
53
 
54
# ---------------------------------------------------------------------
55
# Set optional flags
56
# ---------------------------------------------------------------------
57
 
58
echo '---- OPTIONAL FLAGS -------------------------------------'
59
echo
60
 
61
# Set some default values ("nil" must be set according to input files)
62
set flag_j     = "nil"
63
set flag_i     = "nil"
64
set flag_t     = "nil"
65
set flag_o     = "nil"
66
set flag_p     = "nil"
67
set changet    = 'false'
68
set noclean    = 'false'
69
set timecheck  = 'no' 
70
set flag_f     = "nil"
71
set balloon    = 0
72
 
73
while ( $#argv > 0 )
74
 
75
  switch ( $argv[1] )
76
 
77
   case -j
78
     set flag_j=1
79
     echo "Flag '-j'     -> ${flag_j} (user defined)"
80
   breaksw
81
 
82
   case -i
83
     set flag_i=$argv[2]
84
     echo "Flag '-i'     -> ${flag_i} (user defined)"
85
     shift;
86
   breaksw
87
 
88
   case -t
89
     set flag_t=$argv[2]
90
     echo "Flag '-t'     -> ${flag_t} (user defined)"
91
     shift;
92
   breaksw
93
 
94
   case -o
95
     set flag_o=$argv[2]
96
     echo "Flag '-o'     -> ${flag_o} (user defined)"
97
     shift;
98
   breaksw
99
 
100
   case -p
101
     set flag_p=1
102
     echo "Flag '-p'     -> ${flag_p} (user defined)"
103
   breaksw
104
 
105
   case -changet
106
     set changet = 'true'
107
     echo "changet       -> true (user defined)"
108
   breaksw
109
 
110
   case -noclean
111
     set noclean = 'true'
112
     echo "noclean       -> true (user defined)"
113
   breaksw
114
 
115
   case -timecheck
116
     set timecheck = 'yes'
117
     echo "timecheck               -> yes (user defined)"
118
   breaksw
119
 
120
   case -fplane
121
     set flag_f=1
122
     echo "Flag '-fplane'     -> ${flag_f} (user defined)" 
123
     set lat_fixed=$argv[2]
124
     echo "Lat_fixed          -> ${lat_fixed} (user defined)" 
125
   breaksw
126
 
127
   case -balloon
128
     set balloon=$argv[2]
129
     echo "Flag '-balloon'     -> ${balloon} (user defined)" 
130
     shift
131
   breaksw
132
 
133
  endsw
134
 
135
  shift;
136
 
137
end
138
 
139
# No change of times necessary if no check requested
140
if ( "${timecheck}" == "no" ) then
141
   set  changet = 'false'
142
endif
143
 
144
# Set some defaults
145
if ( "${flag_j}"     == "nil" ) then
146
    set flag_j     = 0
147
    echo "Flag '-j'     -> 0 (default)"
148
endif
149
if ( "${flag_p}"     == "nil" ) then
150
    set flag_p     = 0
151
    echo "Flag '-p'     -> 0 (default)"
152
endif
153
if ( "${flag_f}"     == "nil" ) then
154
    set flag_f     = 0
155
    echo "Flag '-fplane'-> 0 (default)"
156
    set lat_fixed = -999.99
157
    echo "lat_fixed     -> 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
221
set timediff_mm=00
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
269
# If starttime is not a data time, take the first file in the directory
270
if ( $direction == "f" ) then
271
  set file=${charp}${startdate_ymdh}
272
else 
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
282
  set date1=`echo $file | cut -c 2-`
283
  set n=`\ls ${charp}[0-9_]*[0-9] | grep -n $date1 | awk -F: '{print $1}'`
284
  @ n ++
285
  set date2=`\ls ${charp}[0-9_]*[0-9] | head -$n | tail -1 | cut -c 2-`
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
 
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
if ( "${flag}" != "" ) then
298
  echo "Input files availability < 1 hour ($timeinc): switch to hires"
299
  echo "mode. All input files must be of form: P{yyyymmdd_hhmm}"
300
  set hires = 1
301
  set timeinc_min = `echo "(${timeinc} * 100 + 0.5)/1" | bc`
302
  set timeinc     = `echo "scale=2; ${timeinc} * 100 / 60" | bc`
303
  goto hires
304
endif
305
 
306
# Search the first file to use: We step through all P files and see whether they are
307
# good P files. Let's first do the test for the first data file found. If it's ok, we 
308
# take it; if not, we step through all P files and find the good one
309
set flag=0
310
set td=
311
 
312
set date = `echo ${file} | cut -c 2-12`
313
set td1  = `${LAGRANTO}/goodies/gettidiff ${startdate_ymdh} ${date}`
314
set td2  = `${LAGRANTO}/goodies/gettidiff ${enddate_ymdh}   ${date}`
315
 
316
if (( $td1 < $timeinc || $td2 < $timeinc ) && ( $td1 >= 0 || $td2 >= 0 )) then
317
   set datfiles=$date
318
   if ( $td1 < $timeinc    ) set td=$td1
319
   if ( $td2 < $timeinc    ) set td=$td2
320
   if ( ( $startdate_min > 0 ) || ( $enddate_min > 0 ) ) @ td ++
321
   goto label2      
322
endif
323
 
324
foreach i ( ${charp}????????_?? )
325
 
326
  set date = `echo $i | cut -c 2-12`
327
  set td1  = `${LAGRANTO}/goodies/gettidiff ${startdate_ymdh} ${date}`
328
  set td2  = `${LAGRANTO}/goodies/gettidiff ${enddate_ymdh}   ${date}`
329
  if (( $td1 < $timeinc || $td2 < $timeinc ) && ( $td1 >= 0 || $td2 >= 0 )) then
330
      set datfiles=$date
331
      if ( $td1 < $timeinc    ) set td=$td1
332
      if ( $td2 < $timeinc    ) set td=$td2
333
      if ( ( $startdate_min > 0 ) || ( $enddate_min > 0 ) ) @ td ++
334
      goto label2
335
  endif
336
 
337
end
338
 
339
if ( $td == "" ) then
340
  echo
341
  echo " ERROR: no data files available for the specified time period"
342
  exit 1
343
endif
344
 
345
# If the input files come with time increment < 1 hour, handle it in this
346
# special section. The aim is not to 'interfere' with the well established
347
# code handling the standard case with time increment >= 1 hour. In this mode
348
# we require that the start and end date are available as P files: no start is
349
# allowed between the model output files
350
hires:
351
 
352
set flag=0
353
set td=0
354
 
355
if ( $direction == "f" ) then
356
  set file=${charp}${startdate}
357
else 
358
  set file=${charp}${enddate}
359
endif
360
 
361
if ( -f $file ) then
362
  set date     = `echo ${file} | cut -c 2-14`
363
  set datfiles = $date
364
  set td       = 0
365
  goto label2
366
else
367
  echo
368
  echo " ERROR: no data files available for the specified time period"
369
  exit 1
370
endif
371
 
372
# Everything is fine so far (first data file found): proceed
373
label2:
374
 
375
# Calculate the number of further files; handle hires (timeinc<1 h) and
376
# standard mode (timeinc >= 1 h) separately
377
if ( ${hires} == 0 ) then
378
 @ num = ( $timediff_hh + $td ) / $timeinc + 1
379
 @ dum1 = ( $num - 1 ) * $timeinc
380
 @ dum2 = $timediff_hh + $td
381
 if ( $dum1 != $dum2 ) @ num ++
382
else
383
 set num = `echo "( ${timediff_hh}*60 + ${timediff_mm} ) / ( ${timeinc_min} ) + 1" | bc`
384
endif 
385
 
386
# Get a list of all needed files
387
set numfiles=$num
388
set sfiles=1
389
echo $datfiles
390
while ( $num > 1 )
391
  if ( $hires == 0 ) then
392
     set date=`${LAGRANTO}/goodies/newtime $date $timeinc`
393
  else
394
     set date=`${LAGRANTO}/goodies/newtime $date $timeinc_min`
395
  endif
396
  if ( ! -f ${charp}${date} ) then
397
    echo " ERROR: file with primary data is missing for $date"
398
    exit 1
399
  else if ( ! -f ${chars}${date} ) then
400
    set sfiles=0
401
    set datfiles=`echo $datfiles $date`
402
  else
403
    set datfiles=`echo $datfiles $date`
404
  endif
405
  @ num --
406
end
407
 
408
# Write some status information
409
echo "Primary file prefix            : ${charp}"
410
echo "Secondary file prefix          : ${chars}"
411
if ( ${hires} == 0 ) then
412
  echo "Time increment for input files : ${timeinc} h"
413
else
414
  echo "Time increment for input files : ${timeinc_min} min (0$timeinc h) "
415
endif
416
echo "# input files                  : ${numfiles}"
417
echo "${charp} files availability           : 1"  
418
echo "${chars} files availability           : ${sfiles}"     
419
echo "First input file               : $datfiles[1] " 
420
echo "Last input file                : $datfiles[$numfiles] " 
421
 
422
echo
423
echo $datfiles
424
 
425
# ---------------------------------------------------------------------
426
# Handle vertical wind - scaling factor
427
# ---------------------------------------------------------------------
428
 
429
echo
430
echo '---- VERTICAL WIND SCALING ------------------------------'
431
echo
432
 
433
# Check whether W is avialbale on first file
434
set first=$datfiles[1]
435
set file="${charp}${first}"
436
set omflag = 0
437
foreach var ( `${LAGRANTO}/goodies/getvars $file` )
438
   if ( "${var}" == "W" ) set omflag = 1
439
end
440
if ( $omflag != 1 ) then
441
   echo " ERROR: variable W is not on file $file"
442
   exit 1
443
endif
444
 
445
# Set the scale factor for vertical wind
446
set wfactor=1.
447
 
448
# Write status information
449
echo "Vertical scaling factor (wfactor)  : ${wfactor}"
450
 
451
# ---------------------------------------------------------------------
452
# Time step and output interval
453
# ---------------------------------------------------------------------
454
 
455
echo
456
echo '---- TIME STEPS -----------------------------------------'
457
echo
458
 
459
# Take the time step and output step from flag list ('nil', if not defined)
460
set timestep = ${flag_t}
461
set deltout  = ${flag_o}
462
 
463
# Calculate the time step
464
if ( $hires == 0 ) then
465
  if ( $timestep == "nil" ) @ timestep = ( 60 * $timeinc ) / 12
466
else
467
  if ( $timestep == "nil" ) set timestep =  `echo "scale=2; $timeinc_min / 12" | bc`
468
endif
469
 
470
# Take the output interval from time increment
471
if ( $hires == 0 ) then
472
  if ( $deltout == "nil" ) @ deltout = 60 * ${timeinc}
473
else
474
  if ( $deltout == "nil" ) set deltout = ${timeinc_min}
475
endif
476
 
477
# Check whether the timestep is an integer ratio of deltout
478
#@ flag = $deltout / $timestep
479
#@ flag = $deltout - ( $flag * $timestep )
480
set flag = `echo "scale=2; $deltout / $timestep" | bc`
481
set flag = `echo "scale=2; $deltout - ( $flag * $timestep )" | bc`   
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 = `${LAGRANTO}/goodies/gettidiff $startdate $datfiles[1]`
493
  set tend   = `${LAGRANTO}/goodies/gettidiff $datfiles[$numfiles] $enddate`
494
else
495
  set tstart = `${LAGRANTO}/goodies/gettidiff $datfiles[$numfiles] $startdate`
496
  set tend   = `${LAGRANTO}/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} | head -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 = `${LAGRANTO}/goodies/trainfo.sh ${startf} ntra`
576
   set ncol = `${LAGRANTO}/goodies/trainfo.sh ${startf} ncol`
577
   set ntim = `${LAGRANTO}/goodies/trainfo.sh ${startf} ntim`
578
 
579
   if ( "${ntim}" != "1" ) then
580
      echo " ERROR: starting trajectory file must only have one time... Stop"
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
   ${LAGRANTO}/goodies/changet.sh ${refdate} ${charp}${i}
607
 end
608
 if ( ${sfiles} == 1 ) then
609
   foreach i ( $datfiles )
610
     ${LAGRANTO}/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 time 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 ${flag_f}                >> $parfile
658
echo ${lat_fixed}             >> $parfile
659
echo ${balloon}               >> $parfile
660
 
661
# Finish the preprocessor
662
echo 
663
echo '       *** END OF PREPROCESSOR CALTRA ***              '
664
echo '========================================================='
665
echo
666
 
667
# Run caltra
668
${LAGRANTO}/caltra/caltra
669
 
670
if ( "${status}" != "0" ) then
671
  echo "ERROR:  Program <caltra> failed"
672
  exit 1
673
endif
674
 
675
# ----------------------------------------------------------
676
# Final tasks (make clean)
677
# ----------------------------------------------------------
678
 
679
finish:
680
 
681
if ( "${noclean}" == "false" ) then
682
  \rm -f ${parfile}
683
 endif
684
 
685
exit 0 
686