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

Create a check for if an object is a JSON or NWIS Response object in extract_nwis_df #37

Closed
nkorinek opened this issue Feb 13, 2019 · 6 comments

Comments

@nkorinek
Copy link
Contributor

Not an issue, just a recommendation! Recently, hydrofunctions extract_nwis_df changed to accept a JSON of a response instead of the raw response object. The line to turn the response to a JSON is still in the code, but commented out. It would possibly easier to use the function if it took either a JSON or a raw response. A simple type check at the top should make that doable. Something like:

if type(nwis_dict) is not dict:
    nwis_dict = nwis_dict.json()

Just a thought!

@mroberge
Copy link
Owner

This sounds good to me.
Do you want me to make the change, or do you want to try your hand at a pull request?

  • fork hydrofunctions (or update the fork you already have)
  • create a new branch off of Develop
  • make your edits & reference this issue in your commit message
  • Add some tests!
    • try running the tests I already set up (type python setup.py test from the same directory as the setup.py file)
    • copy a test that already exists, but feed it a dict and check that it still extracts a dataframe
    • create another test and feed it a fake response object. check that it still extracts a dataframe
  • submit your pull request!

@nkorinek
Copy link
Contributor Author

I'll try it out and see how it goes!

@mroberge
Copy link
Owner

Great! @nkorinek

One thing that most people don't seem to know about is that you can submit your pull request almost immediately after creating your new branch. You don't have to wait until you've actually added any new code. Most people like to wait until everything is perfect, but the problem with that is that nobody knows that you are working on something, so you can get duplication. Think of two outfielders in baseball going for the same fly ball. They start talking to each other BEFORE they catch the ball, so they don't both try to catch it, or both assume the other person has it... (sportsball analogies aren't my personal strength)

Also, if you submit the PR right away, I can give you suggestions if you get stuck on something.

Good luck!
-Marty

@nkorinek
Copy link
Contributor Author

Sounds good! I'll open that up as soon as possible, probably over the weekend sometime.

mroberge added a commit that referenced this issue Feb 19, 2019
This closes issue #37.
Added a test too.
@nkorinek
@mroberge
Copy link
Owner

mroberge commented Feb 19, 2019

Closed with cf10f95.

@nkorinek
Copy link
Contributor Author

Thanks @mroberge, sorry I didn't get a chance to work on it!

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

No branches or pull requests

2 participants