Skip to content

Commit 502b323

Browse files
committed
addressed more of adam's comments
1 parent 44a9ef1 commit 502b323

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

pvlib/iotools/psm4.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
PSM4_CON_URL = urljoin(NSRDB_API_BASE, PSM4_CON_ENDPOINT)
2323
PSM4_FUL_URL = urljoin(NSRDB_API_BASE, PSM4_FUL_ENDPOINT)
2424

25-
ATTRIBUTES = (
25+
PARAMETERS = (
2626
'air_temperature', 'dew_point', 'dhi', 'dni', 'ghi', 'surface_albedo',
2727
'surface_pressure', 'wind_direction', 'wind_speed')
2828
PVLIB_PYTHON = 'pvlib python'
@@ -45,8 +45,6 @@
4545
'Surface Albedo': 'albedo',
4646
'Precipitable Water': 'precipitable_water',
4747
'AOD': 'aod',
48-
'Alpha': 'alpha',
49-
'Asymmetry': 'asymmetry',
5048
}
5149

5250
# Dictionary mapping pvlib names to PSM4 request names
@@ -76,7 +74,7 @@
7674

7775
def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
7876
names='2023', time_period=60,
79-
attributes=ATTRIBUTES, leap_day=True,
77+
parameters=PARAMETERS, leap_day=True,
8078
full_name=PVLIB_PYTHON,
8179
affiliation=PVLIB_PYTHON,
8280
map_variables=True, url=None, timeout=30,
@@ -106,12 +104,12 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
106104
time_period : int, {60, 30}
107105
time period in minutes, must be 60 or 30 for PSM4 Aggregated. Called
108106
``interval`` in NSRDB API.
109-
attributes : list of str, optional
107+
parameters : list of str, optional
110108
meteorological fields to fetch. If not specified, defaults to
111-
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
109+
``pvlib.iotools.psm4.PARAMETERS``. See reference [2]_ for a list of
112110
available fields. Alternatively, pvlib names may also be used (e.g.
113111
'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`. To
114-
retrieve all available fields, set ``attributes=[]``.
112+
retrieve all available fields, set ``parameters=[]``.
115113
leap_day : bool, default : True
116114
include leap day in the results
117115
full_name : str, default 'pvlib python'
@@ -183,8 +181,8 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
183181
# convert to string to accomodate integer years being passed in
184182
names = str(names)
185183

186-
# convert pvlib names in attributes to PSM4 convention
187-
attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes]
184+
# convert pvlib names in parameters to PSM4 convention
185+
parameters = [REQUEST_VARIABLE_MAP.get(a, a) for a in parameters]
188186

