Subversion Repositories lagranto.um

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
#!/bin/csh
2
 
15 michaesp 3
# Set Lagranto 
4
set LAGRANTO = ${LAGRANTOBASE}.${MODEL}/
3 michaesp 5
 
6
# Write usage information
7
if ( ${#argv} == 0) then
8
  echo 
9
  echo "----------------------------------------------------------------"
10
  echo "Usage: difference.sh trainp1 trainp2 traout field [-single|-max]"
11
  echo 
12
  echo "         trainp1,2       : Input trajectory files"
13
  echo "         traout          : Output trajectory file"
14
  echo "         field           : Field for which difference is taken;"
15
  echo "                           'latlon' if spherical distance required"
16
  echo
17
  echo "         -single         : difference for all times"
18
  echo "         -max            : only time for maximal difference" 
19
  echo "----------------------------------------------------------------"
20
  exit 0
21
endif
22
 
23
# Get input and output trajectory file
24
set inpfile1  = $1
25
set inpfile2  = $2
26
set outfile   = $3
27
set fieldname = $4
28
 
29
# Handle optional arguments
30
 
31
set mode = "single"
32
 
33
while ( $#argv > 0 )
34
 
35
  switch ( $argv[1] )
36
 
37
   case -single
38
     set mode  = "single"
39
   breaksw
40
 
41
   case -max
42
     set mode  = "max"
43
   breaksw
44
 
45
  endsw
46
 
47
  shift;
48
 
49
end
50
 
51
# Get the dimensions of the trajectory files
52
set dim1=`${LAGRANTO}/goodies/trainfo.sh ${inpfile1} dim` 
53
set dim2=`${LAGRANTO}/goodies/trainfo.sh ${inpfile2} dim` 
54
 
55
# Prepare parameter file and run program
56
\rm -f difference.param
57
echo \"${inpfile1}\"  >! difference.param
58
echo \"${inpfile2}\"  >> difference.param
59
echo \"${outfile}\"   >> difference.param
60
echo ${dim1}          >> difference.param
61
echo ${dim2}          >> difference.param
62
echo \"${mode}\"      >> difference.param
63
echo \"${fieldname}\" >> difference.param
64
 
65
${LAGRANTO}/goodies/difference
66
 
67
# Make clean
68
#\rm -f difference.param
69
 
70
exit 0
71