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: timeres.sh trainp traout -[h|min] val -[cubic|linear]        "
10
  echo "Usage: timeres.sh trainp traout -[h|min] val -[cubic|linear]        "
9
  echo 
11
  echo 
10
  echo "         trainp          : Input trajectory file"
12
  echo "         trainp          : Input trajectory file"
11
  echo "         traout          : Output trajectory file"
13
  echo "         traout          : Output trajectory file"
12
  echo
14
  echo
13
  echo "     -[h|min] value  : new time resolution in h or min"
15
  echo "     -[h|min] value  : new time resolution in h or min"
14
  echo "     -[cubic|spline] : interpolation method"
16
  echo "     -[cubic|spline] : interpolation method"
15
  echo "--------------------------------------------------------------"
17
  echo "--------------------------------------------------------------"
16
  exit 0
18
  exit 0
17
endif
19
endif
18
 
20
 
19
# Get input and output trajectory file
21
# Get input and output trajectory file
20
set inpfile = $1
22
set inpfile = $1
21
set outfile = $2
23
set outfile = $2
22
 
24
 
23
# Handle optional arguments
25
# Handle optional arguments
24
 
26
 
25
set mode = "cubic"
27
set mode = "cubic"
26
 
28
 
27
while ( $#argv > 0 )
29
while ( $#argv > 0 )
28
 
30
 
29
  switch ( $argv[1] )
31
  switch ( $argv[1] )
30
 
32
 
31
   case -h
33
   case -h
32
     set unit  = "h"
34
     set unit  = "h"
33
     set value = $argv[2]
35
     set value = $argv[2]
34
     shift;
36
     shift;
35
   breaksw
37
   breaksw
36
 
38
 
37
   case -min
39
   case -min
38
     set unit  = "min"
40
     set unit  = "min"
39
     set value = $argv[2]
41
     set value = $argv[2]
40
     shift;
42
     shift;
41
   breaksw
43
   breaksw
42
 
44
 
43
   case -linear
45
   case -linear
44
     set mode  = "linear"
46
     set mode  = "linear"
45
   breaksw
47
   breaksw
46
 
48
 
47
   case -cubic
49
   case -cubic
48
     set mode  = "cubic"
50
     set mode  = "cubic"
49
   breaksw
51
   breaksw
50
 
52
 
51
  endsw
53
  endsw
52
 
54
 
53
  shift;
55
  shift;
54
 
56
 
55
end
57
end
56
 
58
 
57
# Get the dimensions of the trajectory file
59
# Get the dimensions of the trajectory file
58
set dim=`${LAGRANTO}/goodies/trainfo.sh ${inpfile} dim` 
60
set dim=`${LAGRANTO}/goodies/trainfo.sh ${inpfile} dim` 
59
 
61
 
60
# Prepare parameter file and run program
62
# Prepare parameter file and run program
61
\rm -f timeres.param
63
\rm -f timeres.param
62
echo \"${inpfile}\"  >! timeres.param
64
echo \"${inpfile}\"  >! timeres.param
63
echo \"${outfile}\"  >> timeres.param
65
echo \"${outfile}\"  >> timeres.param
64
echo ${dim}          >> timeres.param
66
echo ${dim}          >> timeres.param
65
echo ${value}        >> timeres.param
67
echo ${value}        >> timeres.param
66
echo \"${unit}\"     >> timeres.param
68
echo \"${unit}\"     >> timeres.param
67
echo \"${mode}\"     >> timeres.param
69
echo \"${mode}\"     >> timeres.param
68
 
70
 
69
${LAGRANTO}/goodies/timeres
71
${LAGRANTO}/goodies/timeres
70
 
72
 
71
# Make clean
73
# Make clean
72
#\rm -f timeres.param
74
#\rm -f timeres.param
73
 
75
 
74
exit 0
76
exit 0
75
 
77