Project

General

Profile

cdo and netcdf

Added by Graziano Giuliani over 11 years ago

Hi,

I have found a strange behaviour of cdo using netcdf 4 file format. I am trying to interpolate a global grid to a projected grid, and have files generated by different codes in different formats:

reg_grid.nc : netCDF3 format
glob_grid.nc : netCDF4 format compressed
datafile.nc : netCDF4 format compressed

the below command fails:

cdo gencon,reg_grid.nc -setgrid,glob_grid.nc datafile.nc remapweights.nc
cdo gencon (Abort): Unsupported grid type: generic

If all files are in netcdf3, the same command works without any problem:

nccopy -k 1 glob_grid.nc tmp.nc && mv tmp.nc glob_grid.nc
nccopy -k 1 datafile.nc tmp.nc && mv datafile.nc tmp.nc
cdo gencon,reg_grid.nc -setgrid,glob_grid.nc datafile.nc remapweights.nc
cdo(2) setgrid: Processed 65318400 values from 1 variable over 252 timesteps ( 22.82s )
cdo gencon: Processed 259200 values from 1 variable over 1 timestep ( 22.82s )

it seems cdo doesn't like mixed netcdf formats (?), but it is a shame as datafile in non compressed format in my case is almost 4 times as big as the HDF5 compressed netCDF4, and going with nccopy takes ages.


Replies (4)

RE: cdo and netcdf - Added by Uwe Schulzweida over 11 years ago

Hi Graziano,

Mixed netCDF formats shouldn't be a problem in CDO. Could you please attach the files reg_grid.nc and glob_grid.nc?
We don't need all 252 timesteps, the first 4 should be enough. You can select the timesteps with the NCO tool ncks:

ncks -d time,0,3 ifile ofile

Cheers,
Uwe

RE: cdo and netcdf - Added by Graziano Giuliani over 11 years ago

Here comes the data. In the archive you have two directories, work and nowork, with the above test cases.

test.tar.gz (1.39 MB) test.tar.gz netCDF4 - netCDF3 mixed files problem

RE: cdo and netcdf - Added by Graziano Giuliani over 11 years ago

Sorry, the command above should now read:

cdo gencon,REGCM_grid.nc -setgrid,CMIP5_grid.nc HIST_ACET.nc remapweights.nc

RE: cdo and netcdf - Added by Uwe Schulzweida over 11 years ago

Hi Graziano,

Thanks for the data! The CMIP5_grid.nc file contains a SCRIP formatted grid description. This format is supported in CDO only for netCDF3. I have implemented the netCDF4 support for the SCRIP format in the next CDO release.

Best regards,
Uwe

    (1-4/4)