Accessing data from the supported databases through their APIs.
- class pygeohydro.waterdata.NWIS#
Access NWIS web service.
More information about query parameters and codes that NWIS accepts can be found at its help webpage.
- get_info(queries, expanded=False, fix_names=True)#
Send multiple queries to USGS Site Web Service.
geopandas.GeoDataFrame– A correctly typed
GeoDataFramecontaining site(s) information.
Search for parameter codes by name or number.
NWIS guideline for keywords is as follows:
By default an exact search is made. To make a partial search the term should be prefixed and suffixed with a % sign. The % sign matches zero or more characters at the location. For example, to find all with “discharge” enter %discharge% in the field. % will match any number of characters (including zero characters) at the location.
str) – Keyword to search for parameters by name of number.
pandas.DataFrame– Matched parameter codes as a dataframe with their description.
>>> from pygeohydro import NWIS >>> nwis = NWIS() >>> codes = nwis.get_parameter_codes("%discharge%") >>> codes.loc[codes.parameter_cd == "00060", "parm_nm"] 'Discharge, cubic feet per second'
- get_streamflow(station_ids, dates, freq='dv', mmd=False, to_xarray=False)#
Get mean daily streamflow observations from USGS.
tuple) – Start and end dates as a tuple (start, end).
str, optional) – The frequency of the streamflow data, defaults to
dv(daily values). Valid frequencies are
iv(instantaneous values). Note that for
ivthe time zone for the input dates is assumed to be UTC.
bool, optional) – Convert cms to mm/day based on the contributing drainage area of the stations. Defaults to False.
bool, optional) – Whether to return a xarray.Dataset. Defaults to False.
xarray.Dataset– Streamflow data observations in cubic meter per second (cms). The stations that don’t provide the requested discharge data in the target period will be dropped. Note that when frequency is set to
ivthe time zone is converted to UTC.
- static retrieve_rdb(url, payloads)#
Retrieve and process requests with RDB format.
- class pygeohydro.waterdata.WBD(layer, outfields='*', crs=4326)#
Access Watershed Boundary Dataset (WBD).
This web service offers Hydrologic Unit (HU) polygon boundaries for the United States, Puerto Rico, and the U.S. Virgin Islands. For more info visit: https://hydro.nationalmap.gov/arcgis/rest/services/wbd/MapServer
str, optional) – A valid service layer. Valid layers are:
Get the full watershed boundary for a given HUC level.
This function is designed for cases where the full watershed boundary is needed for a given HUC level. If only a subset of the HUCs is needed, then use the
pygeohydro.WBDclass. The full dataset is downloaded from the National Maps’ WBD staged products.