Conversion of GRIB and NetCDF to my database

5.6k views Asked by At

enter image description here

I have downloaded "High Resolution Initial Conditions" climate forecast data for one day, it was in extension .tar.gz so I extracted it in my local directory and I get the files like in the attached image. I think, that the files without extension are GRIB data (because first word in them is "GRIB"). So I want to get data from the big files (GRIB and NetCDF formats containing climate data like temerature & pressure in grid) to my database, but they are binary. Can you recommend me some easy way for getting data from these files? I can't get any information about handling their datasets on their website.

Converting these files to .csv would be nice, but I can't find a program to convert the GRIB files.

3

There are 3 answers

2
carla On

Using python and some available modules it is simple...

The Enthought Python Distribution includes several packages, including netCDF4, to deal with NetCDF files!

I've never worked with GRIB files, but google tells that another python package exists, pygrib2.

Or you can use PyNio, a Python package that allows to read and write netCDF3 and netCDF4 classic format, and to read GRIB1 and GRIB2 files.

I don't know the ammount of data you have, but usually it is crazy to convert it to *.csv! Python is easy to learn, and suitable to work with this kind of data (with matplotlib package you can even plot it). Or, if you really need it in a *.csv, you can select with python a smaller domain, for example, or the needed variables...

0
Guillermo.D On

I'm currently dealing with a similar issue. In my case I'm trying to rely on the GrADS software, which can "easily" transform GRIB data into other formats. If your dataset is not huge, then you can export it to csv using this tutorial.

My dataset is 80gb in GRIB binary files, so I'm very restricted in what software I can use to handle it (no R unless I find a computer with more than 80gb of RAM).

0
Dave X On

For conversion into text, look into http://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html or http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/

Both are C programs from one of the big names in GRIB.