Subversion Repositories lagranto.um

Rev

Rev 3 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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