Subversion Repositories lagranto.wrf

Rev

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

Rev 2 Rev 10
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 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
 
36
 
37
echo " Invalid mode ${mode}..."
37
echo " Invalid mode ${mode}..."
38
exit 1
38
exit 1
39
 
39
 
40
next:
40
next:
41
 
41
 
42
# Set program names
42
# Set program names
43
set prog1=${LAGRANTO}/goodies/extract
43
set prog1=${LAGRANTO}/goodies/extract
44
set prog2=${LAGRANTO}/goodies/trainfo.sh
44
set prog2=${LAGRANTO}/goodies/trainfo.sh
45
 
45
 
46
# Get trajectory dimensions
46
# Get trajectory dimensions
47
set dim=`${prog2} ${inpfile} dim` 
47
set dim=`${prog2} ${inpfile} dim` 
48
 
48
 
49
# Run program
49
# Run program
50
\rm -f extract.param
50
\rm -f extract.param
51
echo \"${inpfile}\"  >! extract.param
51
echo \"${inpfile}\"  >! extract.param
52
echo \"${outfile}\"  >> extract.param
52
echo \"${outfile}\"  >> extract.param
53
echo \"${mode}\"     >> extract.param
53
echo \"${mode}\"     >> extract.param
54
echo ${dim}          >> extract.param
54
echo ${dim}          >> extract.param
55
echo \"${str}\"      >> extract.param
55
echo \"${str}\"      >> extract.param
56
 
56
 
57
${prog1}
57
${prog1}
58
 
58
 
59
#\rm -f extract.param
59
#\rm -f extract.param
60
 
60
 
61
exit 0
61
exit 0
62
 
62