I have downloaded grib1
model data from GFS, I am using a Mac OS X and was able to build the wgrib2
file from NOAA but was unable to extract the data. I have not found a grib1
utility for MAC.
Then I run to this program http://www.giss.nasa.gov/tools/panoply/ that was able to read the file and can see the data but I have some issues with it.
CSV
but only the values not the coordinatesWhat I want to do is :
MySQL
database to be able to do some data aggregation (sum, max, min) etcI already can extract grib
or can download from certain region, I would like that data to be able to see on a spreadsheet for example latitude, longitude, temperature, rainfall, wind etc... then from there I can take it to a database, or sum /avg etc or manipulate data.
Sample grib
data file: https://dl.dropboxusercontent.com/u/104462/neavilag_rain_wind_pressure.grb
Based on my scenario what is the best approach to handle my needs? Can you suggest me what to do?
I recommend to use cfgrib
which is a python based grib reader based on python project xarray
and the eccodes
software by the ECMWF.
It is very easy to use:
import cfgrib
cfgrib.open_datasets('your_grib_data.grib2')
And xarray comes with a lot of helpful built-in functions. Have fun!
If I do this kind of manipulation I usually use CDO, as it handles all kinds of native grids correctly. If you want to calculate the sum or mean of a field over a certain area for example, it is not correct to simply calculate the arithmetic mean with a regular lat-lon or reduced Gaussian grid as it does not account account for the changing grid-cell sizes as you move towards the poles.
I would therefore select an area with
cdo -f nc sellonlatbox,lon1,lon2,lat1,lat2 in.grb out.nc
Here I am converting to netcdf at the same time with the "-f nc" option. Many software packages read netcdf easily to create plots (ncl, gdl/idl, grads, R, python, panoply etc etc).
To calculate field statistics for the files it is as straightforward as
cdo fldmean in.nc out.nc
cdo fldmax in.nc out.nc
cdo fldsum in.nc out.nc
To give some of the examples you request. You may also make stats in the time dimension (timmean etc). Check out the CDO help pages for details. I installed CDO on my MAC using macports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With