Subversion Repositories lagranto.ecmwf

Rev

Rev 3 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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