Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust gwlevels URL services #147

Merged
merged 7 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions dataretrieval/nwis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
PARAMCODES_URL = 'https://help.waterdata.usgs.gov/code/parameter_cd_nm_query?'
ALLPARAMCODES_URL = 'https://help.waterdata.usgs.gov/code/parameter_cd_query?'

WATERSERVICES_SERVICES = ['dv', 'iv', 'site', 'stat', 'gwlevels']
WATERSERVICES_SERVICES = ['dv', 'iv', 'site', 'stat']
WATERDATA_SERVICES = [
'qwdata',
'gwlevels',
'measurements',
'peaks',
'pmcodes',
Expand Down Expand Up @@ -429,17 +430,28 @@ def get_gwlevels(
.. doctest::

>>> # Get groundwater levels for site 434400121275801
>>> df, md = dataretrieval.nwis.get_gwlevels(sites='434400121275801')
>>> df, md = dataretrieval.nwis.get_gwlevels(site_no='434400121275801')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you decide to break the API? sites -> site_no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see later you catch sites and pass them to site_no. In that case, I might keep sites as the recommended parameter.

ehinman marked this conversation as resolved.
Show resolved Hide resolved

"""
_check_sites_value_types(sites)

kwargs['startDT'] = kwargs.pop('startDT', start)
kwargs['endDT'] = kwargs.pop('endDT', end)
kwargs['sites'] = kwargs.pop('sites', sites)
# Make kwargs backwards compatible with waterservices
# vocabulary
if 'startDT' in kwargs:
kwargs['begin_date'] = kwargs.pop('startDT')
if 'endDT' in kwargs:
kwargs['end_date'] = kwargs.pop('endDT')
if 'sites' in kwargs:
kwargs['site_no'] = kwargs.pop('sites')
if 'stateCd'in kwargs:
kwargs['state_cd'] = kwargs.pop('stateCd')

kwargs['begin_date'] = kwargs.pop('begin_date', start)
kwargs['end_date'] = kwargs.pop('end_date', end)
kwargs['site_no'] = kwargs.pop('site_no', sites)
kwargs['multi_index'] = multi_index

response = query_waterservices('gwlevels', ssl_check=ssl_check, **kwargs)
response = query_waterdata('gwlevels', format = 'rdb', ssl_check=ssl_check, **kwargs)

df = _read_rdb(response.text)

Expand Down
Loading
Loading