Skip to content

make new PSM reader for iotools #592

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

Closed
mikofski opened this issue Sep 22, 2018 · 1 comment · Fixed by #694
Closed

make new PSM reader for iotools #592

mikofski opened this issue Sep 22, 2018 · 1 comment · Fixed by #694

Comments

@mikofski
Copy link
Member

mikofski commented Sep 22, 2018

Problem:
This new API is not trivial I think I was able to download data once, but it wasn't immediately intuitive to me.

Proposal:
Given a user's NREL API key, they can get PSM data and use it for weather and solar resource

Alternatives
just figure it out myself, then maybe an iotool to consume whatever is downloaded

Additional context
nrel psm api v2
new nsrdbsource
download instructions
related to #272

@cwhanse
Copy link
Member

cwhanse commented Sep 22, 2018

Maybe not simpler, but SAM has automated download of NSRDB data, and once we can access SAM methods from pvlib, we could leverage the SAM capability. That offloads maintaining the connection to the NSRDB websource onto NREL.

mikofski added a commit to mikofski/pvlib-python that referenced this issue Apr 26, 2019
@mikofski mikofski mentioned this issue Apr 26, 2019
8 tasks
wholmgren pushed a commit that referenced this issue May 3, 2019
* Create psm3.py

initial concept for psm3 reader

* fix well known text for geometric POINT

* need to strip all leading whitespace, and only one whitespace between,
and longitude is first, then latitude
* fix list() not []
* fix ATTRIBUTES and URL
* coerce all to float, clean up types in header, cast datevec columns to
int, create datetimeindex from datevec columns, set index, get errors
from json when returning HTTPError

Signed-off-by: Mark Mikofski <[email protected]>

* TST: add test for getting psm3

* update docs, closes #592

* stickler, default interval

* add psm3 to api

* use astype, fix typos, change param names to match API

* use pandas, better variable names, comments, set all dtypes

* stickler fixes

* api_key as param

* TST: decorate test_get_psm3 with needs_pandas_0_22

* api_key and email are required according to NREL

* other params full name and affiliation are kwargs
* set reason to pvlib something as suggested by NREL
* catch some errors, like 403 forbidden, are in content, not json, only
some errors like bad well known text WKT gemetry are in JSON
* use python-2 json decode error
* add another test to capture both bad API key and bad WKT
* add note on how to register for key, why they need email, and when it
would be used, and warning about DEMO_KEY being rate limited

Signed-off-by: Mark Mikofski <[email protected]>

* stickler: remove unused JSON import

* remove non-ASCII quotation marks around DEMO_KEY in warning

* remove "required" for api_key param in get_psm3

Co-Authored-By: mikofski <[email protected]>

* rewording for "email" param in get_psm3

Co-Authored-By: mikofski <[email protected]>

* clarify WKT formating and errors

* in raise docstring, change "returns" to "raises", and clarify that
 either r.json()['errors'] or r.content is the exception arg depending
 on the type of HTTP error, and give examples
* add warning in docstring that data are limited to NSRDB locations
* comment on WKT formatting and add TODO to consider making a
 format_WKT() function in tools.py one day
* add response kwarg to HTTPError for better user exception handling
* in test_psm3 add comments to clarify the tests for errors and add two
 more test for bad "names" and interval args

* DOC: defaults in argtype for get_psm3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants