Skip to content

Commit af8ebd4

Browse files
committed
addressed many of adamrjensen's initial comments
1 parent 5a13994 commit af8ebd4

1 file changed

Lines changed: 38 additions & 26 deletions

File tree

pvlib/iotools/psm4.py

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Get NSRDB PSM4 from several endpoints. See:
2+
Functions for reading and retrieving data from NSRDB PSM4. See:
33
https://developer.nrel.gov/docs/solar/nsrdb/nsrdb-GOES-aggregated-v4-0-0-download/
44
https://developer.nrel.gov/docs/solar/nsrdb/nsrdb-GOES-tmy-v4-0-0-download/
55
https://developer.nrel.gov/docs/solar/nsrdb/nsrdb-GOES-conus-v4-0-0-download/
@@ -75,16 +75,18 @@
7575

7676

7777
def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
78-
names='2023', interval=60,
78+
names='2023', time_period=60,
7979
attributes=ATTRIBUTES, leap_day=True,
8080
full_name=PVLIB_PYTHON,
8181
affiliation=PVLIB_PYTHON,
8282
map_variables=True, url=None, timeout=30,
8383
utc=False):
8484
"""
8585
Retrieve NSRDB PSM4 timeseries weather data from the PSM4 NSRDB GOES
86-
Aggregated v4 API. The NSRDB is described in [1]_ and the PSM4 NSRDB
87-
GOES Aggregated v4 API is described in [2]_,.
86+
Aggregated v4 API.
87+
88+
The NSRDB is described in [1]_ and the PSM4 NSRDB GOES Aggregated v4 API is
89+
described in [2]_,.
8890
8991
Parameters
9092
----------
@@ -101,8 +103,9 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
101103
PSM4 API parameter specifing year (e.g. ``2023``) to download. The
102104
allowed values update periodically, so consult the NSRDB reference
103105
below for the current set of options.
104-
interval : int, {60, 30}
105-
interval size in minutes, must be 60 or 30 for PSM4 Aggregated.
106+
time_period : int, {60, 30}
107+
time period in minutes, must be 60 or 30 for PSM4 Aggregated. Called
108+
``interval`` in NSRDB API.
106109
attributes : list of str, optional
107110
meteorological fields to fetch. If not specified, defaults to
108111
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
@@ -196,7 +199,7 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
196199
'attributes': ','.join(attributes),
197200
'leap_day': str(leap_day).lower(),
198201
'utc': str(utc).lower(),
199-
'interval': interval
202+
'interval': time_period
200203
}
201204
# request CSV download from NREL PSM4
202205
if url is None:
@@ -218,13 +221,15 @@ def get_nsrdb_psm4_aggregated(latitude, longitude, api_key, email,
218221

219222

220223
def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
221-
interval=60, attributes=ATTRIBUTES, leap_day=False,
224+
time_period=60, attributes=ATTRIBUTES, leap_day=False,
222225
full_name=PVLIB_PYTHON, affiliation=PVLIB_PYTHON,
223226
map_variables=True, url=None, timeout=30, utc=False):
224227
"""
225228
Retrieve NSRDB PSM4 timeseries weather data from the PSM4 NSRDB GOES
226-
TMY v4 API. The NSRDB is described in [1]_ and the PSM4 NSRDB GOES
227-
TMY v4 API is described in [2]_,.
229+
TMY v4 API.
230+
231+
The NSRDB is described in [1]_ and the PSM4 NSRDB GOES TMY v4 API is
232+
described in [2]_,.
228233
229234
Parameters
230235
----------
@@ -241,8 +246,9 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
241246
PSM4 API parameter specifing TMY variant to download (e.g. ``'tmy'``
242247
or ``'tgy-2022'``). The allowed values update periodically, so
243248
consult the NSRDB references below for the current set of options.
244-
interval : int, {60}
245-
interval size in minutes. Must be 60 for typical year requests.
249+
time_period : int, {60}
250+
time period in minutes. Must be 60 for typical year requests. Called
251+
``interval`` in NSRDB API.
246252
attributes : list of str, optional
247253
meteorological fields to fetch. If not specified, defaults to
248254
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
@@ -336,7 +342,7 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
336342
'attributes': ','.join(attributes),
337343
'leap_day': str(leap_day).lower(),
338344
'utc': str(utc).lower(),
339-
'interval': interval
345+
'interval': time_period
340346
}
341347
# request CSV download from NREL PSM4
342348
if url is None:
@@ -358,14 +364,16 @@ def get_nsrdb_psm4_tmy(latitude, longitude, api_key, email, names='2023',
358364

359365

360366
def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
361-
interval=60, attributes=ATTRIBUTES, leap_day=True,
367+
time_period=60, attributes=ATTRIBUTES, leap_day=True,
362368
full_name=PVLIB_PYTHON, affiliation=PVLIB_PYTHON,
363369
map_variables=True, url=None, timeout=30,
364370
utc=False):
365371
"""
366372
Retrieve NSRDB PSM4 timeseries weather data from the PSM4 NSRDB GOES CONUS
367-
v4 API. The NSRDB is described in [1]_ and the PSM4 NSRDB GOES CONUS v4
368-
API is described in [2]_,.
373+
v4 API.
374+
375+
The NSRDB is described in [1]_ and the PSM4 NSRDB GOES CONUS v4 API is
376+
described in [2]_,.
369377
370378
Parameters
371379
----------
@@ -382,8 +390,9 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
382390
PSM4 API parameter specifing year (e.g. ``2023``) to download. The
383391
allowed values update periodically, so consult the NSRDB reference
384392
below for the current set of options.
385-
interval : int, {60, 5, 15, 30}
386-
interval size in minutes, must be 5, 15, 30 or 60.
393+
time_period : int, {60, 5, 15, 30}
394+
time period in minutes, must be 5, 15, 30 or 60. Called ``interval`` in
395+
NSRDB API.
387396
attributes : list of str, optional
388397
meteorological fields to fetch. If not specified, defaults to
389398
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
@@ -477,7 +486,7 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
477486
'attributes': ','.join(attributes),
478487
'leap_day': str(leap_day).lower(),
479488
'utc': str(utc).lower(),
480-
'interval': interval
489+
'interval': time_period
481490
}
482491
# request CSV download from NREL PSM4
483492
if url is None:
@@ -499,15 +508,17 @@ def get_nsrdb_psm4_conus(latitude, longitude, api_key, email, names='2023',
499508

500509

501510
def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
502-
names='2023', interval=60,
511+
names='2023', time_period=60,
503512
attributes=ATTRIBUTES, leap_day=True,
504513
full_name=PVLIB_PYTHON,
505514
affiliation=PVLIB_PYTHON, map_variables=True,
506515
url=None, timeout=30, utc=False):
507516
"""
508517
Retrieve NSRDB PSM4 timeseries weather data from the PSM4 NSRDB GOES Full
509-
Disc v4 API. The NSRDB is described in [1]_ and the PSM4 NSRDB GOES Full
510-
Disc v4 API is described in [2]_,.
518+
Disc v4 API.
519+
520+
The NSRDB is described in [1]_ and the PSM4 NSRDB GOES Full Disc v4 API is
521+
described in [2]_,.
511522
512523
Parameters
513524
----------
@@ -524,8 +535,9 @@ def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
524535
PSM4 API parameter specifing year (e.g. ``2023``) to download. The
525536
allowed values update periodically, so consult the NSRDB reference
526537
below for the current set of options.
527-
interval : int, {60, 10, 30}
528-
interval size in minutes, must be 10, 30 or 60.
538+
time_period : int, {60, 10, 30}
539+
time period in minutes, must be 10, 30 or 60. Called ``interval`` in
540+
NSRDB API.
529541
attributes : list of str, optional
530542
meteorological fields to fetch. If not specified, defaults to
531543
``pvlib.iotools.psm4.ATTRIBUTES``. See reference [2]_ for a list of
@@ -619,7 +631,7 @@ def get_nsrdb_psm4_full_disc(latitude, longitude, api_key, email,
619631
'attributes': ','.join(attributes),
620632
'leap_day': str(leap_day).lower(),
621633
'utc': str(utc).lower(),
622-
'interval': interval
634+
'interval': time_period
623635
}
624636
# request CSV download from NREL PSM4
625637
if url is None:
@@ -780,7 +792,7 @@ def read_nsrdb_psm4(filename, map_variables=True):
780792
781793
Parameters
782794
----------
783-
filename: str
795+
filename: str or path-like
784796
Filename of a file containing data to read.
785797
map_variables: bool, default True
786798
When true, renames columns of the Dataframe to pvlib variable names

0 commit comments

Comments
 (0)