mescla.datasets.loaders.fetch_water_quality_portal

mescla.datasets.loaders.fetch_water_quality_portal(characteristics=('Calcium', 'Magnesium', 'Sodium', 'Potassium', 'Chloride', 'Sulfate'), countycode=None, statecode=None, siteid=(), start_date='01-01-1990', organisation_prefix='USGS-', timeout=300, refresh=False)[source]

Download major-ion chemistry from the Water Quality Portal, wide and complete.

A live, reproducible route to real US water chemistry: public domain, no registration, and the same query that produced the bundled Grafton County dataset.

Parameters:
  • characteristics (tuple of str) – WQP characteristic names. Spelling matters – it is “Sulfate”, not “Sulphate”.

  • countycode (str, optional) – e.g. "US:33:009" (Grafton County, NH) or "US:33".

  • statecode (str, optional) – e.g. "US:33:009" (Grafton County, NH) or "US:33".

  • siteid (tuple of str) – Specific monitoring locations, e.g. ("USGS-01075098",).

  • start_date (str, default "01-01-1990") – MM-DD-YYYY, as the portal expects.

  • organisation_prefix (str, default "USGS-") – Keep only sites from this organisation. Pass "" for all.

  • timeout (int, default 300)

  • refresh (bool, default False) – Ignore any cached copy.

Returns:

DataFrame – One row per (site, date), one column per characteristic, in mg/L, with only samples complete in every requested characteristic.

Return type:

pd.DataFrame

Notes

Please cite: National Water Quality Monitoring Council, Water Quality Portal, https://www.waterqualitydata.us/, and Read et al. (2017), WRR 53, 1735-1745.