Skip to content

Commit 1d6ea02

Browse files
committed
Update README and doc
Revises the README examples to return `df`, which better conveys the return type.
1 parent 87f1cab commit 1d6ea02

2 files changed

Lines changed: 33 additions & 36 deletions

File tree

README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,61 +61,58 @@ pip install git+https://github.com/DOI-USGS/dataretrieval-python.git
6161

6262
The `waterdata` module provides access to modern USGS Water Data APIs.
6363

64-
The example below retrieves daily streamflow data for a specific monitoring
65-
location for water year 2025, where a "/" between two dates in the "time"
66-
input argument indicates a desired date range:
64+
Some basic usage examples include retrieving daily streamflow data for a
65+
specific monitoring location, where the `/` in the `time` argument indicates
66+
the desired range:
6767

6868
```python
6969
from dataretrieval import waterdata
7070

7171
# Get daily streamflow data (returns DataFrame and metadata)
72-
daily, metadata = waterdata.get_daily(
72+
df, metadata = waterdata.get_daily(
7373
monitoring_location_id='USGS-01646500',
7474
parameter_code='00060', # Discharge
7575
time='2024-10-01/2025-09-30'
7676
)
7777

78-
print(f"Retrieved {len(daily)} records")
79-
print(f"Site: {daily['monitoring_location_id'].iloc[0]}")
80-
print(f"Mean discharge: {daily['value'].mean():.2f} {daily['unit_of_measure'].iloc[0]}")
78+
print(f"Retrieved {len(df)} records")
79+
print(f"Site: {df['monitoring_location_id'].iloc[0]}")
80+
print(f"Mean discharge: {df['value'].mean():.2f} {df['unit_of_measure'].iloc[0]}")
8181
```
82-
Fetch daily discharge data for multiple sites from a start date to present
83-
using the following code:
82+
Retrieving streamflow at multiple locations from October 1, 2024 to the present:
8483

8584
```python
86-
daily_twosites, metadata = waterdata.get_daily(
85+
df, metadata = waterdata.get_daily(
8786
monitoring_location_id=["USGS-13018750","USGS-13013650"],
8887
parameter_code='00060',
8988
time='2024-10-01/..'
9089
)
9190

92-
print(f"Retrieved {len(daily_twosites)} records")
91+
print(f"Retrieved {len(df)} records")
9392
```
94-
The following example downloads location information for all monitoring
95-
locations that are categorized as stream sites in the state of Maryland:
93+
Retrieving location information for all monitoring locations categorized as
94+
stream sites in the state of Maryland:
9695

9796
```python
9897
# Get monitoring location information
99-
locations, metadata = waterdata.get_monitoring_locations(
98+
df, metadata = waterdata.get_monitoring_locations(
10099
state_name='Maryland',
101100
site_type_code='ST' # Stream sites
102101
)
103102

104-
print(f"Found {len(locations)} stream monitoring locations in Maryland")
103+
print(f"Found {len(df)} stream monitoring locations in Maryland")
105104
```
106-
Finally, this example downloads continuous (a.k.a. "instantaneous") data
107-
for one monitoring location over one year. You are *strongly advised* to
108-
break up continuous data requests into smaller time periods and smaller
109-
collections of sites to avoid timeouts and other issues:
105+
Finally, retrieving continuous (a.k.a. "instantaneous") data
106+
for one location. We *strongly advise* breaking up continuous data requests into smaller time periods and collections to avoid timeouts and other issues:
110107

111108
```python
112109
# Get continuous data for a single monitoring location and water year
113-
continuous, metadata = waterdata.get_continuous(
110+
df, metadata = waterdata.get_continuous(
114111
monitoring_location_id='USGS-01646500',
115112
parameter_code='00065', # Gage height
116113
time='2024-10-01/2025-09-30'
117114
)
118-
print(f"Retrieved {len(continuous)} continuous gage height measurements")
115+
print(f"Retrieved {len(df)} continuous gage height measurements")
119116
```
120117

121118
Visit the

dataretrieval/waterdata/api.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,22 @@ def get_continuous(
220220
limit: Optional[int] = None,
221221
convert_type: bool = True,
222222
) -> Tuple[pd.DataFrame, BaseMetadata]:
223-
"""This is an early version of the continuous endpoint. It is
224-
feature-complete and provides access to the full continuous data record,
225-
and is being made available as we continue to work on performance
226-
improvements. Geometries are not included with the continuous endpoint.
227-
228-
Continuous data are collected via automated sensors
229-
installed at a monitoring location. They are collected at a high
230-
frequency and often at a fixed 15-minute interval. Depending on the
231-
specific monitoring location, the data may be transmitted automatically
232-
via telemetry and be available on WDFN within minutes of collection,
233-
while other times the delivery of data may be delayed if the monitoring
234-
location does not have the capacity to automatically transmit data.
235-
Continuous data are described by parameter name and parameter code
236-
(pcode). These data might also be referred to as "instantaneous values"
237-
or "IV".
223+
"""
224+
Continuous data provide instantanous water conditions.
238225
226+
This is an early version of the continuous endpoint that is feature-complete
227+
and is being made available for limited use. Geometries are not included
228+
with the continuous endpoint.
229+
230+
Continuous data are collected at a high frequency, typically 15-minute
231+
intervals. Depending on the specific monitoring location, the data may be
232+
transmitted automatically via telemetry and be available on WDFN within
233+
minutes of collection, while other times the delivery of data may be delayed
234+
if the monitoring location does not have the capacity to automatically
235+
transmit data. Continuous data are described by parameter name and
236+
parameter code (pcode). These data might also be referred to as
237+
"instantaneous values" or "IV".
238+
239239
Parameters
240240
----------
241241
monitoring_location_id : string or list of strings, optional

0 commit comments

Comments
 (0)