herbie.wgrib2._WGRIB2#

class herbie.wgrib2._WGRIB2[source]#

Wrapper for wgrib2 program.

__init__()#

Methods

__init__()

create_inventory_file(path[, suffix])

Create and save wgrib2 inventory files for GRIB2 file/files.

inventory(FILE)

Return wgrib2-style inventory of GRIB2 file.

region(path, extent, *[, name, suffix, ...])

Subset a GRIB2 file by geographical region.

vector_relative(path)

Check if vector quantities are "grid relative" or "earth relative"

Attributes

wgrib2

Methods:

create_inventory_file(path[, suffix])

Create and save wgrib2 inventory files for GRIB2 file/files.

inventory(FILE)

Return wgrib2-style inventory of GRIB2 file.

region(path, extent, *[, name, suffix, ...])

Subset a GRIB2 file by geographical region.

vector_relative(path)

Check if vector quantities are "grid relative" or "earth relative"

create_inventory_file(path, suffix='.grib2')[source]#

Create and save wgrib2 inventory files for GRIB2 file/files.

Note that this will overwrite any existing inventory file.

Parameters:
  • path (pathlib.path) – If path is a file, then make inventory file for that file. If path is a directory, then make inventory files for all files with the indicated suffix.

  • suffix ({".grib2", ".grib", ".grb", etc.}) – If path specified is a directory, then this is the suffix to look for GRIB2 files.

inventory(FILE)[source]#

Return wgrib2-style inventory of GRIB2 file.

region(path, extent, *, name='region', suffix='.grib2', create_idx=True)[source]#

Subset a GRIB2 file by geographical region.

See https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/small_grib.html

Parameters:
  • path (path-like) – Path to the grib2 file you wish to subset into a region. If path is a file, then make region subset for that file. If path is a directory, then make region subset for all files with the indicated suffix.

  • extent (4-item tuple or list) – Longitude and Latitude bounds representing the region of interest. (lon_min, lon_max, lat_min, lat_max) : float

  • name (str) – Name of the region. Output grib will be saved to a new file with the name prepended to the filename.

  • suffix ({".grib2", ".grib", ".grb", etc.}) – If path specified is a directory, then this is the suffix to look for GRIB2 files.

  • create_idx (bool) – If True, then make an inventory file for the GRIB2 region subest.

vector_relative(path)[source]#

Check if vector quantities are “grid relative” or “earth relative”

See “What are Earth and Grid Relative Winds” on https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/new_grid_intro.html

Read my thought on the subject blaylockbk/pyBKB_v2

Parameters:

path (path-like) – Path to the grib2 file.