Converting netCDF to GRIB

Dataset specific topics involving WPS.

Converting netCDF to GRIB

Postby ianderson » Mon Jan 05, 2009 6:46 pm


This is related to the 'ERA40 dataset' and 'creating grib input files' discussions.
I am trying to convert some NetCDF files from one of our other models (CCM3) to GRIB format for using as initial data to WRF.
We had converted them using GrADS lats4d, but neither g1print.exe or ungrib.exe could read them (error - unrecognised grid: 220).
On seeing two suggestions on the forum for CDO, we tried it out. It has created a GRIB file from our NetCDF data, but it has not assigned the correct grib codes to the variables, and has set the level type to 99 so that each level is listed as a separate variable.
Has anyone else had success converting NetCDF to GRIB with CDO yet?


Posts: 6
Joined: Mon Oct 20, 2008 3:24 pm

Re: Converting netCDF to GRIB

Postby SeBi013 » Fri May 06, 2011 8:47 am

Are there any solutions of this problem ?
Posts: 35
Joined: Sun Oct 25, 2009 4:55 pm
Location: Belgium

Re: Converting netCDF to GRIB

Postby pingtong » Tue Jul 19, 2011 2:47 am

I made grib files using wrfpost. But when I run ungrib, an error happened said:

Unrecognized grid: 205
This grid is not currently supported.

Can ungrib program do for the grib file produced by wrfpost? Why does wrfpost produced a grib file that has grid 205? What does grid 205 means?
Posts: 14
Joined: Fri Jul 15, 2011 1:50 am

Re: Converting netCDF to GRIB

Postby mkharkey » Mon Nov 28, 2011 11:29 am

yes, I've had success converting netcdf to grib with CDO. I used the "setcode" and "setltype" operators--but I couldn't have more than one variable in a file. But I have an older version of CDO.
There's a better option now:
Posts: 1
Joined: Wed Oct 19, 2011 10:44 am

Re: Converting netCDF to GRIB

Postby cthomas » Tue Nov 29, 2011 7:26 am

I think that it is better to work directly with the NetCDF files rather than convert to grib format and then use ungrib.exe. The sole purpose of ungrib.exe is to write out the grib data in the WPS intermediate data format. There is good sample code and documentation available from the NetCDF people which shows how to read a NetCDF file (depends on having the fortran NetCDF interface installed) and there is sample fortran code available from the WRF people which shows how to write data to the intermediate format. Put the two together and there you have it. It's not a big programming job.
Posts: 14
Joined: Tue Sep 30, 2008 7:14 pm

Re: Converting netCDF to GRIB

Postby alsayed » Wed Mar 07, 2012 5:59 am


Could you, please, tell me where I can find the fortran code that reads netcdf file in WRF.

Thanks for your help
Posts: 23
Joined: Fri Nov 18, 2011 7:30 am

Re: Converting netCDF to GRIB

Postby gholizadeh » Tue Dec 11, 2012 8:10 am

I think this link is helpful for anyone who has the same issue.

Posts: 1
Joined: Mon Sep 26, 2011 9:30 am

Return to Working with Various Datasets

Who is online

Users browsing this forum: No registered users and 7 guests