Subversion Repositories lagranto.wrf

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 michaesp 1
#!/bin/csh
2
 
3
# -----------------------------------------------------------------------------
4
# Set some parameters
5
# -----------------------------------------------------------------------------
6
 
11 michaesp 7
# Set Lagranto 
8
set LAGRANTO = ${LAGRANTOBASE}.${MODEL}/
9
 
2 michaesp 10
# Set input file
11
set inpfile=$1
12
if ( ${#argv} == 2 ) then
13
  set mode=$2
14
else
15
  set mode='all'
16
endif
17
 
18
# Write usage information
19
if ( ${#argv} == 0) then
20
  echo 
21
  ${LAGRANTO}/bin/lagrantohelp trainfo short
22
  echo  
23
  exit 0
24
endif
25
 
26
# Set Fortran program
27
set prog=${LAGRANTO}/goodies/trainfo
28
 
29
# -----------------------------------------------------------------------------
30
# Run program 
31
# -----------------------------------------------------------------------------
32
 
33
\rm -f trainfo.param
34
echo \"${inpfile}\" >! trainfo.param 
35
echo \"${mode}\"    >> trainfo.param
36
 
37
${prog}
38
 
39
\rm -f trainfo.param
40
 
41
exit 0
42
 
43
# -----------------------------------------------------------------------------
44
# Old code: shell script extraction of ntra,ntim,ncol
45
# -----------------------------------------------------------------------------
46
 
47
# Get line numbers of first trajectory block (separated by empty line) 
48
set first=4
49
loop1:
50
  @ first = ${first} + 1
51
  set line=`sed -ne "${first},${first}p" ${inpfile}` 
52
if ( "${line}" != "" ) goto loop1
53
@ final = ${first} + 1
54
loop2:
55
  @ final = ${final} + 1
56
  set line=`sed -ne "${final},${final}p" ${inpfile}`
57
if ( "${line}" != "" ) goto loop2
58
@ first = ${first} + 1
59
@ final = ${final} - 1
60
 
61
# Set the number of fields, of times and of trajectories
62
set ntime=`echo "1 + ${final} - ${first}" | bc`  
63
set line=`sed -ne "${first},${first}p" ${inpfile}`
64
set ncol=`echo ${line} | awk '{print NF}'` 
65
set nlines=`wc -l ${inpfile} | awk '{print $1}'`
66
set ntra=`echo "(${nlines}-4)/(${ntime}+1)" | bc`
67
 
68
# Write info
69
echo ${ntra} ${ntime} ${ncol}