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