Skip to main content

Python frontend to NREL NSRDB API.

Project description

pyNRSDB

Community-created functional Python interface for the National Solar Radiation Database (NSRDB) API from the National Renewable Energy Laboratory (NREL).

Simplifies requests to API and automates processing of response data in CSV and Zip file formats.

Getting Started

pyNSRDB can be installed from PyPI for general use.

pip install pyNSRDB

For requests to the NSRDB, you must obtain a personal API key from https://developer.nrel.gov/signup/ before use. The API key must be included with each request submitted through pyNSRDB. You can supply the API key and email with each pyNSRDB request function or set-up an .pyNSRDB credential file that is automatically included with requests.

The credential file should be placed in the user's home directory (e.g. C:\Users\%USERNAME%\\.pyNRSDB for Windows and \home\%USERNAME%\\.pyNSRDB for Linux, Mac) Entries for API_KEY and EMAIL are required, but all entires are encouraged

API_KEY=%YOURAPIKEY%
FULL_NAME=%YOURNAME%
EMAIL=%YOUREMAIL%
AFFILIATION=%AFFILIATION%
REASON=%REASONFORUSE%
MAILING_LIST=true

Examples

The simplest requests can be made for single longitude, latitude points.

>>> from pyNSRDB.requests import PSM_TMY_request
>>> location = (-93.1567288182409, 45.15793882400205)
>>> data = PSM_TMY_request(location)
>>> data.head()
   Year  Month  Day  Hour  Minute  Dew Point  DHI  DNI  GHI  Surface Albedo  Pressure  Temperature  Wind Direction  Wind Speed
0  2004      1    1     0      30      -14.0    0    0    0            0.87       980         -9.0             141         2.5
1  2004      1    1     1      30      -13.0    0    0    0            0.87       980         -9.0             140         2.9
2  2004      1    1     2      30      -13.0    0    0    0            0.87       980         -9.0             135         3.3
3  2004      1    1     3      30      -13.0    0    0    0            0.87       980         -9.0             130         3.7
4  2004      1    1     4      30      -12.0    0    0    0            0.87       980         -8.0             120         4.0

More complicated geographical locations can be constructed using the shapely library to define WKT-compatible geometric shapes.

>>> from shapely.geometry import MultiPoint
>>> location = MultiPoint(((-90, 45), (-88, 43)))
>>> data = PSM_TMY_request(location)
>>> data.head()
   Year  Month  Day  Hour  Minute  Dew Point  DHI  DNI  GHI  Surface Albedo  Pressure  Temperature  Wind Direction  Wind Speed
0  2008      1    1     0      30      -14.0    0    0    0            0.87       960        -13.0             316         4.1
1  2008      1    1     1      30      -16.0    0    0    0            0.87       960        -14.0             316         4.2
2  2008      1    1     2      30      -17.0    0    0    0            0.87       960        -15.0             316         4.3
3  2008      1    1     3      30      -18.0    0    0    0            0.87       960        -16.0             316         4.4
4  2008      1    1     4      30      -19.0    0    0    0            0.87       960        -17.0             316         4.5

Additional information on NSRDB

NSRDB Site: https://nsrdb.nrel.gov/

NSRDB API Documentation: https://nsrdb.nrel.gov/data-sets/api-instructions.html

References:

[1] M. Sengupta, Y. Xie, A. Lopez, A. Habte, G. Maclaurin, and J. Shelby, “The National Solar Radiation Data Base (NSRDB),” Renewable and Sustainable Energy Reviews, vol. 89, pp. 51–60, Jun. 2018, doi: 10.1016/j.rser.2018.03.003.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyNSRDB-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyNSRDB-0.1.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file pyNSRDB-0.1.1.tar.gz.

File metadata

  • Download URL: pyNSRDB-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for pyNSRDB-0.1.1.tar.gz
Algorithm Hash digest
SHA256 07137a5503f109e2ec7b83dc2d8c1148193e653a67aa313b8cd7ec671a342900
MD5 eb3d06d5809b08bcb9962c44b6d528c7
BLAKE2b-256 865c0936eac60c9b918b5c2a94fc0fbd5ecd864e9165269746e44ce8eb17c1d4

See more details on using hashes here.

File details

Details for the file pyNSRDB-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyNSRDB-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for pyNSRDB-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e227066eeb924623098d114b46a4ccc68d2e59dfd76bde7203337ea14566eb4
MD5 4a4ee38d638e83c2233833a74f0996b6
BLAKE2b-256 4e8a1ac4fb0ad22186b64a13c643c41f965bb5a210e8fae37c25cce373289e2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page