Subversion Repositories lagranto.ecmwf

Rev

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

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