-
Notifications
You must be signed in to change notification settings - Fork 21
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 pvdaq reference sites, fetch, config #438
Conversation
@alorenzo175 @lboeman I found this existing code for conforming to an index: solarforecastarbiter-core/solarforecastarbiter/io/reference_observations/common.py Lines 309 to 315 in 642fad0
Can we change that to data_resampled = data.resample(observation.interval_length).first()
new_index = pd.date_range(start=data.index[0], end=data.index[-1],
freq=observation.interval_length)
data = data_resampled.reindex(new_index) |
Hmm, and if interval label is ending? Seems like |
I was originally just trying to fix a problem with timestamps that need to be rounded to be on the right interval. Here are a couple of examples:
and
In the first case we could average or we could just discard. In the second case we want to round. If discarding is ok, then we can use But there are also two sites that report 15s data that we'll need to resample to 1 minute intervals (unless we want to support non integer interval_lengths in the API). |
Dumping data is ifne with me |
I'd like some feedback on the proposed pattern before implementing/fixing tests.
|
It's now working with the See this site for an example: https://dev-dashboard.solarforecastarbiter.org/observations/bfdb2b98-923f-11ea-bfa1-0a580a82013d?start=2020-04-01T22%3A00Z&end=2020-05-09T22%3A00Z Observations won't |
Looks like everything is working. There are a couple of sites on the dev dashboard that have the wrong AC/DC capacity since I hadn't yet fixed the W-->MW conversion when they were created, but they would be recreated correctly following a database wipe. It takes about 20 minutes to pull and post all of the 2020 data. About 75% of the time is in the post. |
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 looks good to me. I do like storing the sites as valid API schema. Maybe eventually we convert the full list to a json file with the format:
{ 'NETWORK': {
'sites': [ ... ],
'observations': [...], // optional
},
'NETWORK 2': {...}
}
Then we can have a set of required extra_parameters
, and special cases can be added without needing to update the whole list. Not suggesting this should happen here, but just thinking ahead a little.
start : datetime | ||
The beginning of the period to request data for. | ||
end : datetime | ||
The end of the period to request data for. |
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.
nrel_pvdaq_api_key
here
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.
I'm good with the approach. Needs tests for common and resample_how
and fetch/pvdaq at least.
# Each year must queries separately, so iterate over the years and | ||
# generate a list of dataframes. | ||
# Consider putting this loop in its own private function with | ||
# try / except / try again pattern for network issues and NREL API |
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.
will we see any issues from this?
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.
The pvlib CI struggled with a different NREL API but I haven't run into any with the pvdaq API. They have a 1000 requests per hour limit but we are no where close to that. Let's see if it's a problem in the rc cycle.
Co-authored-by: Tony Lorenzo <[email protected]>
@alorenzo175 tests pass, coverage is almost 100%, so I think we're close. The mocks grew more aggressive as the hour grew later, but I think they're consistent with other modules. |
docs/source/api.rst
for API changes.docs/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).Additional To do:
get_pvdaq_data
function is based on pvlib/pvlib-python#664It takes about 3 minutes to pull all of the 2020 data.