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