-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
pvdaq io functions #664
base: main
Are you sure you want to change the base?
pvdaq io functions #664
Conversation
I will fix the lint errors. Other suggestions on what to complete before this can be merged are appreciated. Thanks! |
Also, this function relies on |
Maybe take a quick look at the other |
Thanks @bmeyers! I think Please add Have you considered any simple methods for testing? It's not necessary to test the live connection, but it's good to assert that the format is read in the way you expect it to be on a very short file. The progress bar is interesting. Do you know how it behaves in the different environments that are often used by pvlib community (python terminal, ipython terminal, notebooks, scripts w/ w/o logging)? |
The |
@wholmgren: The progress bar has been tested in python terminal, ipython terminal, notebooks, and with scripts. My understanding is that server logs will capture the output from the Should I add the @cwhanse: |
…progress bar is not overwritten by a later print statement in a user script. Also added an if __name__ == "__main__" block for testing purposes
The resampling part of What's the advantage of the For testing, we'd want a |
Hi Will, you're right, I should have made the usage of The 10-4 on testing. |
Hopefully the discussion below is more clear. The first part of your function contains these lines to create a # convert index to timeseries
try:
df[datetimekey] = pd.to_datetime(df[datetimekey])
df.set_index('Date-Time', inplace=True)
except KeyError:
time_cols = [col for col in df.columns
if np.logical_or('Time' in col, 'time' in col)]
key = time_cols[0]
df[datetimekey] = pd.to_datetime(df[key])
df.set_index(datetimekey, inplace=True) The first part of the
Here are links to all of the datetime parsing code in midc It seems to me that the answer to question 1 is "not at this point". I don't yet know the answer to 2, but I think writing generic parsing code is hard!
No problem. I think that's the right way to do it. I think the 2nd half of the function merits its own function that assumes a Series/DataFrame that already has a |
years will be concatenated into a single data frame | ||
delim: string | ||
The deliminator used in the CSV file being requested | ||
|
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.
Does pvdaq ever use other delimiters?
|
||
|
||
def get_pvdaq_data(sysid=2, api_key='DEMO_KEY', year=2011, delim=',', | ||
standardize=True): |
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.
Suggest year before api_key
for item in req_params.items()] | ||
req_url = base_url + '&'.join(param_list) | ||
response = requests.get(req_url) | ||
if int(response.status_code) != 200: |
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.
How about raising an exception?
@@ -7,3 +7,4 @@ | |||
from pvlib.iotools.midc import read_midc_raw_data_from_nrel # noqa: F401 | |||
from pvlib.iotools.ecmwf_macc import read_ecmwf_macc # noqa: F401 | |||
from pvlib.iotools.ecmwf_macc import get_ecmwf_macc # noqa: F401 | |||
from pvlib.iotools.pvdaq import get_pvdaq_data |
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.
just append # noqa: F401
to tell stickler to ignore -- this is solely for the api
@bmeyers any update on this? There's renewed interest from @shirubana (Silvana @ NREL) 😁 |
@mikofski Sorry all for the lack of progress on my point. After PVSC abstracts get submitted, I'll pick this up again. I definitely want to get this completed. |
I implemented a couple of PVDAQ fetch functions over in our Solar Forecast Arbiter project: I based them on @bmeyers code but removed most of the I didn't find that the date/time key control was needed to handle the publicly accessible data. Perhaps it's needed for non-public data? I also wanted to control how I handled the resampling/reindexing based on my requirements, so I left that to my own function. For example, I wanted to resample sub 1 minute data into 1 minute data using Finally, while I'd like to return a localized I still think it would be great if the functionality ended up in pvlib in the long run. |
My vote would be to add the solar arbiter pvdaq implementation to iotools and close this PR. Usage is the best user story, pre-mature optimization is the killer (this PR case in point). I would rather see this in pvlib, observe usage, and have users create issues or discuss on groups/SO, and then we modify as needed, than not have it all or living in PR state indefinitely. |
docs/sphinx/source/api.rst
for API changes.docs/sphinx/source/whatsnew
file for all changes.Brief description of the problem and proposed solution (if not already fully described in the issue linked to above): Functions for making data requests to NREL's PVDAQ API. I'm using the year CSV file API, which is the most efficient way of obtaining multi-year, sub-hourly data.