pywgrib2_xr.wgrib

pywgrib2_xr.wgrib(*args)[source]

Mimics wgrib2 executable.

wgrib2 output is captured. If it exits with non-zero status, the output is passed to WgribError, else a warning is emmited.

Parameters

args (str) – Arguments passed to wgrib2.

Raises

WgribError – When wgrib2 exits with non-zero status.

Notes

The files opened by wgrib2 are not closed on exit. Use free_files() to close.

Examples

>>> try:
...     wgrib(*args)
>>> except WgribError as e:
...     print("wgrib2 error: {!r}".format(e))
>>> finally:
...     free_files(gribfile)