Spaces:
Running
Running
File size: 1,032 Bytes
1a437b8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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 6`
- Specify 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.json` to save sampled points.
Notes
- This script avoids pygrib and relies on cfgrib (ecCodes).
- If you need NetCDF output, add `--out-nc /path/out.nc` and uncomment the indicated line to save ds.to_netcdf.
|