I want to use Crayfish plugin for spatial temporal analysis of oil spill events. These data are available in csv format. Does anyone has an idea of how csv data can be converted into GRIB or NetCDF formats to enable me proceed.

1 Answer 1


There is a python library called pygrib for reading GRIB files. You can make code to do the conversion.

Example code:

import pygrib

grbs = pygrib.open('sampledata/flux.grb')  
grb = grbs.select(name='Maximum temperature')[0]

maxt = grb.values # same as grb['values']
maxt.shape, maxt.min(), maxt.max()
#(94, 192) 223.7 319.9

This hows how to get the lat\long of the grid:

lats, lons = grb.latlons()
lats.shape, lats.min(), lats.max(), lons.shape, lons.min(), lons.max()
(94, 192) -88.5419501373 88.5419501373  0.0 358.125
  • Thanks a lot Kttii. Please can you simplify your suggestions for me to assimilate. I am pretty new to GIS and coding stuff. I am only getting along through my current research. For instance, how do I "import pygrib" as you mentioned and etc? I would like to learn how this works for the conversion process. Thank you
    – user74501
    Oct 20, 2016 at 17:12
  • @user74501 take a look at docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/… and if you run into an issue you should post a new question.
    – kttii
    Oct 20, 2016 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.