189187
# required query-string parameters for request to PSM4 API
190188
params = {
@@ -196,7 +194,7 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
196194
'mailing_list': 'false',
197195
'wkt': 'POINT(%s %s)' % (longitude, latitude),
198196
'names': names,
199-
'attributes': ','.join(attributes),
197+
'attributes': ','.join(parameters),
200198
'leap_day': str(leap_day).lower(),
201199
'utc': str(utc).lower(),
202200
'interval': time_period
@@ -221,7 +219,7 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
221219

222220

223221
def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
224-
time_period=60, attributes=ATTRIBUTES, leap_day=False,
222+
time_period=60, parameters=PARAMETERS, leap_day=False,
225223
full_name=PVLIB_PYTHON, affiliation=PVLIB_PYTHON,
226224
map_variables=True, url=None, timeout=30, utc=False):
227225
"""
@@ -249,12 +247,12 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
249247
time_period : int, {60}
250248
time period in minutes. Must be 60 for typical year requests. Called
251249
``interval`` in NSRDB API.
252-
attributes : list of str, optional
250+
parameters : list of str, optional
253251
meteorological fields to fetch. If not specified, defaults to
254-
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
252+
``pvlib.iotools.psm4.PARAMETERS``. See reference [2]_ for a list of
255253
available fields. Alternatively, pvlib names may also be used (e.g.
256254
'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`. To
257-
retrieve all available fields, set ``attributes=[]``.
255+
retrieve all available fields, set ``parameters=[]``.
258256
leap_day : bool, default : False
259257
Include leap day in the results. Ignored for tmy/tgy/tdy requests.
260258
full_name : str, default 'pvlib python'
@@ -326,8 +324,8 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
326324
# convert to string to accomodate integer years being passed in
327325
names = str(names)
328326

329-
# convert pvlib names in attributes to PSM4 convention
330-
attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes]
327+
# convert pvlib names in parameters to PSM4 convention
328+
parameters = [REQUEST_VARIABLE_MAP.get(a, a) for a in parameters]
331329

332330
# required query-string parameters for request to PSM4 API
333331
params = {
@@ -339,7 +337,7 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
339337
'mailing_list': 'false',
340338
'wkt': 'POINT(%s %s)' % (longitude, latitude),
341339
'names': names,
342-
'attributes': ','.join(attributes),
340+
'attributes': ','.join(parameters),
343341
'leap_day': str(leap_day).lower(),
344342
'utc': str(utc).lower(),
345343
'interval': time_period
@@ -364,7 +362,7 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
364362

365363

366364
def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
367-
time_period=60, attributes=ATTRIBUTES, leap_day=True,
365+
time_period=60, parameters=PARAMETERS, leap_day=True,
368366
full_name=PVLIB_PYTHON, affiliation=PVLIB_PYTHON,
369367
map_variables=True, url=None, timeout=30,
370368
utc=False):
@@ -393,12 +391,12 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
393391
time_period : int, {60, 5, 15, 30}
394392
time period in minutes, must be 5, 15, 30 or 60. Called ``interval`` in
395393
NSRDB API.
396-
attributes : list of str, optional
394+
parameters : list of str, optional
397395
meteorological fields to fetch. If not specified, defaults to
398-
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
396+
``pvlib.iotools.psm4.PARAMETERS``. See reference [2]_ for a list of
399397
available fields. Alternatively, pvlib names may also be used (e.g.
400398
'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`. To
401-
retrieve all available fields, set ``attributes=[]``.
399+
retrieve all available fields, set ``parameters=[]``.
402400
leap_day : bool, default : True
403401
include leap day in the results
404402
full_name : str, default 'pvlib python'
@@ -470,8 +468,8 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
470468
# convert to string to accomodate integer years being passed in
471469
names = str(names)
472470

473-
# convert pvlib names in attributes to PSM4 convention
474-
attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes]
471+
# convert pvlib names in parameters to PSM4 convention
472+
parameters = [REQUEST_VARIABLE_MAP.get(a, a) for a in parameters]
475473

476474
# required query-string parameters for request to PSM4 API
477475
params = {
@@ -483,7 +481,7 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
483481
'mailing_list': 'false',
484482
'wkt': 'POINT(%s %s)' % (longitude, latitude),
485483
'names': names,
486-
'attributes': ','.join(attributes),
484+
'attributes': ','.join(parameters),
487485
'leap_day': str(leap_day).lower(),
488486
'utc': str(utc).lower(),
489487
'interval': time_period
@@ -509,7 +507,7 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
509507

510508
def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
511509
names='2023', time_period=60,
512-
attributes=ATTRIBUTES, leap_day=True,
510+
parameters=PARAMETERS, leap_day=True,
513511
full_name=PVLIB_PYTHON,
514512
affiliation=PVLIB_PYTHON, map_variables=True,
515513
url=None, timeout=30, utc=False):
@@ -538,12 +536,12 @@ def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
538536
time_period : int, {60, 10, 30}
539537
time period in minutes, must be 10, 30 or 60. Called ``interval`` in
540538
NSRDB API.
541-
attributes : list of str, optional
539+
parameters : list of str, optional
542540
meteorological fields to fetch. If not specified, defaults to
543-
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
541+
``pvlib.iotools.psm4.PARAMETERS``. See reference [2]_ for a list of
544542
available fields. Alternatively, pvlib names may also be used (e.g.
545543
'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`. To
546-
retrieve all available fields, set ``attributes=[]``.
544+
retrieve all available fields, set ``parameters=[]``.
547545
leap_day : bool, default : True
548546
include leap day in the results
549547
full_name : str, default 'pvlib python'
@@ -615,8 +613,8 @@ def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
615613
# convert to string to accomodate integer years being passed in
616614
names = str(names)
617615

618-
# convert pvlib names in attributes to PSM4 convention
619-
attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes]
616+
# convert pvlib names in parameters to PSM4 convention
617+
parameters = [REQUEST_VARIABLE_MAP.get(a, a) for a in parameters]
620618

621619
# required query-string parameters for request to PSM4 API
622620
params = {
@@ -628,7 +626,7 @@ def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
628626
'mailing_list': 'false',
629627
'wkt': 'POINT(%s %s)' % (longitude, latitude),
630628
'names': names,
631-
'attributes': ','.join(attributes),
629+
'attributes': ','.join(parameters),
632630
'leap_day': str(leap_day).lower(),
633631
'utc': str(utc).lower(),
634632
'interval': time_period
@@ -654,8 +652,9 @@ def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
654652

655653
def parse_nsrdb_psm4(fbuf, map_variables=True):
656654
"""
657-
Parse an NSRDB PSM4 weather file (formatted as SAM CSV). The NSRDB
658-
is described in [1]_ and the SAM CSV format is described in [2]_.
655+
Parse an NSRDB PSM4 weather file (formatted as SAM CSV).
656+
657+
The NSRDB is described in [1]_ and the SAM CSV format is described in [2]_.
659658
660659
Parameters
661660
----------
@@ -787,8 +786,9 @@ def parse_nsrdb_psm4(fbuf, map_variables=True):
787786

788787
def read_nsrdb_psm4(filename, map_variables=True):
789788
"""
790-
Read an NSRDB PSM4 weather file (formatted as SAM CSV). The NSRDB
791-
is described in [1]_ and the SAM CSV format is described in [2]_.
789+
Read an NSRDB PSM4 weather file (formatted as SAM CSV).
790+
791+
The NSRDB is described in [1]_ and the SAM CSV format is described in [2]_.
792792
793793
Parameters
794794
----------

0 commit comments

Comments
 (0)