Skip to content

BlueNetCat/grib22json

Repository files navigation

GRIB2 decoder in the browser

This respository contains a decoder of GRIB2 files in javascript. You can try with your own GRIB2 files in https://bluenetcat.github.io/grib22json. The GRIB2 format was created by the World Meteorological Organization (WMO) and it is an accepted standard of the Open Geospatial Consortium (OGC).

Introduction

As far as the author knows, most web applications decode the GRIB2 files in the server and then send them to the client. For example the application from Cameron Beccario (https://earth.nullschool.net/) decodes the GRIB2 to JSON on the server (Java-app) and then formats it in his own propietary binary format to reduce the file size for transmission to the client. You can find the GRIB2json server side code here: https://github.com/cambecc/grib2json.

The advantage of decoding the GRIB2 file in the client is that it reduces the server-client transmission time (GRIB2 compresses data efficiently) and it reduces the complexity of the server (server only needs to download/store the GRIB2 from NOAA and send it to the client). Nevertheless, decoding time in the client might be an issue when GRIB2 files are large.

This decoder is in development and does not support all the features of GRIB2. It supports the decoding of GFS from NOAA, which covers a lot of forecasting variables accross the globe. According to windy.com, the dataset from NOAA is: "Basic free model provided by National Oceanic and Atmospheric Administration (NOAA) with not so good resolution. Compared to other models GFS can fail in mountain areas, and by forecasting clouds and precipitation. Since the model is free, majority of weather applications use GFS."

To download GFS files manually, I use the grib filter interface and the information about the layers. You can access both from https://nomads.ncep.noaa.gov/. A useful tutorial can be found in youtube by David Burch. In the grib filter you have to specify the level and the variable. Because most variables are only at one specific level, sometimes it is difficult to know at what level the variable is. For that, I use the information about the layers. You can infer the level you have to choose from there. For example wind speed is coded as UGRID and VGRID in the grib filter variables and the wind speed is found at the level 10 meters above ground. In the information website, you can find the wind variable name and the level (ugrd10m - 10 m above ground u-component of wind [m/s]).

Development links

I used the GRIB2 information from NOAA (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/) and ECMWF (https://apps.ecmwf.int/codes/grib/format/grib2/). The GRIB2 format was developed by the World Meteorological Organization (WMO), but the links on their website are rather hard to find or lost. The full description of GRIB2 from WMO can be found in this link.

Current status of GRIB2 decoder

Releases

No releases published

Packages

No packages published