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.0.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.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyNSRDB-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 7ef26988a21877b6e1185c430cec0c8869447095693c5c3aa194a4480a305915
MD5 2b0d630e0c80bda6c685d85ea93af863
BLAKE2b-256 20bd76429ead3ab6dc4584b3530d2b35a696016d0f5d0370bd36a70b6cec4a69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyNSRDB-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33c7636ca4cac56dba334fde4cf0bc7e5d2d35efb4a5156334b4ca1b01745c6c
MD5 f60d3878f5cafbb8e0a636441682516e
BLAKE2b-256 d8fff963868dcfcb010fc40ddee654a897ec6f91edd1dc48c098bef71e6f7e31

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