Subversion Repositories lagranto.ecmwf

Rev

Go to most recent revision | Details | 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
42
cdo -f nc -t ecmwf copy -invertlat ${grbdir}/an${date}_ps P${date}_ps
43
ncap2   -O -s 'PS=0.01f*exp(LNSP)' P${date}_ps  P${date}_ps
44
 
45
# Merge all files
46
\rm -f P${date}
47
cdo -f nc merge P${date}_tuvw P${date}_q P${date}_ps P${date}
48
\rm -f P${date}_tuvw
49
\rm -f P${date}_q
50
\rm -f P${date}_ps
51
 
52
# Proceed to next date
53
set date=`newtime ${date} ${timestep}` 
54
if ( "${date}" != "${finaldate}" ) goto loop
55
 
56
exit 0