-
Notifications
You must be signed in to change notification settings - Fork 52
Add waterdata infrastructure #183
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t page not downloading, start to add more function outlines
agilmore2
reviewed
Sep 25, 2025
|
Understood, thanks! I was pulling it out of an environment variable myself
and expecting to set it in the retrieval functions, but the functions
pulling it themselves also works.
I appreciate your hard work on these!
…On Thu, Sep 25, 2025, 08:25 Elise Hinman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In dataretrieval/waterdata.py
<#183 (comment)>
:
> + parameter_code: Optional[Union[str, List[str]]] = None,
+ statistic_id: Optional[Union[str, List[str]]] = None,
+ properties: Optional[List[str]] = None,
+ time_series_id: Optional[Union[str, List[str]]] = None,
+ daily_id: Optional[Union[str, List[str]]] = None,
+ approval_status: Optional[Union[str, List[str]]] = None,
+ unit_of_measure: Optional[Union[str, List[str]]] = None,
+ qualifier: Optional[Union[str, List[str]]] = None,
+ value: Optional[Union[str, List[str]]] = None,
+ last_modified: Optional[str] = None,
+ skipGeometry: Optional[bool] = None,
+ time: Optional[Union[str, List[str]]] = None,
+ bbox: Optional[List[float]] = None,
+ limit: Optional[int] = None,
+ max_results: Optional[int] = None,
+ convertType: bool = True
I will add documentation about this (still learning the details myself),
but your API key should be passed as a header if it exists as an
environment variable. This is the line used to grab the api key in one of
the helper functions:
token = os.getenv("API_USGS_PAT")
So you'll want to get your API key, and then set it using:
os.environ["API_USGS_PAT"] = "<your key>"
You may need to restart your session to get it to "register".
—
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUI5SVU5QEID6FDYDBVEHL3UP3M7AVCNFSM6AAAAACHAHDID6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTENRYGA2DAOBUHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
I see that in _default_headers()
Thanks!
…On Thu, Sep 25, 2025 at 8:32 AM Elise Hinman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In dataretrieval/waterdata.py
<#183 (comment)>
:
> + parameter_code: Optional[Union[str, List[str]]] = None,
+ statistic_id: Optional[Union[str, List[str]]] = None,
+ properties: Optional[List[str]] = None,
+ time_series_id: Optional[Union[str, List[str]]] = None,
+ daily_id: Optional[Union[str, List[str]]] = None,
+ approval_status: Optional[Union[str, List[str]]] = None,
+ unit_of_measure: Optional[Union[str, List[str]]] = None,
+ qualifier: Optional[Union[str, List[str]]] = None,
+ value: Optional[Union[str, List[str]]] = None,
+ last_modified: Optional[str] = None,
+ skipGeometry: Optional[bool] = None,
+ time: Optional[Union[str, List[str]]] = None,
+ bbox: Optional[List[float]] = None,
+ limit: Optional[int] = None,
+ max_results: Optional[int] = None,
+ convertType: bool = True
And to be clear: all you need to do is have your key in your environment,
you don't need to "set it" in the functions anywhere.
—
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUI5SSOIKUSVNDVU3D7QVD3UP4IXAVCNFSM6AAAAACHAHDID6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTENRYGA4DINBSGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
… knows when they will receive a pandas df
Waterdata revisions
…and documented before adding
Collaborator
Author
|
I think this is ready to merge into develop. Do you agree/approve @thodson-usgs and @jzemmels? |
thodson-usgs
approved these changes
Nov 24, 2025
Collaborator
thodson-usgs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had two suggestions, but I approve these changes. Nice work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will add access to the new water data APIs via the
waterdatamodule.9/26/25: Added some updates to the README.md about the new module and API keys. Ready for testing and review.
EOD 9/25/25:
qualifieris a tricky argument and product owner suggests against using it as an argument unless you're really confident and restrictive about what you want: it can be a list of multiple qualifiers and if you just pick one qualifier value, it will only match rows with JUST that one. Default is to return a geopandas dataframe when geometry are returned, but because geopandas is an optional dependency, functions will return pandas dataframes if geopandas is not available. Unit tests have been created, with opportunities for more. I'd say the functions are ready for testing. I need to add in some info on the new functions in the README, etc.9/25/25: POST calls using the CQL2 query language appear to be working, and documentation for the functions has been added. I'm noticing some inconsistencies in some of the input parameters like
qualifierthat still need to be addressed/parsed. I also need to create unit tests and I'd like to have the functions return a geopandas dataframe whenskipGeometry=False.9/19/25: It is currently a work in progress that appears to work for GET calls in which the user requests one parameter (e.g. one site, one pcode, etc.) at a time. Still working out the POST calls in which a user may request multiple parameters (e.g. data from multiple sites, with multiple pcodes), which requires the use of the CQL2 query language. Stay tuned.