-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add get_srml iotools function; deprecate read_srml_month_from_solardat #1779
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
Changes from 1 commit
f4e8248
15f6d4c
0f83b2e
8f14cb8
b09144f
7057ede
2b5c39b
d689a14
e85ddf7
48b6310
a308cda
1830b03
a1b3922
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
""" | ||
import numpy as np | ||
import pandas as pd | ||
import requests | ||
import urllib | ||
import warnings | ||
|
||
|
||
|
@@ -28,8 +28,9 @@ | |
|
||
def read_srml(filename, map_variables=True): | ||
""" | ||
Read University of Oregon SRML 1min .tsv file into pandas dataframe. The | ||
SRML is described in [1]_. | ||
Read University of Oregon SRML 1min .tsv file into pandas dataframe. | ||
|
||
The SRML is described in [1]_. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -172,8 +173,9 @@ def format_index(df): | |
|
||
def read_srml_month_from_solardat(station, year, month, filetype='PO', | ||
map_variables=True): | ||
"""Request a month of SRML data from solardat and read it into | ||
a Dataframe. The SRML is described in [1]_. | ||
"""Request a month of SRML data and read it into a Dataframe. | ||
|
||
The SRML is described in [1]_. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -297,7 +299,7 @@ def get_srml(station, start, end, filetype='PO', map_variables=True, | |
try: | ||
dfi = read_srml(url + f, map_variables=map_variables) | ||
dfs.append(dfi) | ||
except requests.HTTPError: | ||
except urllib.error.HTTPError: | ||
warnings.warn(f"The following file was not found: {f}") | ||
|
||
data = pd.concat(dfs, axis='rows') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about following this with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not opposed to this suggestion, although we may run into some issues related to timezone. I think this is why the There already exist several functions in pvlib that return a full month when requesting a single day btw, e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, that's a good point. Up to you on what is best here. If we keep the current behavior of returning complete months, might be worth a note in the docstring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This sounds right. And a complicating factor for SRML was nighttime 0s in the future if we requested a day from the current month. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's a raw data file for the current month that shows -999 and similar for future dates. Here's a raw data file that includes -999 and similar as well as 0s This caused a problem in SFA SolarArbiter/solarforecastarbiter-core#572 and it's reasonable to expect that it would cause a problem with other user code. I don't know if that's pvlib's problem to solve, but I think it's somewhat more likely to come up with this new function that accepts datetimes instead of entire months. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see how the new function makes this more of an issue, currently, I would still request the same months with the old function, but it would just be more manual work. I do think that it deserves a Warning entry and perhaps we can also implement a line that cuts off future data? For example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think many users would have different expectations of the new function that accepts start, end datetimes than the old function that accepts a year and a month. Thanks for adding the warning. I'd rather see the previously rejected start:end slicing than .today() slicing. I'm also fine with just adding the warning and seeing if users complain. |
||
|
Uh oh!
There was an error while loading. Please reload this page.