-
Notifications
You must be signed in to change notification settings - Fork 6
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
Tech 182 python sdk users want an example with historic monthly data #37
Tech 182 python sdk users want an example with historic monthly data #37
Conversation
…used to pull lat/long/duration
…ly temporary until the SDK can automatically call the specific month in the array to complete the requests.
…ples, as it'll be similar to the above.
Removed due to not necessary for required task.
Remove as not necessary to provide example of multi month request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be all that is changed within the pull request.
Did not include an example table as it should be the same as the file above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense but one issue i can see is that you might get more than 356 days, i.e. 31 * 11 get you to 341, so the last iteration would add 31 to that giving you 372 days. Not a problem at this point but could lead to errors if those extra days were in live/forecast range.
However cant think of a simple solution for you as duration forces each request to be that length.
…-monthly-data' of https://github.com/billy-solcast/solcast-api-python-sdk into TECH-182-python-sdk-users-want-an-example-with-historic-monthly-data
…eading structure.
start_dates = pd.date_range(start=start_date, periods=12, freq='MS') | ||
|
||
for start in start_dates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I liked about your previous implementation with while loop, is that it did not require the user to think up front about how the queries should be chunked.
The following version of the former while code will only get the exact number of days required (including getting all of the final day).
step = 31
while days < days_required:
chunk_start = start + pd.DateOffset(days=days)
duration_days = min(step, days_required - days + 1)
res = historic.radiation_and_weather(latitude=-33.856784, longitude=151.215297, start=chunk_start, duration=f'P{duration_days}D')
responses.append(res)
days += step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was updated as a solution to @Zempire's comment:
#37 (review)
I think it's a cleaner way to pull the data, if the final objective is to retrieve only one years worth of data.
Updated example historic request to include multi period request