Skip to content

Commit bd3a9e4

Browse files
committed
replace interval with time_step in test_psm4
1 parent afd0519 commit bd3a9e4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pvlib/iotools/psm4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ def parse_nsrdb_psm4(fbuf, map_variables=True):
776776

777777
if map_variables:
778778
data = data.rename(columns=VARIABLE_MAP)
779+
data = data.drop(columns=[col for col in data if col not in VARIABLE_MAP])
779780
metadata['latitude'] = metadata.pop('Latitude')
780781
metadata['longitude'] = metadata.pop('Longitude')
781782
metadata['altitude'] = metadata.pop('Elevation')

tests/iotools/test_psm4.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_get_nsrdb_psm4_conus_singleyear(nrel_api_key):
7474
year='2023',
7575
leap_day=False,
7676
map_variables=False,
77-
interval=30)
77+
time_step=30)
7878
expected = pd.read_csv(YEAR_TEST_DATA)
7979
assert_psm4_equal(data, metadata, expected)
8080

@@ -85,7 +85,7 @@ def test_get_nsrdb_psm4_conus_5min(nrel_api_key):
8585
"""test get_nsrdb_psm4_conus for 5-minute data"""
8686
data, metadata = psm4.get_nsrdb_psm4_conus(LATITUDE, LONGITUDE,
8787
nrel_api_key, PVLIB_EMAIL,
88-
year='2023', interval=5,
88+
year='2023', time_step=5,
8989
leap_day=False,
9090
map_variables=False)
9191
assert len(data) == 525600/5
@@ -100,13 +100,13 @@ def test_get_nsrdb_psm4_aggregated_check_leap_day(nrel_api_key):
100100
"""test get_nsrdb_psm4_aggregated for leap day"""
101101
data_2012, _ = psm4.get_nsrdb_psm4_aggregated(LATITUDE, LONGITUDE,
102102
nrel_api_key, PVLIB_EMAIL,
103-
year="2012", interval=60,
103+
year="2012", time_step=60,
104104
leap_day=True,
105105
map_variables=False)
106106
assert len(data_2012) == (8760 + 24)
107107

108108

109-
@pytest.mark.parametrize('latitude, longitude, api_key, year, interval',
109+
@pytest.mark.parametrize('latitude, longitude, api_key, year, time_step',
110110
[(LATITUDE, LONGITUDE, 'BAD', '2023', 60),
111111
(51, -5, nrel_api_key, '2023', 60),
112112
(LATITUDE, LONGITUDE, nrel_api_key, 'bad', 60),
@@ -115,20 +115,20 @@ def test_get_nsrdb_psm4_aggregated_check_leap_day(nrel_api_key):
115115
@pytest.mark.remote_data
116116
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
117117
def test_get_nsrdb_psm4_aggregated_errors(
118-
latitude, longitude, api_key, year, interval
118+
latitude, longitude, api_key, year, time_step
119119
):
120120
"""Test get_nsrdb_psm4_aggregated() for multiple erroneous input scenarios.
121121
122122
These scenarios include:
123123
* Bad API key -> HTTP 403 forbidden because api_key is rejected
124124
* Bad latitude/longitude -> Coordinates were not found in the NSRDB.
125125
* Bad name -> Name is not one of the available options.
126-
* Bad interval, single year -> Intervals can only be 30 or 60 minutes
126+
* Bad time_step, single year -> time_step can only be 30 or 60 minutes
127127
"""
128128
with pytest.raises(HTTPError) as excinfo:
129129
psm4.get_nsrdb_psm4_aggregated(latitude, longitude, api_key,
130130
PVLIB_EMAIL, year=year,
131-
interval=interval, leap_day=False,
131+
time_step=time_step, leap_day=False,
132132
map_variables=False)
133133
# ensure the HTTPError caught isn't due to overuse of the API key
134134
assert "OVER_RATE_LIMIT" not in str(excinfo.value)
@@ -177,7 +177,7 @@ def test_get_nsrdb_psm4_aggregated_attribute_mapping(nrel_api_key):
177177
reverse mapped to psm4 names"""
178178
data, meta = psm4.get_nsrdb_psm4_aggregated(
179179
LATITUDE, LONGITUDE, nrel_api_key, PVLIB_EMAIL, year='2019',
180-
interval=60, attributes=['ghi', 'wind_speed'], leap_day=False,
180+
time_step=60, attributes=['ghi', 'wind_speed'], leap_day=False,
181181
map_variables=True)
182182
# Check that columns are in the correct order (GH1647)
183183
expected_columns = [

0 commit comments

Comments
 (0)