Solar Dataset Query¶
Get information on the closest climate data for a given location
Let’s set our NREL API key, first.
[1]:
import os
from nrel_dev_api import set_nrel_api_key
from nrel_dev_api.solar import SolarDatasetQuery
# get and globally set API key
NREL_API_KEY = os.environ["DEMO_NREL_API_KEY"]
set_nrel_api_key(NREL_API_KEY)
Information on climate data for the location closest to the specified one. Here, we will search for Colorado.
[2]:
solar_dataset_query = SolarDatasetQuery(lat=40, lon=-105)
/home/docs/checkouts/readthedocs.org/user_builds/nrel-dev-api/envs/latest/lib/python3.9/site-packages/nrel_dev_api/_core.py:21: UserWarning: ['No intl data found for lat=40.0 lon=-105.0']
warnings.warn(message=str(content["warnings"]), category=UserWarning)
Outputs for the solar dataset are available under the outputs attribute.
[3]:
solar_dataset_query.outputs
[3]:
{'tmy2': {'id': '0-94018',
'city': 'BOULDER',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.13,
'lon': -105.24,
'elevation': 1689,
'distance': 24977},
'tmy3': {'id': '1-724699',
'city': 'BROOMFIELD/JEFFCO [BOULDER - SURFRAD]',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.13,
'lon': -105.24,
'elevation': 1689,
'distance': 24977},
'intl': None,
'nsrdb': {'id': '3-W105N040-W10502N4001',
'city': '',
'state': 'Colorado',
'country': None,
'lat': 40.01,
'lon': -105.02,
'distance': 2029,
'timezone': -7,
'elevation': 1582,
'resolution': 4}}
We can also get information about all the stations within a specified radius around a location.
[4]:
solar_dataset_query = SolarDatasetQuery(lat=40,
lon=-105,
radius=100,
return_all_stations=True
)
solar_dataset_query.outputs
[4]:
{'tmy2': {'id': '0-94018',
'city': 'BOULDER',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.13,
'lon': -105.24,
'elevation': 1689,
'distance': 24977},
'tmy3': {'id': '1-724699',
'city': 'BROOMFIELD/JEFFCO [BOULDER - SURFRAD]',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.13,
'lon': -105.24,
'elevation': 1689,
'distance': 24977},
'intl': None,
'nsrdb': {'id': '3-W105N040-W10502N4001',
'city': '',
'state': 'Colorado',
'country': None,
'lat': 40.01,
'lon': -105.02,
'distance': 2029,
'timezone': -7,
'elevation': 1582,
'resolution': 4},
'all_stations': [{'id': '3-W105N040-W10502N4001',
'city': '',
'state': 'Colorado',
'country': None,
'lat': 40.01,
'lon': -105.02,
'distance': 2029,
'timezone': -7,
'elevation': 1582,
'resolution': 4,
'dataset': 'nsrdb'},
{'id': '0-94018',
'city': 'BOULDER',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.13,
'lon': -105.24,
'elevation': 1689,
'distance': 24977,
'dataset': 'tmy2'},
{'id': '1-724699',
'city': 'BROOMFIELD/JEFFCO [BOULDER - SURFRAD]',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.13,
'lon': -105.24,
'elevation': 1689,
'distance': 24977,
'dataset': 'tmy3'},
{'id': '1-724666',
'city': 'DENVER/CENTENNIAL [GOLDEN - NREL]',
'state': 'COLORADO',
'timezone': -7,
'lat': 39.742,
'lon': -105.179,
'elevation': 1829,
'distance': 32650,
'dataset': 'tmy3'},
{'id': '1-725650',
'city': 'DENVER INTL AP',
'state': 'COLORADO',
'timezone': -7,
'lat': 39.833,
'lon': -104.65,
'elevation': 1650,
'distance': 35063,
'dataset': 'tmy3'},
{'id': '1-724695',
'city': 'AURORA BUCKLEY FIELD ANGB',
'state': 'COLORADO',
'timezone': -7,
'lat': 39.717,
'lon': -104.75,
'elevation': 1726,
'distance': 38143,
'dataset': 'tmy3'},
{'id': '1-724769',
'city': 'FORT COLLINS (AWOS)',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.45,
'lon': -105.017,
'elevation': 1529,
'distance': 50435,
'dataset': 'tmy3'},
{'id': '1-724768',
'city': 'GREELEY/WELD (AWOS)',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.433,
'lon': -104.633,
'elevation': 1420,
'distance': 57549,
'dataset': 'tmy3'},
{'id': '0-24018',
'city': 'CHEYENNE',
'state': 'WYOMING',
'timezone': -7,
'lat': 41.15,
'lon': -104.8,
'elevation': 1867,
'distance': 129897,
'dataset': 'tmy2'},
{'id': '1-725640',
'city': 'CHEYENNE MUNICIPAL ARPT',
'state': 'WYOMING',
'timezone': -7,
'lat': 41.15,
'lon': -104.8,
'elevation': 1867,
'distance': 129897,
'dataset': 'tmy3'},
{'id': '0-93037',
'city': 'COLORADO SPRINGS',
'state': 'COLORADO',
'timezone': -7,
'lat': 38.817,
'lon': -104.717,
'elevation': 1872,
'distance': 134759,
'dataset': 'tmy2'},
{'id': '1-724660',
'city': 'COLORADO SPRINGS MUNI AP',
'state': 'COLORADO',
'timezone': -7,
'lat': 38.817,
'lon': -104.717,
'elevation': 1872,
'distance': 134759,
'dataset': 'tmy3'},
{'id': '1-724673',
'city': 'LEADVILLE/LAKE CO.',
'state': 'COLORADO',
'timezone': -7,
'lat': 39.217,
'lon': -106.317,
'elevation': 3026,
'distance': 142321,
'dataset': 'tmy3'},
{'id': '1-724665',
'city': 'LIMON',
'state': 'COLORADO',
'timezone': -7,
'lat': 39.183,
'lon': -103.717,
'elevation': 1695,
'distance': 142493,
'dataset': 'tmy3'},
{'id': '1-724698',
'city': 'AKRON WASHINGTON CO AP',
'state': 'COLORADO',
'timezone': -7,
'lat': 40.167,
'lon': -103.233,
'elevation': 1421,
'distance': 150519,
'dataset': 'tmy3'},
{'id': '1-725645',
'city': 'LARAMIE GENERAL BREES FIELD',
'state': 'WYOMING',
'timezone': -7,
'lat': 41.317,
'lon': -105.683,
'elevation': 2215,
'distance': 158230,
'dataset': 'tmy3'}]}
[ ]: