Subversion Repositories lagranto.ecmwf

Rev

Rev 3 | Details | Compare with Previous | 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
  ${LAGRANTO}/bin/lagrantohelp extract short
7
  echo  
8
  exit 0
9
endif
10
 
11
# Set the input and output filenames
12
set inpfile = $1
13
set outfile = $2
14
shift; shift;
15
 
16
# Handle optional arguments (get a list, remove , and / separators)
17
set mode=$1
18
shift;
19
set str=
20
while ( $#argv > 0 )
21
   set str = "${str} $1"
22
   shift
23
end
24
 
25
set str=`echo $str | sed -e "s/,//g"`  
26
set str=`echo $str | sed -e "s/\///g"`  
27
 
5 michaesp 28
# Check that the mode is valid
3 michaesp 29
if ( "${mode}" == "-var"      )  goto next
30
if ( "${mode}" == "-time"     )  goto next
31
if ( "${mode}" == "-tra"      )  goto next
32
if ( "${mode}" == "-startf"   )  goto next
33
if ( "${mode}" == "-index"    )  goto next
34
if ( "${mode}" == "-boolean"  )  goto next
35
if ( "${mode}" == "-pattern"  )  goto next
5 michaesp 36
if ( "${mode}" == "-leaving"  )  goto next
37
if ( "${mode}" == "-staying"  )  goto next
3 michaesp 38
 
39
echo " Invalid mode ${mode}..."
40
exit 1
41
 
42
next:
43
 
44
# Set program names
45
set prog1=${LAGRANTO}/goodies/extract
46
set prog2=${LAGRANTO}/goodies/trainfo.sh
47
 
48
# Get trajectory dimensions
49
set dim=`${prog2} ${inpfile} dim` 
50
 
51
# Run program
52
\rm -f extract.param
53
echo \"${inpfile}\"  >! extract.param
54
echo \"${outfile}\"  >> extract.param
55
echo \"${mode}\"     >> extract.param
56
echo ${dim}          >> extract.param
57
echo \"${str}\"      >> extract.param
58
 
59
${prog1}
60
 
61
#\rm -f extract.param
62
 
63
exit 0
64