Check the Setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- An internet connection
Discrete water-quality sample results from USGS, EPA, and hundreds of partner agencies for building watershed monitoring and local water-quality tools.
Report a ProblemFrom Source to Product Signal
The Water Quality Portal returns discrete sample chemistry, not continuous USGS gauge readings or EPA drinking-water system compliance records. Start with nitrate results for one monitoring location and a one-year window. Sampling is irregular, so a gap is not a clean bill of health.
Install the packages, then run the notebook cell.
python -m pip install pandas requests
import io
import pandas as pd
import requests
response = requests.get(
"https://www.waterqualitydata.us/data/Result/search",
params={
"siteid": "USGS-01646500",
"characteristicName": "Nitrate",
"startDateLo": "01-01-2024",
"startDateHi": "12-31-2024",
"mimeType": "csv",
"zip": "no",
"dataProfile": "narrowResult",
},
timeout=60,
)
response.raise_for_status()
results = pd.read_csv(io.StringIO(response.text))
results["retrieved_at_utc"] = pd.Timestamp.now(tz="UTC")
print(
results[
[
"MonitoringLocationIdentifier",
"ActivityStartDate",
"CharacteristicName",
"ResultMeasureValue",
"ResultMeasure/MeasureUnitCode",
]
].head(20)
)Test a Useful Signal
Test whether discrete nitrate results can power a bounded watershed-quality monitor.
U.S. Geological Survey and U.S. Environmental Protection Agency is a government source. Last verified 2026-08-20. Temporal coverage: historical discrete samples through current agency submissions.