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

fix nwis_client bug causing KeyError when station does not return data #134

Merged
merged 7 commits into from
Sep 9, 2021

Conversation

aaraney
Copy link
Member

@aaraney aaraney commented Sep 3, 2021

See #133 for the bug report. This PR resolves #133. Now, when a station does not have data, nwis_client returns a canonical dataframe with the correct data types to the user. Additionally, the user is warned that the request did not return data.

fixes #133

Additions

  • canonical dataframe helper "private" method. This may be helpful for writing tests in the future/ asserting that dataframes comply with the standard. (see _create_empty_canonical_df)

Removals

Changes

  • nwis_client.get returns a canonical dataframe with the correct data types in cases when no data is retrieved from nwis.

Testing

  1. test_get_returns_empty_canonical_dataframe added. Uses mock to verify a canonical dataframe is returned.

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 ➡️

Copy link
Collaborator

@jarq6c jarq6c left a comment

Choose a reason for hiding this comment

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

Looks good. Just one comment for discussion.

@jarq6c jarq6c merged commit b12a305 into NOAA-OWP:main Sep 9, 2021
@jarq6c
Copy link
Collaborator

jarq6c commented Sep 9, 2021

Merged with #135

@aaraney
Copy link
Member Author

aaraney commented Sep 9, 2021

Awesome, thanks for merging these changes and redeploying!

@aaraney aaraney deleted the fix-#133 branch May 19, 2023 01:24
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.

Error in calling the nwis function for some of the catchments/station numbers
2 participants