dataretrieval.nwis

Functions for downloading data from the National Water Information System (NWIS).

Todo

  • Create a test to check whether functions pull multiple sites

  • Work on multi-index capabilities.

  • Check that all timezones are handled properly for each service.

class dataretrieval.nwis.NWIS_Metadata(response, **parameters)[source]

Metadata class for NWIS service, derived from BaseMetadata.

url

Response url

Type:

str

query_time

Response elapsed time

Type:

datetme.timedelta

header

Response headers

Type:

requests.structures.CaseInsensitiveDict

comments

Metadata comments, if any

Type:

str | None

site_info

Site information if the query included site_no, sites, stateCd, huc, countyCd or bBox. site_no is preferred over sites if both are present.

Type:

tuple[pd.DataFrame, NWIS_Metadata] | None

variable_info

Variable information if the query included parameterCd.

Type:

tuple[pd.DataFrame, NWIS_Metadata] | None

__init__(response, **parameters) None[source]

Generates a standard set of metadata informed by the response with specific metadata for NWIS data.

Parameters:
  • response (Response) – Response object from requests module

  • parameters (unpacked dictionary) – Unpacked dictionary of the parameters supplied in the request

Returns:

md – A dataretrieval custom dataretrieval.nwis.NWIS_Metadata object.

Return type:

dataretrieval.nwis.NWIS_Metadata

property site_info: Tuple[DataFrame, BaseMetadata] | None
Returns:

dataretrieval.nwis._read_json(json)[source]

Reads a NWIS Water Services formatted JSON into a pandas.DataFrame.

Parameters:

json (dict) – A JSON dictionary response to be parsed into a pandas.DataFrame

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

dataretrieval.nwis._read_rdb(rdb)[source]

Convert NWIS rdb table into a pandas.dataframe.

Parameters:

rdb (string) – A string representation of an rdb table

Returns:

df – A formatted pandas data frame

Return type:

pandas.dataframe

dataretrieval.nwis.format_response(df: DataFrame, service: str | None = None, **kwargs) DataFrame[source]

Setup index for response from query.

This function formats the response from the NWIS web services, in particular it sets the index of the data frame. This function tries to convert the NWIS response into pandas datetime values localized to UTC, and if possible, uses these timestamps to define the data frame index.

Parameters:
  • df (pandas.DataFrame) – The data frame to format

  • service (string, optional, default is None) – The NWIS service that was queried, important because the ‘peaks’ service returns a different format than the other services.

  • **kwargs (optional) – Additional keyword arguments, e.g., ‘multi_index’

Returns:

df – The formatted data frame

Return type:

pandas.DataFrame

