Skip to content

Commit 05cf879

Browse files
committed
api_key as param
1 parent 6cf57a4 commit 05cf879

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pvlib/iotools/psm3.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
'surface_pressure', 'wind_direction', 'wind_speed']
1616

1717

18-
def get_psm3(latitude, longitude, names='tmy', interval=60):
18+
def get_psm3(latitude, longitude, names='tmy', interval=60,
19+
api_key='DEMO_KEY'):
1920
"""
2021
Get PSM3 data
2122
@@ -30,6 +31,8 @@ def get_psm3(latitude, longitude, names='tmy', interval=60):
3031
below for options, default: ``'tmy'``
3132
interval : int
3233
interval size in minutes, can be only either 30 or 60, default: 60
34+
api_key : str
35+
optional, supply your NREL Developer Network API key
3336
3437
Returns
3538
-------
@@ -96,7 +99,7 @@ def get_psm3(latitude, longitude, names='tmy', interval=60):
9699
longitude = ('%9.4f' % longitude).strip()
97100
latitude = ('%8.4f' % latitude).strip()
98101
params = {
99-
'api_key': 'DEMO_KEY',
102+
'api_key': api_key,
100103
'full_name': 'Sample User',
101104
'email': '[email protected]',
102105
'affiliation': 'Test Organization',
@@ -139,7 +142,7 @@ def get_psm3(latitude, longitude, names='tmy', interval=60):
139142
# the response 1st 5 columns are a date vector, convert to datetime
140143
dtidx = pd.to_datetime(
141144
data[['Year', 'Month', 'Day', 'Hour', 'Minute']])
142-
# # in USA all timezones are intergers
145+
# in USA all timezones are intergers
143146
tz = 'Etc/GMT%+d' % -header['Time Zone']
144147
data.index = pd.DatetimeIndex(dtidx).tz_localize(tz)
145148
return header, data

0 commit comments

Comments
 (0)