hydrotools.nwm_client.NWMClient module

NWM Client Tools

Client tools for retrieving National Water Model data from various sources.

Classes

NWMClient

class hydrotools.nwm_client.NWMClient.NWMClient

Bases: ABC

Abstract base class by building National Water Model output data clients.

_abc_impl = <_abc._abc_data object>
abstract get(configurations: ~typing.List[str], reference_times: ~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]] | ~numpy._typing._nested_sequence._NestedSequence[~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]]] | bool | int | float | complex | str | bytes | ~numpy._typing._nested_sequence._NestedSequence[bool | int | float | complex | str | bytes], variables: ~typing.List[str] = ['streamflow'], nwm_feature_ids: ~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]] | ~numpy._typing._nested_sequence._NestedSequence[~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]]] | bool | int | float | complex | str | bytes | ~numpy._typing._nested_sequence._NestedSequence[bool | int | float | complex | str | bytes] = Index([800010123, 800012331, 800005662, 800006277, 800009690, 800015240,        800016809, 800001894, 800005664, 800006488,        ...         41028035,  41028026,  41025904,  15489152,  41022861,  41022723,         15465127,  15456882,  15476223,  15448784],       dtype='int64', name='nwm_feature_id', length=8866), compute: bool = True) DataFrame | DataFrame

Abstract method to retrieve National Water Model data as a DataFrame.

Parameters:
  • configurations (List[str], required) – List of NWM configurations.

  • reference_times (array-like, required) – array-like of reference times. Should be compatible with pandas.Timestamp.

  • variables (List[str], optional, default ['streamflow']) – List of variables to retrieve from NWM files.

  • nwm_feature_ids (array-like, optional) – array-like of NWM feature IDs to return. Defaults to channel features with a known USGS mapping.

  • compute (bool, optional, default True) – When True returns a pandas.DataFrame. When False returns a dask.dataframe.DataFrame.

Returns:

  • dask.dataframe.DataFrame of NWM data or a pandas.DataFrame in canonical

  • format.

exception hydrotools.nwm_client.NWMClient.QueryError

Bases: Exception

Exception raised when a combination of configuration and/or reference times does not return any results.

exception hydrotools.nwm_client.NWMClient.StoreNotFoundError

Bases: Exception

Exception raised by methods that require a dataframe store.