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

Optionally include additional metadata with nwis_client get requests #214

Merged
merged 6 commits into from
May 19, 2023

Conversation

jarq6c
Copy link
Collaborator

@jarq6c jarq6c commented May 10, 2023

This PR adds an include_expanded_metadata switch to nwis_client.iv.IVDataService.get. This is a boolean switch that adds the following columns to the resulting dataframe: ['siteName', 'srs', 'latitude', 'longitude', 'siteTypeCd', 'hucCd', 'countyCd', 'stateCd']. These data were always present in the raw json, but were previously ignored. This addition should benefit any geospatial applications.

Additions

  • New include_expanded_metadata parameter. Default is set to False.

Removals

  • Removed infer_datetime option per pandas``UserWarning from datetime conversions.

Changes

  • No change in overall behavior.

Testing

  1. Added two new tests for get_raw and get using the new parameter.

Notes

Todos

Checklist

  • PR has an informative and human-readable title
  • PR is well outlined and documented. See #12 for an example
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (see CONTRIBUTING.md)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output) using numpy docstring formatting
  • Placeholder code is flagged / future todos are captured in comments
  • Reviewers requested with the Reviewers tool ➡️

@jarq6c jarq6c requested a review from aaraney May 10, 2023 19:52
@jarq6c jarq6c changed the title Expand meta Optionally include additional metadata with nwis_client get requests May 10, 2023
@jarq6c
Copy link
Collaborator Author

jarq6c commented May 10, 2023

Appears 3.7 error is unrelated.

Edit: 3.7 is EOL in 2023-06-27. Should probably drop it and add 3.10.

Copy link
Member

@aaraney aaraney left a comment

Choose a reason for hiding this comment

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

Thanks for introducing this, @jarq6c! The code looks good to me, I really only have a question and I think we can get this on its way.

For the added optional columns, what are your thoughts on using camelcase and expanding abbreviations in their names? My thinking is to preserve naming conventions from the hydrotools canonical format. Here are the transformations I am thinking:

siteTypeCd -> site_type_code
hucCd -> huc_code
countyCd -> county_code
stateCd -> state_code
siteName -> site_name
srs

Thoughts?

@jarq6c
Copy link
Collaborator Author

jarq6c commented May 19, 2023

Agreed and updated column names.

Copy link
Member

@aaraney aaraney left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes, @jarq6c! This looks good to me!

@aaraney aaraney merged commit ff98895 into NOAA-OWP:main May 19, 2023
@jarq6c jarq6c deleted the expand-meta branch May 19, 2023 16:19
@jarq6c
Copy link
Collaborator Author

jarq6c commented May 19, 2023

Deployed:
https://pypi.org/project/hydrotools.nwis-client/3.3.1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants