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