nmangue / NGrib

NGrib is a .NET library to read GRIB (GRid in Binary) files. GRIB is a gridded data standard from WMO (World Meteorological Organisation) and is used by many meteorological organisation. Fork of GribCS.
GNU Lesser General Public License v3.0
17 stars 10 forks source link

Is there any usage examples? #7

Closed arisliang closed 1 year ago

arisliang commented 1 year ago

Couldn't find any usage examples. Would be great if there's some.

nmangue commented 1 year ago

Hello,

Unfortunately, for now there are no documentation. You can use the unit tests as reference to read GRIB files data. The base usage :

using var stream = File.OpenRead("sample.grib");
var reader = new Grib2Reader(stream);

var datasets = reader.ReadAllDataSets();

var temperatureDs = datasets.Single(d => d.Parameter.Equals(Parameter.Temperature));

var data = reader.ReadDataSetValues(temperatureDs);

To find information about the content (i.e. the GRIB sections, the templates, the field values...) please refer to the official specifications :