How GRIB2 subsetting works in Herbie
mainHerbie performs subsetting by GRIB message (field) rather than by geographical region. GRIB2 files consist of multiple "messages" or "layers" stacked together.
To avoid downloading massive files (e.g., a 700 MB HRRR file when you only need a 1 MB temperature field), Herbie uses HTTP Byte-Range requests via the cURL command.
Key constraints and requirements:
- Message-level only: You can subset by specific variables/fields, but you cannot perform regional (geographical) subsetting using this method. For regional subsetting, you must download the full file and use a tool like
wgrib2'ssmall_griblocally, or use the Zarr format. - Index Requirement: For Herbie to automate this, a remote index file (typically ending in
.idx) must exist on the server. This index file maps variables to their specific byte ranges (start and end offsets). - Mechanism: Herbie identifies the requested variable's byte range from the index, executes a cURL command to fetch only those bytes, and can append multiple ranges to reconstruct a subsetted file.