Project

General

Profile

CDO 1.5.4 corrupts the date conversion for netcdf

Added by Marston Ward about 12 years ago

Hi,

I'm extracting the convective and large-scale precipitation from a grib file, converting the output to netcdf, merging the two fields and modifying the resulting field.
My problem is that already at the initial conversion to netcdf from grib, the last date is corrupted when read by netcdf -v time while it looks fine if you do cdo info tp.nc.
I'm using the newest version of netcdf, but this problem is reproducible in older netcdf versions and cdo versions 1.5.2+.

The original model output is too large (15 GB) to post here but I have attached the grib and netcdf files extracted/converted from these grib files.

cat > grbfilter << EOT
if ( short_name is "cp" || short_name is "lsp" ) { write ; };
EOT

for y in 2000
do
for m in 1
do
mm=$(printf "%02d" $m)
echo 'applying grib filter...'
grib_filter grbfilter $indir/ICMGG${expname}+$y$mm
cdo -t ecmwf splitvar -setyear,$y -setmon,$mm filter.out x_${y}${mm}_ # Add the convective and large scale precip
echo 'Convert to netcdf'
cdo -f nc -R -t ecmwf copy x_${y}${mm}_CP.grb cp.nc
cdo -f nc -R -t ecmwf copy x_${y}${mm}_LSP.grb lsp.nc
echo 'adding fields'
cdo -mulc,333.33 -add cp.nc lsp.nc tp.nc
#echo 'regrid to 1 degree grid resolution from 1.1 to 1.0'
#cdo remapbil,r360x180 x.nc test.nc
echo 'Crop areas outside region of interest'
cdo sellonlatbox,80,300,30,-30 tp.nc $var${expname}+$y$mm.nc
done
done

x_200001_LSP.grb (42.2 MB) x_200001_LSP.grb grib extract using ECMWF's gribfilter

Replies (3)

RE: CDO 1.5.4 corrupts the date conversion for netcdf - Added by Marston Ward about 12 years ago

Sorry, the netcdf file is too big to attach to initial post. Limitation is 50 MB.

RE: CDO 1.5.4 corrupts the date conversion for netcdf - Added by Ralf Mueller about 12 years ago

What about the last 2 timesteps? Could you upload these only?

RE: CDO 1.5.4 corrupts the date conversion for netcdf - Added by Marston Ward about 12 years ago

Hi,

I discovered that: -setyear -setmon caused the problem. The model sets the first time step in the variable "time" as 2000-01-01-0300 but there is a step 2000-01-01-00:00 and it is this initial time step that is set to a negative number (-3). Removing setyear and setmon solved the problem.

Thanks!
/M

    (1-3/3)