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

Add Forecast Class #68

Merged
merged 24 commits into from Mar 3, 2022
Merged

Add Forecast Class #68

merged 24 commits into from Mar 3, 2022

Conversation

lymanepp
Copy link
Collaborator

@lymanepp lymanepp commented Feb 24, 2022

Added Forecast class to retrieve layer values for a given point in time
Change daily and hourly APIs to match the "all" API
Use Python relative import statements
Fix pytest warnings

Closes #66

@lymanepp
Copy link
Collaborator Author

lymanepp commented Feb 24, 2022

I'm done changing things until I get feedback from @MatthewFlamm

Edit: I've spent some more time thinking about this and committed some changes. Would like to get feedback.

pytest.ini Outdated Show resolved Hide resolved
@lymanepp
Copy link
Collaborator Author

lymanepp commented Feb 25, 2022

Breaking and unrelated changes have been reverted

Copy link
Owner

@MatthewFlamm MatthewFlamm left a comment

Choose a reason for hiding this comment

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

I haven't done a very thorough review yet, but this is looking really nice!

pynws/backports/enum.py Show resolved Hide resolved
pynws/forecast.py Show resolved Hide resolved
pynws/forecast.py Outdated Show resolved Hide resolved
"""When the forecast was last updated"""
return self.update_time

def get_forecast_for_time(self, when):
Copy link
Owner

Choose a reason for hiding this comment

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

Can we have a separate method to get the value of only one layer?

Copy link
Owner

Choose a reason for hiding this comment

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

Does it make sense to allow when to be an Iterable too, like a list? A future implementation could have an additional method to automatically generate an hourly forecast for x days or hours.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we have a separate method to get the value of only one layer?

One of my iterations worked that way. I will add a method for that.

Copy link
Owner

Choose a reason for hiding this comment

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

Having both makes sense to me

Copy link
Collaborator Author

@lymanepp lymanepp Feb 26, 2022

Choose a reason for hiding this comment

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

Does it make sense to allow when to be an Iterable too, like a list? A future implementation could have an additional method to automatically generate an hourly forecast for x days or hours.

  1. Are you thinking that 'when' could contain a list of datetime values?
  2. I like the idea of generating N forecast values for hours or days. That could replace the original gridpoint hourly and daily forecasts which could eliminate a lot of code.

Copy link
Owner

Choose a reason for hiding this comment

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

  1. Are you thinking that 'when' could contain a list of datetime values?

Yes.

  1. I like the idea of generating N forecast values for hours or days. That could replace the original gridpoint hourly and daily forecasts which could eliminate a lot of code.

I think it should be a parallel option. The daily endpoint in particular has a nice human readable forecast.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Are you thinking that 'when' could contain a list of datetime values?

Yes.

It would probably be better to have a separate method for that because the return value would have a different shape (like the output from the next item)

  1. I like the idea of generating N forecast values for hours or days. That could replace the original gridpoint hourly and daily forecasts which could eliminate a lot of code.

I think it should be a parallel option. The daily endpoint in particular has a nice human readable forecast.

Fair point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it make sense to allow when to be an Iterable too, like a list? A future implementation could have an additional method to automatically generate an hourly forecast for x days or hours.

These have both been added (for X hours--not days)

@lymanepp
Copy link
Collaborator Author

@MatthewFlamm All requested changes have been made. Please let me know if there's anything else you'd like to have changed.

@MatthewFlamm
Copy link
Owner

I read through this again, and I'm happy with it. Great job and thanks!

@MatthewFlamm MatthewFlamm changed the title API refactoring Add Forecast Class Mar 3, 2022
@MatthewFlamm MatthewFlamm merged commit 639c8f0 into MatthewFlamm:master Mar 3, 2022
@lymanepp lymanepp deleted the api-refactor branch March 3, 2022 01:19
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.

Retrieve any forecast layer for arbitrary datetimes
2 participants