pvlib 0.11.1__py3-none-any.whl → 0.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pvlib/__init__.py +1 -0
- pvlib/_deprecation.py +73 -0
- pvlib/atmosphere.py +77 -7
- pvlib/bifacial/infinite_sheds.py +4 -3
- pvlib/bifacial/utils.py +2 -1
- pvlib/clearsky.py +35 -22
- pvlib/iam.py +4 -4
- pvlib/iotools/midc.py +1 -1
- pvlib/iotools/psm3.py +1 -1
- pvlib/iotools/pvgis.py +10 -12
- pvlib/iotools/tmy.py +3 -69
- pvlib/irradiance.py +112 -55
- pvlib/ivtools/sdm.py +75 -52
- pvlib/location.py +73 -33
- pvlib/modelchain.py +18 -35
- pvlib/pvsystem.py +139 -94
- pvlib/snow.py +64 -28
- pvlib/solarposition.py +46 -30
- pvlib/spa.py +4 -2
- pvlib/spectrum/__init__.py +0 -1
- pvlib/spectrum/irradiance.py +2 -64
- pvlib/spectrum/mismatch.py +3 -3
- pvlib/spectrum/spectrl2.py +2 -1
- pvlib/temperature.py +49 -3
- pvlib/tools.py +6 -5
- {pvlib-0.11.1.dist-info → pvlib-0.12.0.dist-info}/METADATA +14 -11
- pvlib-0.12.0.dist-info/RECORD +75 -0
- {pvlib-0.11.1.dist-info → pvlib-0.12.0.dist-info}/WHEEL +1 -1
- pvlib/data/BIRD_08_16_2012.csv +0 -8761
- pvlib/data/BIRD_08_16_2012_patm.csv +0 -8761
- pvlib/data/Burlington, United States SolarAnywhere Time Series 2021 Lat_44_465 Lon_-73_205 TMY3 format.csv +0 -8762
- pvlib/data/Burlington, United States SolarAnywhere Time Series 20210101 to 20210103 Lat_44_4675 Lon_-73_2075 SA format.csv +0 -578
- pvlib/data/Burlington, United States SolarAnywhere Typical GHI Year Lat_44_465 Lon_-73_205 SA format.csv +0 -74
- pvlib/data/CPS SCH275KTL-DO-US-800-250kW_275kVA_1.OND +0 -146
- pvlib/data/CRNS0101-05-2019-AZ_Tucson_11_W.txt +0 -4
- pvlib/data/CRN_with_problems.txt +0 -3
- pvlib/data/ET-M772BH550GL.PAN +0 -75
- pvlib/data/NLD_Amsterdam062400_IWEC.epw +0 -8768
- pvlib/data/PVsyst_demo.csv +0 -10757
- pvlib/data/PVsyst_demo_model.csv +0 -3588
- pvlib/data/SRML-day-EUPO1801.txt +0 -1441
- pvlib/data/abq19056.dat +0 -6
- pvlib/data/aod550_tcwv_20121101_test.nc +0 -0
- pvlib/data/bishop88_numerical_precision.csv +0 -101
- pvlib/data/bsrn-lr0100-pay0616.dat +0 -86901
- pvlib/data/bsrn-pay0616.dat.gz +0 -0
- pvlib/data/cams_mcclear_1min_verbose.csv +0 -60
- pvlib/data/cams_mcclear_monthly.csv +0 -42
- pvlib/data/cams_radiation_1min_verbose.csv +0 -72
- pvlib/data/cams_radiation_monthly.csv +0 -47
- pvlib/data/detect_clearsky_data.csv +0 -35
- pvlib/data/detect_clearsky_threshold_data.csv +0 -126
- pvlib/data/greensboro_kimber_soil_manwash.dat +0 -8761
- pvlib/data/greensboro_kimber_soil_nowash.dat +0 -8761
- pvlib/data/inverter_fit_snl_meas.csv +0 -127
- pvlib/data/inverter_fit_snl_sim.csv +0 -19
- pvlib/data/ivtools_numdiff.csv +0 -52
- pvlib/data/midc_20181014.txt +0 -1441
- pvlib/data/midc_raw_20181018.txt +0 -1441
- pvlib/data/midc_raw_short_header_20191115.txt +0 -1441
- pvlib/data/msn19056.dat +0 -6
- pvlib/data/precise_iv_curves1.json +0 -10251
- pvlib/data/precise_iv_curves2.json +0 -10251
- pvlib/data/precise_iv_curves_parameter_sets1.csv +0 -33
- pvlib/data/precise_iv_curves_parameter_sets2.csv +0 -33
- pvlib/data/pvgis_hourly_Timeseries_45.000_8.000_SA2_10kWp_CIS_5_2a_2013_2014.json +0 -1
- pvlib/data/pvgis_hourly_Timeseries_45.000_8.000_SA_30deg_0deg_2016_2016.csv +0 -35
- pvlib/data/pvgis_tmy_meta.json +0 -32
- pvlib/data/pvgis_tmy_test.dat +0 -8761
- pvlib/data/pvwatts_8760_rackmount.csv +0 -8779
- pvlib/data/pvwatts_8760_roofmount.csv +0 -8779
- pvlib/data/singleaxis_tracker_wslope.csv +0 -8761
- pvlib/data/spectrl2_example_spectra.csv +0 -123
- pvlib/data/surfrad-slv16001.dat +0 -1442
- pvlib/data/test_psm3_2017.csv +0 -17521
- pvlib/data/test_psm3_2019_5min.csv +0 -289
- pvlib/data/test_psm3_tmy-2017.csv +0 -8761
- pvlib/data/test_read_psm3.csv +0 -17523
- pvlib/data/test_read_pvgis_horizon.csv +0 -49
- pvlib/data/tmy_45.000_8.000_2005_2020.csv +0 -8789
- pvlib/data/tmy_45.000_8.000_2005_2020.epw +0 -8768
- pvlib/data/tmy_45.000_8.000_2005_2020.json +0 -1
- pvlib/data/tmy_45.000_8.000_2005_2020.txt +0 -8761
- pvlib/data/tmy_45.000_8.000_userhorizon.json +0 -1
- pvlib/data/variables_style_rules.csv +0 -56
- pvlib/spa_c_files/README.md +0 -81
- pvlib/spa_c_files/cspa_py.pxd +0 -43
- pvlib/spa_c_files/spa_py.pyx +0 -30
- pvlib/tests/__init__.py +0 -0
- pvlib/tests/bifacial/__init__.py +0 -0
- pvlib/tests/bifacial/test_infinite_sheds.py +0 -317
- pvlib/tests/bifacial/test_losses_models.py +0 -54
- pvlib/tests/bifacial/test_pvfactors.py +0 -82
- pvlib/tests/bifacial/test_utils.py +0 -192
- pvlib/tests/conftest.py +0 -476
- pvlib/tests/iotools/__init__.py +0 -0
- pvlib/tests/iotools/test_acis.py +0 -213
- pvlib/tests/iotools/test_bsrn.py +0 -131
- pvlib/tests/iotools/test_crn.py +0 -95
- pvlib/tests/iotools/test_epw.py +0 -23
- pvlib/tests/iotools/test_midc.py +0 -89
- pvlib/tests/iotools/test_panond.py +0 -32
- pvlib/tests/iotools/test_psm3.py +0 -198
- pvlib/tests/iotools/test_pvgis.py +0 -644
- pvlib/tests/iotools/test_sodapro.py +0 -298
- pvlib/tests/iotools/test_solaranywhere.py +0 -287
- pvlib/tests/iotools/test_solargis.py +0 -68
- pvlib/tests/iotools/test_solcast.py +0 -324
- pvlib/tests/iotools/test_solrad.py +0 -152
- pvlib/tests/iotools/test_srml.py +0 -124
- pvlib/tests/iotools/test_surfrad.py +0 -75
- pvlib/tests/iotools/test_tmy.py +0 -133
- pvlib/tests/ivtools/__init__.py +0 -0
- pvlib/tests/ivtools/test_sde.py +0 -230
- pvlib/tests/ivtools/test_sdm.py +0 -407
- pvlib/tests/ivtools/test_utils.py +0 -173
- pvlib/tests/spectrum/__init__.py +0 -0
- pvlib/tests/spectrum/conftest.py +0 -40
- pvlib/tests/spectrum/test_irradiance.py +0 -138
- pvlib/tests/spectrum/test_mismatch.py +0 -304
- pvlib/tests/spectrum/test_response.py +0 -124
- pvlib/tests/spectrum/test_spectrl2.py +0 -72
- pvlib/tests/test_albedo.py +0 -84
- pvlib/tests/test_atmosphere.py +0 -204
- pvlib/tests/test_clearsky.py +0 -878
- pvlib/tests/test_conftest.py +0 -81
- pvlib/tests/test_iam.py +0 -555
- pvlib/tests/test_inverter.py +0 -213
- pvlib/tests/test_irradiance.py +0 -1441
- pvlib/tests/test_location.py +0 -356
- pvlib/tests/test_modelchain.py +0 -2020
- pvlib/tests/test_numerical_precision.py +0 -124
- pvlib/tests/test_pvarray.py +0 -71
- pvlib/tests/test_pvsystem.py +0 -2495
- pvlib/tests/test_scaling.py +0 -207
- pvlib/tests/test_shading.py +0 -391
- pvlib/tests/test_singlediode.py +0 -608
- pvlib/tests/test_snow.py +0 -212
- pvlib/tests/test_soiling.py +0 -230
- pvlib/tests/test_solarposition.py +0 -933
- pvlib/tests/test_spa.py +0 -425
- pvlib/tests/test_temperature.py +0 -470
- pvlib/tests/test_tools.py +0 -146
- pvlib/tests/test_tracking.py +0 -474
- pvlib/tests/test_transformer.py +0 -60
- pvlib-0.11.1.dist-info/RECORD +0 -192
- {pvlib-0.11.1.dist-info → pvlib-0.12.0.dist-info/licenses}/AUTHORS.md +0 -0
- {pvlib-0.11.1.dist-info → pvlib-0.12.0.dist-info/licenses}/LICENSE +0 -0
- {pvlib-0.11.1.dist-info → pvlib-0.12.0.dist-info}/top_level.txt +0 -0
pvlib/tests/iotools/test_psm3.py
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
test iotools for PSM3
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import os
|
|
6
|
-
from pvlib.iotools import psm3
|
|
7
|
-
from ..conftest import DATA_DIR, RERUNS, RERUNS_DELAY, assert_index_equal
|
|
8
|
-
import numpy as np
|
|
9
|
-
import pandas as pd
|
|
10
|
-
import pytest
|
|
11
|
-
from requests import HTTPError
|
|
12
|
-
from io import StringIO
|
|
13
|
-
import warnings
|
|
14
|
-
from pvlib._deprecation import pvlibDeprecationWarning
|
|
15
|
-
|
|
16
|
-
TMY_TEST_DATA = DATA_DIR / 'test_psm3_tmy-2017.csv'
|
|
17
|
-
YEAR_TEST_DATA = DATA_DIR / 'test_psm3_2017.csv'
|
|
18
|
-
YEAR_TEST_DATA_5MIN = DATA_DIR / 'test_psm3_2019_5min.csv'
|
|
19
|
-
MANUAL_TEST_DATA = DATA_DIR / 'test_read_psm3.csv'
|
|
20
|
-
LATITUDE, LONGITUDE = 40.5137, -108.5449
|
|
21
|
-
METADATA_FIELDS = [
|
|
22
|
-
'Source', 'Location ID', 'City', 'State', 'Country', 'Latitude',
|
|
23
|
-
'Longitude', 'Time Zone', 'Elevation', 'Local Time Zone',
|
|
24
|
-
'Dew Point Units', 'DHI Units', 'DNI Units', 'GHI Units',
|
|
25
|
-
'Temperature Units', 'Pressure Units', 'Wind Direction Units',
|
|
26
|
-
'Wind Speed Units', 'Surface Albedo Units', 'Version']
|
|
27
|
-
PVLIB_EMAIL = 'pvlib-admin@googlegroups.com'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@pytest.fixture(scope="module")
|
|
31
|
-
def nrel_api_key():
|
|
32
|
-
"""Supplies pvlib-python's NREL Developer Network API key.
|
|
33
|
-
|
|
34
|
-
Azure Pipelines CI utilizes a secret variable set to NREL_API_KEY
|
|
35
|
-
to mitigate failures associated with using the default key of
|
|
36
|
-
"DEMO_KEY". A user is capable of using their own key this way if
|
|
37
|
-
desired however the default key should suffice for testing purposes.
|
|
38
|
-
"""
|
|
39
|
-
try:
|
|
40
|
-
demo_key = os.environ["NREL_API_KEY"]
|
|
41
|
-
except KeyError:
|
|
42
|
-
warnings.warn(
|
|
43
|
-
"WARNING: NREL API KEY environment variable not set! "
|
|
44
|
-
"Using DEMO_KEY instead. Unexpected failures may occur."
|
|
45
|
-
)
|
|
46
|
-
demo_key = 'DEMO_KEY'
|
|
47
|
-
return demo_key
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def assert_psm3_equal(data, metadata, expected):
|
|
51
|
-
"""check consistency of PSM3 data"""
|
|
52
|
-
# check datevec columns
|
|
53
|
-
assert np.allclose(data.Year, expected.Year)
|
|
54
|
-
assert np.allclose(data.Month, expected.Month)
|
|
55
|
-
assert np.allclose(data.Day, expected.Day)
|
|
56
|
-
assert np.allclose(data.Hour, expected.Hour)
|
|
57
|
-
assert np.allclose(data.Minute, expected.Minute)
|
|
58
|
-
# check data columns
|
|
59
|
-
assert np.allclose(data.GHI, expected.GHI)
|
|
60
|
-
assert np.allclose(data.DNI, expected.DNI)
|
|
61
|
-
assert np.allclose(data.DHI, expected.DHI)
|
|
62
|
-
assert np.allclose(data.Temperature, expected.Temperature)
|
|
63
|
-
assert np.allclose(data.Pressure, expected.Pressure)
|
|
64
|
-
assert np.allclose(data['Dew Point'], expected['Dew Point'])
|
|
65
|
-
assert np.allclose(data['Surface Albedo'], expected['Surface Albedo'])
|
|
66
|
-
assert np.allclose(data['Wind Speed'], expected['Wind Speed'])
|
|
67
|
-
assert np.allclose(data['Wind Direction'], expected['Wind Direction'])
|
|
68
|
-
# check header
|
|
69
|
-
for mf in METADATA_FIELDS:
|
|
70
|
-
assert mf in metadata
|
|
71
|
-
# check timezone
|
|
72
|
-
assert (data.index.tzinfo.zone == 'Etc/GMT%+d' % -metadata['Time Zone'])
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@pytest.mark.remote_data
|
|
76
|
-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
|
|
77
|
-
def test_get_psm3_tmy(nrel_api_key):
|
|
78
|
-
"""test get_psm3 with a TMY"""
|
|
79
|
-
data, metadata = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key,
|
|
80
|
-
PVLIB_EMAIL, names='tmy-2017',
|
|
81
|
-
leap_day=False, map_variables=False)
|
|
82
|
-
expected = pd.read_csv(TMY_TEST_DATA)
|
|
83
|
-
assert_psm3_equal(data, metadata, expected)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@pytest.mark.remote_data
|
|
87
|
-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
|
|
88
|
-
def test_get_psm3_singleyear(nrel_api_key):
|
|
89
|
-
"""test get_psm3 with a single year"""
|
|
90
|
-
data, metadata = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key,
|
|
91
|
-
PVLIB_EMAIL, names='2017',
|
|
92
|
-
leap_day=False, map_variables=False,
|
|
93
|
-
interval=30)
|
|
94
|
-
expected = pd.read_csv(YEAR_TEST_DATA)
|
|
95
|
-
assert_psm3_equal(data, metadata, expected)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
@pytest.mark.remote_data
|
|
99
|
-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
|
|
100
|
-
def test_get_psm3_5min(nrel_api_key):
|
|
101
|
-
"""test get_psm3 for 5-minute data"""
|
|
102
|
-
data, metadata = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key,
|
|
103
|
-
PVLIB_EMAIL, names='2019', interval=5,
|
|
104
|
-
leap_day=False, map_variables=False)
|
|
105
|
-
assert len(data) == 525600/5
|
|
106
|
-
first_day = data.loc['2019-01-01']
|
|
107
|
-
expected = pd.read_csv(YEAR_TEST_DATA_5MIN)
|
|
108
|
-
assert_psm3_equal(first_day, metadata, expected)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@pytest.mark.remote_data
|
|
112
|
-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
|
|
113
|
-
def test_get_psm3_check_leap_day(nrel_api_key):
|
|
114
|
-
data_2012, _ = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key,
|
|
115
|
-
PVLIB_EMAIL, names="2012", interval=60,
|
|
116
|
-
leap_day=True, map_variables=False)
|
|
117
|
-
assert len(data_2012) == (8760 + 24)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
@pytest.mark.parametrize('latitude, longitude, api_key, names, interval',
|
|
121
|
-
[(LATITUDE, LONGITUDE, 'BAD', 'tmy-2017', 60),
|
|
122
|
-
(51, -5, nrel_api_key, 'tmy-2017', 60),
|
|
123
|
-
(LATITUDE, LONGITUDE, nrel_api_key, 'bad', 60),
|
|
124
|
-
(LATITUDE, LONGITUDE, nrel_api_key, '2017', 15),
|
|
125
|
-
])
|
|
126
|
-
@pytest.mark.remote_data
|
|
127
|
-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
|
|
128
|
-
def test_get_psm3_tmy_errors(
|
|
129
|
-
latitude, longitude, api_key, names, interval
|
|
130
|
-
):
|
|
131
|
-
"""Test get_psm3() for multiple erroneous input scenarios.
|
|
132
|
-
|
|
133
|
-
These scenarios include:
|
|
134
|
-
* Bad API key -> HTTP 403 forbidden because api_key is rejected
|
|
135
|
-
* Bad latitude/longitude -> Coordinates were not found in the NSRDB.
|
|
136
|
-
* Bad name -> Name is not one of the available options.
|
|
137
|
-
* Bad interval, single year -> Intervals can only be 30 or 60 minutes.
|
|
138
|
-
"""
|
|
139
|
-
with pytest.raises(HTTPError) as excinfo:
|
|
140
|
-
psm3.get_psm3(latitude, longitude, api_key, PVLIB_EMAIL,
|
|
141
|
-
names=names, interval=interval, leap_day=False,
|
|
142
|
-
map_variables=False)
|
|
143
|
-
# ensure the HTTPError caught isn't due to overuse of the API key
|
|
144
|
-
assert "OVER_RATE_LIMIT" not in str(excinfo.value)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
@pytest.fixture
|
|
148
|
-
def io_input(request):
|
|
149
|
-
"""file-like object for parse_psm3"""
|
|
150
|
-
with MANUAL_TEST_DATA.open() as f:
|
|
151
|
-
data = f.read()
|
|
152
|
-
obj = StringIO(data)
|
|
153
|
-
return obj
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
def test_parse_psm3(io_input):
|
|
157
|
-
"""test parse_psm3"""
|
|
158
|
-
data, metadata = psm3.parse_psm3(io_input, map_variables=False)
|
|
159
|
-
expected = pd.read_csv(YEAR_TEST_DATA)
|
|
160
|
-
assert_psm3_equal(data, metadata, expected)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def test_read_psm3():
|
|
164
|
-
"""test read_psm3"""
|
|
165
|
-
data, metadata = psm3.read_psm3(MANUAL_TEST_DATA, map_variables=False)
|
|
166
|
-
expected = pd.read_csv(YEAR_TEST_DATA)
|
|
167
|
-
assert_psm3_equal(data, metadata, expected)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
def test_read_psm3_map_variables():
|
|
171
|
-
"""test read_psm3 map_variables=True"""
|
|
172
|
-
data, metadata = psm3.read_psm3(MANUAL_TEST_DATA, map_variables=True)
|
|
173
|
-
columns_mapped = ['Year', 'Month', 'Day', 'Hour', 'Minute', 'dhi', 'ghi',
|
|
174
|
-
'dni', 'ghi_clear', 'dhi_clear', 'dni_clear',
|
|
175
|
-
'Cloud Type', 'temp_dew', 'solar_zenith',
|
|
176
|
-
'Fill Flag', 'albedo', 'wind_speed',
|
|
177
|
-
'wind_direction', 'precipitable_water',
|
|
178
|
-
'relative_humidity', 'temp_air', 'pressure']
|
|
179
|
-
data, metadata = psm3.read_psm3(MANUAL_TEST_DATA, map_variables=True)
|
|
180
|
-
assert_index_equal(data.columns, pd.Index(columns_mapped))
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
@pytest.mark.remote_data
|
|
184
|
-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
|
|
185
|
-
def test_get_psm3_attribute_mapping(nrel_api_key):
|
|
186
|
-
"""Test that pvlib names can be passed in as attributes and get correctly
|
|
187
|
-
reverse mapped to PSM3 names"""
|
|
188
|
-
data, meta = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key, PVLIB_EMAIL,
|
|
189
|
-
names=2019, interval=60,
|
|
190
|
-
attributes=['ghi', 'wind_speed'],
|
|
191
|
-
leap_day=False, map_variables=True)
|
|
192
|
-
# Check that columns are in the correct order (GH1647)
|
|
193
|
-
expected_columns = [
|
|
194
|
-
'Year', 'Month', 'Day', 'Hour', 'Minute', 'ghi', 'wind_speed']
|
|
195
|
-
pd.testing.assert_index_equal(pd.Index(expected_columns), data.columns)
|
|
196
|
-
assert 'latitude' in meta.keys()
|
|
197
|
-
assert 'longitude' in meta.keys()
|
|
198
|
-
assert 'altitude' in meta.keys()
|