Project

General

Profile

Converting netCDF4 to GRIB1

Added by jinhee ju about 1 year ago

Dear everyone,

I have been using CDO for various data processing.
However, sometimes I have trouble solving problems with CDO.

When i converted .nc files to .grb files using " cdo -f grb -copy [input.nc] [output.grb] ", some of them worked well, but some of them didn't.
In case of working well, the values in output were the same with the input file.
On the other hand, in other case that not worked, the values in output were different from the values in input file.

In my opinion, input files have similar or same form.

Here are my exmaples of input and output files.
[[https://drive.google.com/drive/folders/1_ijuoDTLAfJK7EbnDCe5ljB_3rXke1-H?usp=sharing]]

sst1.nc & sst1.grb are input and output, and these are the cases that are not converted well.
sst2.nc & sst2.grb are input and output too, and these are the cases that are converted well.

And this command is that i used.

cdo selname,sst [sst1.nc] [sst11.nc]
cdo -f grb -copy [sst11.nc] [sst1.grb]

Any helps are needed..
Thank you!

Jinhee


Replies (2)

RE: Converting netCDF4 to GRIB1 - Added by Uwe Schulzweida about 1 year ago

Dear Jinhee,

Yes, the two NetCDF files are very similar. There is only one difference, the data of sst1.nc contains NaNs and in sst2.nc the missing values are correctly assigned with -9.9e+36f.
The NaNs must be set to the missing value, then it works:

cdo -f grb -setctomiss,nan sst1.nc sst1.grb
Cheers,
Uwe

RE: Converting netCDF4 to GRIB1 - Added by jinhee ju about 1 year ago

Dear Uwe,

Thank you very much for the solution!!! It works very well.
I'll never forget your help.

Thank you so much again!

Jinhee

    (1-2/2)