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 -- Updated #135

Merged
merged 9 commits into from Sep 9, 2021

Conversation

jarq6c
Copy link
Collaborator

@jarq6c jarq6c commented Sep 9, 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

Addenda: Updates empty dataframe method to return a non-canonical dataframe if specified by the user. Necessary for #117

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

@jarq6c jarq6c self-assigned this Sep 9, 2021
@jarq6c jarq6c merged commit 9ed026b into NOAA-OWP:main Sep 9, 2021
@jarq6c jarq6c deleted the fix-#133 branch November 8, 2021 20:57
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