Subversion Repositories lagranto.um

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
# Write usage information
4
if ( ${#argv} == 0) then
5
  echo 
6
  echo "--------------------------------------------------------------"
7
  echo "Usage: extract.sh trainp traout [options]        "
8
  echo 
9
  echo "         trainp           : Input trajectory file"
10
  echo "         traout           : Output trajectory file"
11
  echo
12
  echo "       Options: "
13
  echo 
14
  echo "         -var    list of variables    : trajectory columns"
15
  echo "         -time   list of times        : trajectory times"
16
  echo "         -tra    list of trajectories : single trajectories"
17
  echo "         -startf                      : Starting points"
18
  echo "         -index  filename             : Index file list"
19
  echo "         -boolean  filename           : Boolean file"
20
  echo
21
  echo "       Lists are of the following format: 2, 4 to 7, 9"
22
  echo "---------------------------------------------------------------"
23
  exit 1
24
endif
25
 
26
# Set the input and output filenames
27
set inpfile = $1
28
set outfile = $2
29
shift; shift;
30
 
31
# Handle optional arguments (get a list, remove , and / separators)
32
set mode=$1
33
shift;
34
set str=
35
while ( $#argv > 0 )
36
   set str = "${str} $1"
37
   shift
38
end
39
set str=`echo $str | sed -e "s/,//g"`  
40
set str=`echo $str | sed -e "s/\///g"`  
41
 
42
# Check the mode is valid
43
if ( "${mode}" == "-var"      )  goto next
44
if ( "${mode}" == "-time"     )  goto next
45
if ( "${mode}" == "-tra"      )  goto next
46
if ( "${mode}" == "-startf"   )  goto next
47
if ( "${mode}" == "-index"    )  goto next
48
if ( "${mode}" == "-boolean"  )  goto next
49
 
50
echo " Invalid mode ${mode}..."
51
exit 1
52
 
53
next:
54
 
55
# Set program names
56
set prog1=${LAGRANTO}/goodies/extract
57
set prog2=${LAGRANTO}/goodies/trainfo.sh
58
 
59
# Get trajectory dimensions
60
set dim=`${prog2} ${inpfile} dim` 
61
 
62
# Run program
63
\rm -f extract.param
64
echo \"${inpfile}\"  >! extract.param
65
echo \"${outfile}\"  >> extract.param
66
echo \"${mode}\"     >> extract.param
67
echo ${dim}          >> extract.param
68
echo \"${str}\"      >> extract.param
69
 
70
${prog1}
71
 
72
#\rm -f extract.param
73
 
74
exit 0
75