Spaces:
Running
Running
GRIB Playground — Arctic Waves (no pygrib)
Overview
- Fetches NOAA GFSWave Arctic 9km GRIB2 and extracts wave height, direction, and period without pygrib.
- Uses xarray+cfgrib (ECCODES backend) to decode GRIB.
Requirements
- Python 3.9+
- Packages: xarray, cfgrib, eccodes, numpy, requests
- System: ecCodes installed (provides GRIB decoding used by cfgrib)
Install
- macOS (Homebrew):
brew install eccodes - Python deps:
pip install xarray cfgrib eccodes numpy requests
Usage
Download and summarize a specific forecast hour:
python arctic_fetch.py --fh 6Specify date/run explicitly:
python arctic_fetch.py --date 20250115 --run 12 --fh 18
Outputs
- Writes the downloaded GRIB to a temp file by default.
- Prints summary stats and a small JSON sample to stdout.
- Optional:
--out-json /path/out.jsonto save sampled points.
Notes
- This script avoids pygrib and relies on cfgrib (ecCodes).
- If you need NetCDF output, add
--out-nc /path/out.ncand uncomment the indicated line to save ds.to_netcdf.