Skip to content

Commit 576d214

Browse files
committed
Ruff fixes
1 parent 28d7c68 commit 576d214

31 files changed

Lines changed: 1179 additions & 918 deletions

dataretrieval/nldi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def get_features(
281281
query_params = {}
282282

283283
if lat:
284-
err_msg = f"Error getting features for lat '{lat}'" f" and long '{long}'"
284+
err_msg = f"Error getting features for lat '{lat}' and long '{long}'"
285285
elif feature_source:
286286
err_msg = (
287287
f"Error getting features for feature source '{feature_source}'"

dataretrieval/nwis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"The 'nwis' services are deprecated and being decommissioned. "
2727
"Please use the 'waterdata' module to access the new services.",
2828
DeprecationWarning,
29-
stacklevel=2
29+
stacklevel=2,
3030
)
3131

3232
WATERDATA_BASE_URL = "https://nwis.waterdata.usgs.gov/"
@@ -141,7 +141,7 @@ def get_qwdata(
141141
"""
142142
raise NameError(
143143
"`nwis.get_qwdata` has been replaced with `waterdata.get_samples()`."
144-
)
144+
)
145145

146146

147147
def get_discharge_measurements(
@@ -157,7 +157,7 @@ def get_discharge_measurements(
157157
Parameters
158158
----------
159159
sites: string or list of strings, optional, default is None
160-
start: string, optional, default is None
160+
start: string, optional, default is None
161161
Supply date in the format: YYYY-MM-DD
162162
end: string, optional, default is None
163163
Supply date in the format: YYYY-MM-DD
@@ -344,7 +344,7 @@ def get_gwlevels(
344344

345345
if datetime_index is True:
346346
df = format_datetime(df, "lev_dt", "lev_tm", "lev_tz_cd")
347-
347+
348348
# Filter by kwarg parameterCd because the service doesn't do it
349349
if "parameterCd" in kwargs:
350350
pcodes = kwargs["parameterCd"]

dataretrieval/samples.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
from __future__ import annotations
88

9-
from typing import TYPE_CHECKING, Literal, get_args
10-
11-
import pandas as pd
129
import warnings
10+
from typing import TYPE_CHECKING
1311

1412
from dataretrieval.utils import BaseMetadata
1513

1614
if TYPE_CHECKING:
1715
from typing import Optional, Tuple, Union
18-
from dataretrieval.waterdata import SERVICES, PROFILES
16+
1917
from pandas import DataFrame
2018

19+
from dataretrieval.waterdata import PROFILES, SERVICES
20+
21+
2122
def get_usgs_samples(
2223
ssl_check: bool = True,
2324
service: SERVICES = "results",
@@ -111,7 +112,7 @@ def get_usgs_samples(
111112
A user supplied characteristic name describing one or more results.
112113
boundingBox: list of four floats, optional
113114
Filters on the the associated monitoring location's point location
114-
by checking if it is located within the specified geographic area.
115+
by checking if it is located within the specified geographic area.
115116
The logic is inclusive, i.e. it will include locations that overlap
116117
with the edge of the bounding box. Values are separated by commas,
117118
expressed in decimal degrees, NAD83, and longitudes west of Greenwich
@@ -120,7 +121,7 @@ def get_usgs_samples(
120121
- Western-most longitude
121122
- Southern-most latitude
122123
- Eastern-most longitude
123-
- Northern-most longitude
124+
- Northern-most longitude
124125
Example: [-92.8,44.2,-88.9,46.0]
125126
countryFips : string or list of strings, optional
126127
Example: "US" (United States)
@@ -143,7 +144,7 @@ def get_usgs_samples(
143144
usgsPCode : string or list of strings, optional
144145
5-digit number used in the US Geological Survey computerized
145146
data system, National Water Information System (NWIS), to
146-
uniquely identify a specific constituent. Check the
147+
uniquely identify a specific constituent. Check the
147148
`characteristic_lookup()` function in this module for all possible
148149
inputs.
149150
Example: "00060" (Discharge, cubic feet per second)
@@ -173,7 +174,7 @@ def get_usgs_samples(
173174
recordIdentifierUserSupplied : string or list of strings, optional
174175
Internal AQS record identifier that returns 1 entry. Only available
175176
for the "results" service.
176-
177+
177178
Returns
178179
-------
179180
df : ``pandas.DataFrame``
@@ -187,8 +188,8 @@ def get_usgs_samples(
187188
188189
>>> # Get PFAS results within a bounding box
189190
>>> df, md = dataretrieval.samples.get_usgs_samples(
190-
... boundingBox=[-90.2,42.6,-88.7,43.2],
191-
... characteristicGroup="Organics, PFAS"
191+
... boundingBox=[-90.2, 42.6, -88.7, 43.2],
192+
... characteristicGroup="Organics, PFAS",
192193
... )
193194
194195
>>> # Get all activities for the Commonwealth of Virginia over a date range
@@ -197,12 +198,17 @@ def get_usgs_samples(
197198
... profile="sampact",
198199
... activityStartDateLower="2023-10-01",
199200
... activityStartDateUpper="2024-01-01",
200-
... stateFips="US:51")
201+
... stateFips="US:51",
202+
... )
201203
202204
>>> # Get all pH samples for two sites in Utah
203205
>>> df, md = dataretrieval.samples.get_usgs_samples(
204-
... monitoringLocationIdentifier=['USGS-393147111462301', 'USGS-393343111454101'],
205-
... usgsPCode='00400')
206+
... monitoringLocationIdentifier=[
207+
... "USGS-393147111462301",
208+
... "USGS-393343111454101",
209+
... ],
210+
... usgsPCode="00400",
211+
... )
206212
207213
"""
208214

@@ -213,6 +219,7 @@ def get_usgs_samples(
213219
)
214220

215221
from dataretrieval.waterdata import get_samples
222+
216223
result = get_samples(
217224
ssl_check=ssl_check,
218225
service=service,
@@ -242,5 +249,3 @@ def get_usgs_samples(
242249
)
243250

244251
return result
245-
246-

dataretrieval/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,5 @@ def __init__(self, url):
229229

230230
def __str__(self):
231231
return (
232-
"No sites/data found using the selection criteria specified in url: "
233-
"{url}"
232+
"No sites/data found using the selection criteria specified in url: {url}"
234233
).format(url=self.url)

0 commit comments

Comments
 (0)