Subversion Repositories lagranto.ecmwf

Rev

Rev 21 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21 michaesp 1
#!/bin/csh
2
 
3
# -------------------------------------------------
4
# Set some parameters
5
# -------------------------------------------------
6
 
7
# Input GRIB directory
8
set grbdir=/lhome/sprenger/lagranto.ecmwf/cdo
9
 
10
# Output netCDF directory
11
set cdfdir=/lhome/sprenger/lagranto.ecmwf/cdo
12
 
13
# Start and end date for conversion, and time step
14
set startdate = 20160201_00
15
set finaldate = 20160201_18
16
set timestep  = 6
17
 
18
# -------------------------------------------------
19
# Do the conversion
20
# -------------------------------------------------
21
 
22
# Incrrement finaldate by one timestep - to include finaldate
23
set finaldate=`newtime ${finaldate} ${timestep}` 
24
 
25
# Change to grib directory
26
cd ${cdfdir}
27
 
28
# Start loop over all dates
29
set date=${startdate}
30
loop:
31
 
32
# Convert an${date}_uvwt
33
\rm -f P${date}_tuvw
34
cdo -f nc -t ecmwf copy -invertlat -chname,W,OMEGA ${grbdir}/an${date}_tuvw P${date}_tuvw
35
 
36
# Convert an${date}_q
37
\rm -f P${date}_q
38
cdo -f nc -t ecmwf copy -invertlat ${grbdir}/an${date}_q P${date}_q
39
 
40
# Convert an${date}_ps
41
\rm -f P${date}_ps
27 michaesp 42
cdo -f nc -t ecmwf copy -invertlat ${grbdir}/an${date}_ps P${date}_ps_scratch
43
#ncap2   -O -s 'PS=0.01f*exp(LNSP)' P${date}_ps  P${date}_ps
44
cdo -O -f nc -b 64 -L expr,'PS=0.01*exp(LNSP)' P${date}_ps_scratch P${date}_ps
21 michaesp 45
 
46
# Merge all files
47
\rm -f P${date}
48
cdo -f nc merge P${date}_tuvw P${date}_q P${date}_ps P${date}
49
\rm -f P${date}_tuvw
50
\rm -f P${date}_q
51
\rm -f P${date}_ps
27 michaesp 52
\rm -f P${date}_ps_scratch
21 michaesp 53
 
54
# Proceed to next date
55
set date=`newtime ${date} ${timestep}` 
56
if ( "${date}" != "${finaldate}" ) goto loop
57
 
58
exit 0