Skip to content

Commit 388e1ac

Browse files
committed
update language, remove water_use, remove mock txt files
1 parent 70c237e commit 388e1ac

7 files changed

Lines changed: 12 additions & 800 deletions

File tree

dataretrieval/nwis.py

Lines changed: 12 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
WATERSERVICES_SERVICES = ["dv", "iv", "site", "stat"]
3939
WATERDATA_SERVICES = [
4040
"peaks",
41-
"water_use",
4241
"ratings",
4342
]
4443
# NAD83
@@ -132,7 +131,7 @@ def get_qwdata(
132131
**kwargs,
133132
) -> Tuple[pd.DataFrame, BaseMetadata]:
134133
"""
135-
Get water sample data from qwdata service - deprecated, use `get_samples()`
134+
This function is defunct, use `get_samples()`
136135
in the waterdata module.
137136
138137
"""
@@ -149,9 +148,8 @@ def get_discharge_measurements(
149148
**kwargs,
150149
) -> Tuple[pd.DataFrame, BaseMetadata]:
151150
"""
152-
Get discharge measurements from the waterdata service -
153-
deprecated, use `get_field_measurements()` in the waterdata
154-
module.
151+
This function is defunct, use `get_field_measurements()`
152+
in the waterdata module.
155153
156154
"""
157155
raise NameError(
@@ -239,9 +237,8 @@ def get_gwlevels(
239237
**kwargs,
240238
) -> Tuple[pd.DataFrame, BaseMetadata]:
241239
"""
242-
Queries the groundwater level service from waterservices -
243-
deprecated, use `get_field_measurements()` in the waterdata
244-
module.
240+
This function is defunct, use `get_field_measurements()`
241+
in the waterdata module.
245242
246243
"""
247244
raise NameError(
@@ -679,9 +676,9 @@ def get_pmcodes(
679676
partial: bool = True,
680677
ssl_check: bool = True,
681678
) -> Tuple[pd.DataFrame, BaseMetadata]:
682-
"""
683-
Return a ``pandas.DataFrame`` containing all NWIS parameter codes -
684-
deprecated, use `get_reference_table(collection="parameter-codes")`.
679+
"""
680+
This function is defunct, use
681+
`get_reference_table(collection="parameter-codes")`.
685682
686683
"""
687684

@@ -698,74 +695,12 @@ def get_water_use(
698695
ssl_check: bool = True,
699696
) -> Tuple[pd.DataFrame, BaseMetadata]:
700697
"""
701-
Water use data retrieval from USGS (NWIS).
702-
703-
Parameters
704-
----------
705-
years: string or list of strings
706-
List or comma delimited string of years. Must be years ending in 0 or
707-
5, or "ALL", which retrieves all available years, default is "ALL"
708-
state: string, optional, default is None
709-
full name, abbreviation or id
710-
counties: string or list of strings
711-
County IDs from county lookup or "ALL", default is "ALL"
712-
categories: string or list of strings
713-
List or comma delimited string of Two-letter category abbreviations,
714-
default is "ALL"
715-
ssl_check: bool, optional
716-
If True, check SSL certificates, if False, do not check SSL,
717-
default is True
718-
719-
Returns
720-
-------
721-
df: ``pandas.DataFrame``
722-
Data from NWIS
723-
md: :obj:`dataretrieval.utils.Metadata`
724-
A custom metadata object
725-
726-
Examples
727-
--------
728-
.. doctest::
729-
730-
>>> # Get total population for RI from the NWIS water use service
731-
>>> df, md = dataretrieval.nwis.get_water_use(
732-
... years="2000", state="RI", categories="TP"
733-
... )
734-
735-
>>> # Get the national total water use for livestock in Bgal/day
736-
>>> df, md = dataretrieval.nwis.get_water_use(years="2010", categories="L")
737-
738-
>>> # Get 2005 domestic water use for Apache County in Arizona
739-
>>> df, md = dataretrieval.nwis.get_water_use(
740-
... years="2005", state="Arizona", counties="001", categories="DO"
741-
... )
698+
This function is defunct and currently has no replacement.
742699
743700
"""
744-
if years:
745-
if not isinstance(years, list) and not isinstance(years, str):
746-
raise TypeError("years must be a string or a list of strings")
747-
748-
if counties:
749-
if not isinstance(counties, list) and not isinstance(counties, str):
750-
raise TypeError("counties must be a string or a list of strings")
751-
752-
if categories:
753-
if not isinstance(categories, list) and not isinstance(categories, str):
754-
raise TypeError("categories must be a string or a list of strings")
755-
756-
payload = {
757-
"rdb_compression": "value",
758-
"format": "rdb",
759-
"wu_year": years,
760-
"wu_category": categories,
761-
"wu_county": counties,
762-
}
763-
url = WATERDATA_URL + "water_use"
764-
if state is not None:
765-
url = WATERDATA_BASE_URL + state + "/nwis/water_use"
766-
payload.update({"wu_area": "county"})
767-
response = query(url, payload, ssl_check=ssl_check)
768-
return _read_rdb(response.text), NWIS_Metadata(response)
701+
raise NameError(
702+
"`nwis.get_water_use` is defunct."
703+
)
769704

770705

771706
def get_ratings(

0 commit comments

Comments
 (0)