momlevel.tidegauge module

tidegauge.py - tide gauge tools for momlevel

momlevel.tidegauge.extract_tidegauge(arr, xcoord='geolon', ycoord='geolat', csv='us', mask=None, threshold=None, disable_warning=True)

Function to extract tide gauge locations from an input array

This function accepts and xarray.DataArray and returns a new Dataset object with individual variables corresponding to the requested locations. The deafult behavior is to use a set of US-based tide gauge locations that is included with this package but can be overridden by supplying a separate DataFrame.

Parameters:
  • arr (xarray.core.dataarray.DataArray) – Input data array

  • xcoord (xarray.core.dataarray.DataArray or str) – x-coordinate name or object

  • ycoord (xarray.core.dataarray.DataArray or str) – y-coordinate name or object

  • csv (str, path-like, optional) – Options are “us”, “global”, or a path to local csv file, by default “us”

  • mask (xarray.core.dataarray.DataArray, optional) – Wet mask on model grid (1=ocean, 0=land)

  • threshold (float, optional) – Filter locations that are insufficiently close to a model grid point. The threshold value represents the maximum allowed distance in km. A value of 1 to 1.5 of the model’s nominal resolution is a suggested value, by default None

  • disable_warning (bool, optional) – Disable warnings when a requested point cannot be mapped. This option is set to True by default as requesting tide gauge locations for regional model configurations can yield numerous message. Enabling the warnings may be useful in some cases, however. By default, True

Returns:

Dataset containing individual DataArrays for each requested location

Return type:

xarray.core.dataset.Dataset