dataretrieval.nwis.get_discharge_measurements(sites: List[str] | str | None = None, start: str | None = None, end: str | None = None, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Get discharge measurements from the waterdata service.

Parameters:
  • sites (string or list of strings, optional, default is None) – If the qwdata parameter site_no is supplied, it will overwrite the sites parameter

  • start (string, optional, default is None) – If the qwdata parameter begin_date is supplied, it will overwrite the start parameter (YYYY-MM-DD)

  • end (string, optional, default is None) – If the qwdata parameter end_date is supplied, it will overwrite the end parameter (YYYY-MM-DD)

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get discharge measurements for site 05114000
>>> df, md = dataretrieval.nwis.get_discharge_measurements(
...     sites='05114000', start='2000-01-01', end='2000-01-30'
... )

>>> # Get discharge measurements for sites in Alaska
>>> df, md = dataretrieval.nwis.get_discharge_measurements(
...     start='2012-01-09', end='2012-01-10', stateCd='AK'
... )
dataretrieval.nwis.get_discharge_peaks(sites: List[str] | str | None = None, start: str | None = None, end: str | None = None, multi_index: bool = True, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Get discharge peaks from the waterdata service.

Parameters:
  • sites (string or list of strings, optional, default is None) – If the waterdata parameter site_no is supplied, it will overwrite the sites parameter

  • start (string, optional, default is None) – If the waterdata parameter begin_date is supplied, it will overwrite the start parameter (YYYY-MM-DD)

  • end (string, optional, default is None) – If the waterdata parameter end_date is supplied, it will overwrite the end parameter (YYYY-MM-DD)

  • multi_index (bool, optional) – If False, a dataframe with a single-level index (datetime) is returned, default is True

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get discharge peaks for site 01491000
>>> df, md = dataretrieval.nwis.get_discharge_peaks(
...     sites='01491000', start='1980-01-01', end='1990-01-01'
... )

>>> # Get discharge peaks for sites in Hawaii
>>> df, md = dataretrieval.nwis.get_discharge_peaks(
...     start='1980-01-01', end='1980-01-02', stateCd='HI'
... )
dataretrieval.nwis.get_dv(sites: List[str] | str | None = None, start: str | None = None, end: str | None = None, multi_index: bool = True, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Get daily values data from NWIS and return it as a pandas.DataFrame.

Parameters:
  • sites (string or list of strings, optional, default is None) – USGS site number (or list of site numbers)

  • start (string, optional, default is None) – If the waterdata parameter startDT is supplied, it will overwrite the start parameter (YYYY-MM-DD)

  • end (string, optional, default is None) – If the waterdata parameter endDT is supplied, it will overwrite the end parameter (YYYY-MM-DD)

  • multi_index (bool, optional) – If True, return a multi-index dataframe, if False, return a single-index dataframe, default is True

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get mean statistic daily values for site 04085427
>>> df, md = dataretrieval.nwis.get_dv(
...     sites='04085427', start='2012-01-01', end='2012-06-30', statCd='00003'
... )

>>> # Get the latest daily values for site 01646500
>>> df, md = dataretrieval.nwis.get_dv(sites='01646500')
dataretrieval.nwis.get_gwlevels(sites: List[str] | str | None = None, start: str = '1851-01-01', end: str | None = None, multi_index: bool = True, datetime_index: bool = True, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Queries the groundwater level service from waterservices

Parameters:
  • sites (string or list of strings, optional, default is None) – If the waterdata parameter site_no is supplied, it will overwrite the sites parameter

  • start (string, optional, default is '1851-01-01') – If the waterdata parameter begin_date is supplied, it will overwrite the start parameter

  • end (string, optional, default is None) – If the waterdata parameter end_date is supplied, it will overwrite the end parameter (YYYY-MM-DD)

  • multi_index (bool, optional) – If False, a dataframe with a single-level index (datetime) is returned, default is True

  • datetime_index (bool, optional) – If True, create a datetime index, default is True

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get groundwater levels for site 434400121275801
>>> df, md = dataretrieval.nwis.get_gwlevels(sites='434400121275801')
dataretrieval.nwis.get_info(ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Get site description information from NWIS.

Note: Must specify one major parameter.

For additional parameter options see https://waterservices.usgs.gov/docs/site-service/site-service-details/

Parameters:
  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Keyword Arguments:
  • sites (string or list of strings) – A list of site numbers. Sites may be prefixed with an optional agency code followed by a colon.

  • stateCd (string) – U.S. postal service (2-digit) state code. Only 1 state can be specified per request.

  • huc (string or list of strings) – A list of hydrologic unit codes (HUC) or aggregated watersheds. Only 1 major HUC can be specified per request, or up to 10 minor HUCs. A major HUC has two digits.

  • bBox (string or list of strings) – A contiguous range of decimal latitude and longitude, starting with the west longitude, then the south latitude, then the east longitude, and then the north latitude with each value separated by a comma. The product of the range of latitude range and longitude cannot exceed 25 degrees. Whole or decimal degrees must be specified, up to six digits of precision. Minutes and seconds are not allowed.

  • countyCd (string or list of strings) – A list of county numbers, in a 5 digit numeric format. The first two digits of a county’s code are the FIPS State Code. (url: https://help.waterdata.usgs.gov/code/county_query?fmt=html)

  • startDt (string) – Selects sites based on whether data was collected at a point in time beginning after startDt (start date). Dates must be in ISO-8601 Calendar Date format (for example: 1990-01-01).

  • endDt (string) – The end date for the period of record. Dates must be in ISO-8601 Calendar Date format (for example: 1990-01-01).

  • period (string) – Selects sites based on whether they were active between now and a time in the past. For example, period=P10W will select sites active in the last ten weeks.

  • modifiedSince (string) – Returns only sites where site attributes or period of record data have changed during the request period.

  • parameterCd (string or list of strings) – Returns only site data for those sites containing the requested USGS parameter codes.

  • siteType (string or list of strings) – Restricts sites to those having one or more major and/or minor site types, such as stream, spring or well. For a list of all valid site types see https://help.waterdata.usgs.gov/site_tp_cd For example, siteType=’ST’ returns streams only.

  • siteOutput (string ('basic' or 'expanded')) – Indicates the richness of metadata you want for site attributes. Note that for visually oriented formats like Google Map format, this argument has no meaning. Note: for performance reasons, siteOutput=expanded cannot be used if seriesCatalogOutput=true or with any values for outputDataTypeCd.

  • seriesCatalogOutput (bool) – A switch that provides detailed period of record information for certain output formats. The period of record indicates date ranges for a certain kind of information about a site, for example the start and end dates for a site’s daily mean streamflow.

Returns:

  • df (pandas.DataFrame) – Site data from the NWIS web service

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get site information for a single site
>>> df, md = dataretrieval.nwis.get_info(sites='05114000')

>>> # Get site information for multiple sites
>>> df, md = dataretrieval.nwis.get_info(sites=['05114000', '09423350'])
dataretrieval.nwis.get_iv(sites: List[str] | str | None = None, start: str | None = None, end: str | None = None, multi_index: bool = True, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Get instantaneous values data from NWIS and return it as a DataFrame.

Note

If no start or end date are provided, only the most recent record is returned.

Parameters:
  • sites (string or list of strings, optional, default is None) – If the waterdata parameter site_no is supplied, it will overwrite the sites parameter

  • start (string, optional, default is None) – If the waterdata parameter startDT is supplied, it will overwrite the start parameter (YYYY-MM-DD)

  • end (string, optional, default is None) – If the waterdata parameter endDT is supplied, it will overwrite the end parameter (YYYY-MM-DD)

  • multi_index (bool, optional) – If False, a dataframe with a single-level index (datetime) is returned, default is True

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get instantaneous discharge data for site 05114000
>>> df, md = dataretrieval.nwis.get_iv(
...     sites='05114000',
...     start='2013-11-03',
...     end='2013-11-03',
...     parameterCd='00060',
... )
dataretrieval.nwis.get_pmcodes(parameterCd: str | List[str] = 'All', partial: bool = True, ssl_check: bool = True) Tuple[DataFrame, BaseMetadata][source]

Return a pandas.DataFrame containing all NWIS parameter codes.

Parameters:
  • parameterCd (string or list of strings, default is 'All') – Accepts parameter codes or names

  • partial (bool, optional) – Default is True (partial querying). If False, the function will query only exact matches, default is True

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

Returns:

  • df (pandas.DataFrame) – Data retrieved from the NWIS web service.

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get information about the '00060' pcode
>>> df, md = dataretrieval.nwis.get_pmcodes(parameterCd='00060', partial=False)

>>> # Get information about all 'Discharge' pcodes
>>> df, md = dataretrieval.nwis.get_pmcodes(
...     parameterCd='Discharge', partial=True
... )
dataretrieval.nwis.get_qwdata(sites: List[str] | str | None = None, start: str | None = None, end: str | None = None, multi_index: bool = True, wide_format: bool = True, datetime_index: bool = True, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Get water sample data from qwdata service.

Warning

The NWIS qw data service is being deprecated. See this note from the R package for more information: https://doi-usgs.github.io/dataRetrieval/articles/qwdata_changes.html If you have additional questions about the qw data service, email gs-w-IOW_PO_team@usgs.gov.

Parameters:
  • sites (string or list of strings, optional, default is None) – If the qwdata parameter site_no is supplied, it will overwrite the sites parameter

  • start (string, optional, default is None) – If the qwdata parameter begin_date is supplied, it will overwrite the start parameter (YYYY-MM-DD)

  • end (string, optional, default is None) – If the qwdata parameter end_date is supplied, it will overwrite the end parameter (YYYY-MM-DD)

  • multi_index (bool, optional) – If False, a dataframe with a single-level index (datetime) is returned, default is True

  • wide_format (bool, optional) – If True, return data in wide format with multiple samples per row and one row per time, default is True

  • datetime_index (bool, optional) – If True, create a datetime index, default is True

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Times series data from the NWIS JSON

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # get water sample information for site 11447650
>>> df, md = dataretrieval.nwis.get_qwdata(
...     sites='11447650', start='2010-01-01', end='2010-02-01'
... )
dataretrieval.nwis.get_ratings(site: str | None = None, file_type: str = 'base', ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Rating table for an active USGS streamgage retrieval.

Reads current rating table for an active USGS streamgage from NWISweb. Data is retrieved from https://waterdata.usgs.gov/nwis.

Parameters:
  • site (string, optional, default is None) – USGS site number. This is usually an 8 digit number as a string. If the nwis parameter site_no is supplied, it will overwrite the site parameter

  • file_type (string, default is "base") – can be “base”, “corr”, or “exsa”

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

  • df (pandas.DataFrame) – Formatted requested data

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get the rating table for USGS streamgage 01594440
>>> df, md = dataretrieval.nwis.get_ratings(site='01594440')
dataretrieval.nwis.get_record(sites: List[str] | str | None = None, start: str | None = None, end: str | None = None, multi_index: bool = True, wide_format: bool = True, datetime_index: bool = True, state: str | None = None, service: str = 'iv', ssl_check: bool = True, **kwargs) DataFrame[source]

Get data from NWIS and return it as a pandas.DataFrame.

Note

If no start or end date are provided, only the most recent record is returned.

Parameters:
  • sites (string or list of strings, optional, default is None) – List or comma delimited string of site.

  • start (string, optional, default is None) – Starting date of record (YYYY-MM-DD)

  • end (string, optional, default is None) – Ending date of record. (YYYY-MM-DD)

  • multi_index (bool, optional) – If False, a dataframe with a single-level index (datetime) is returned, default is True

  • wide_format (bool, optional) – If True, return data in wide format with multiple samples per row and one row per time, default is True

  • datetime_index (bool, optional) – If True, create a datetime index. default is True

  • state (string, optional, default is None) – full name, abbreviation or id

  • service (string, default is 'iv') –

    • ‘iv’ : instantaneous data

    • ’dv’ : daily mean data

    • ’qwdata’ : discrete samples

    • ’site’ : site description

    • ’measurements’ : discharge measurements

    • ’peaks’: discharge peaks

    • ’gwlevels’: groundwater levels

    • ’pmcodes’: get parameter codes

    • ’water_use’: get water use data

    • ’ratings’: get rating table

    • ’stat’: get statistics

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Return type:

pandas.DataFrame containing requested data

Examples

>>> # Get latest instantaneous data from site 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='iv')

>>> # Get latest daily mean data from site 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='dv')

>>> # Get all discrete sample data from site 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='qwdata')

>>> # Get site description for site 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='site')

>>> # Get discharge measurements for site 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='measurements')

>>> # Get discharge peaks for site 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='peaks')

>>> # Get latest groundwater level for site 434400121275801
>>> df = dataretrieval.nwis.get_record(
...     sites='434400121275801', service='gwlevels'
... )

>>> # Get information about the discharge parameter code
>>> df = dataretrieval.nwis.get_record(service='pmcodes', parameterCd='00060')

>>> # Get water use data for livestock nationally in 2010
>>> df = dataretrieval.nwis.get_record(
...     service='water_use', years='2010', categories='L'
... )

>>> # Get rating table for USGS streamgage 01585200
>>> df = dataretrieval.nwis.get_record(sites='01585200', service='ratings')

>>> # Get annual statistics for USGS station 01646500
>>> df = dataretrieval.nwis.get_record(
...     sites='01646500',
...     service='stat',
...     statReportType='annual',
...     statYearType='water',
... )
dataretrieval.nwis.get_stats(sites: List[str] | str | None = None, ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Queries water services statistics information.

For more information about the water services statistics service, visit https://waterservices.usgs.gov/docs/statistics/statistics-details/

Parameters:
  • sites (string or list of strings, optional, default is None) – USGS site number (or list of site numbers)

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Keyword Arguments:
  • statReportType (string) – daily (default), monthly, or annual

  • statTypeCd (string) – all, mean, max, min, median

Returns:

  • df (pandas.DataFrame) – Statistics data from the statistics service

  • md (dataretrieval.utils.Metadata) – A custom metadata object

  • .. todo:: – fix date parsing

Examples

>>> # Get annual water statistics for a site
>>> df, md = dataretrieval.nwis.get_stats(
...     sites='01646500', statReportType='annual', statYearType='water'
... )

>>> # Get monthly statistics for a site
>>> df, md = dataretrieval.nwis.get_stats(
...     sites='01646500', statReportType='monthly'
... )
dataretrieval.nwis.get_water_use(years: str | List[str] = 'ALL', state: str | None = None, counties: str | List[str] = 'ALL', categories: str | List[str] = 'ALL', ssl_check: bool = True) Tuple[DataFrame, BaseMetadata][source]

Water use data retrieval from USGS (NWIS).

Parameters:
  • years (string or list of strings) – List or comma delimited string of years. Must be years ending in 0 or 5, or “ALL”, which retrieves all available years, default is “ALL”

  • state (string, optional, default is None) – full name, abbreviation or id

  • counties (string or list of strings) – County IDs from county lookup or “ALL”, default is “ALL”

  • categories (string or list of strings) – List or comma delimited string of Two-letter category abbreviations, default is “ALL”

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

Returns:

  • df (pandas.DataFrame) – Data from NWIS

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # Get total population for RI from the NWIS water use service
>>> df, md = dataretrieval.nwis.get_water_use(
...     years='2000', state='RI', categories='TP'
... )

>>> # Get the national total water use for livestock in Bgal/day
>>> df, md = dataretrieval.nwis.get_water_use(years='2010', categories='L')

>>> # Get 2005 domestic water use for Apache County in Arizona
>>> df, md = dataretrieval.nwis.get_water_use(
...     years='2005', state='Arizona', counties='001', categories='DO'
... )
dataretrieval.nwis.preformat_peaks_response(df: DataFrame) DataFrame[source]

Datetime formatting for the ‘peaks’ service response.

Function to format the datetime column of the ‘peaks’ service response.

Parameters:

df (pandas.DataFrame) – The data frame to format

Returns:

df – The formatted data frame

Return type:

pandas.DataFrame

dataretrieval.nwis.query_waterdata(service: str, ssl_check: bool = True, **kwargs) Response[source]

Queries waterdata.

Parameters:
  • service (string) – Name of the service to query: ‘site’, ‘stats’, etc.

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Returns:

request – The response object from the API request to the web service

Return type:

requests.models.Response

dataretrieval.nwis.query_waterservices(service: str, ssl_check: bool = True, **kwargs) Response[source]

Queries waterservices.usgs.gov

For more documentation see https://waterservices.usgs.gov/docs/

Note

User must specify one major filter: sites, stateCd, or bBox

Parameters:
  • service (string) – Name of the service to query: ‘site’, ‘stats’, etc.

  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • ssl_check – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – If supplied, will be used as query parameters

Keyword Arguments:
  • bBox (string) – 7-digit Hydrologic Unit Code (HUC)

  • startDT (string) – Start date (e.g., ‘2017-12-31’)

  • endDT (string) – End date (e.g., ‘2018-01-01’)

  • modifiedSince (string) – Used to return only sites where attributes or period of record data have changed during the request period. String expected to be formatted in ISO-8601 duration format (e.g., ‘P1D’ for one day, ‘P1Y’ for one year)

Returns:

request – The response object from the API request to the web service

Return type:

requests.models.Response

dataretrieval.nwis.what_sites(ssl_check: bool = True, **kwargs) Tuple[DataFrame, BaseMetadata][source]

Search NWIS for sites within a region with specific data.

Parameters:
  • ssl_check (bool, optional) – If True, check SSL certificates, if False, do not check SSL, default is True

  • **kwargs (optional) – Accepts the same parameters as dataretrieval.nwis.get_info

Returns:

  • df (pandas.DataFrame) – Formatted requested data

  • md (dataretrieval.utils.Metadata) – A custom metadata object

Examples

>>> # get information about a single site
>>> df, md = dataretrieval.nwis.what_sites(sites='05114000')

>>> # get information about sites with phosphorus in Ohio
>>> df, md = dataretrieval.nwis.what_sites(stateCd='OH', parameterCd='00665')