pvlib 0.11.2__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.
Files changed (139) hide show
  1. pvlib/__init__.py +1 -0
  2. pvlib/atmosphere.py +0 -9
  3. pvlib/bifacial/infinite_sheds.py +4 -3
  4. pvlib/bifacial/utils.py +2 -1
  5. pvlib/iotools/psm3.py +1 -1
  6. pvlib/iotools/pvgis.py +10 -2
  7. pvlib/iotools/tmy.py +3 -69
  8. pvlib/irradiance.py +14 -0
  9. pvlib/location.py +73 -33
  10. pvlib/modelchain.py +18 -35
  11. pvlib/pvsystem.py +7 -10
  12. pvlib/snow.py +64 -28
  13. pvlib/spectrum/__init__.py +0 -1
  14. pvlib/spectrum/irradiance.py +0 -63
  15. pvlib/spectrum/mismatch.py +3 -3
  16. pvlib/tools.py +6 -5
  17. {pvlib-0.11.2.dist-info → pvlib-0.12.0.dist-info}/METADATA +5 -3
  18. pvlib-0.12.0.dist-info/RECORD +75 -0
  19. {pvlib-0.11.2.dist-info → pvlib-0.12.0.dist-info}/WHEEL +1 -1
  20. pvlib/data/BIRD_08_16_2012.csv +0 -8761
  21. pvlib/data/BIRD_08_16_2012_patm.csv +0 -8761
  22. pvlib/data/Burlington, United States SolarAnywhere Time Series 2021 Lat_44_465 Lon_-73_205 TMY3 format.csv +0 -8762
  23. pvlib/data/Burlington, United States SolarAnywhere Time Series 20210101 to 20210103 Lat_44_4675 Lon_-73_2075 SA format.csv +0 -578
  24. pvlib/data/Burlington, United States SolarAnywhere Typical GHI Year Lat_44_465 Lon_-73_205 SA format.csv +0 -74
  25. pvlib/data/CPS SCH275KTL-DO-US-800-250kW_275kVA_1.OND +0 -146
  26. pvlib/data/CRNS0101-05-2019-AZ_Tucson_11_W.txt +0 -4
  27. pvlib/data/CRN_with_problems.txt +0 -3
  28. pvlib/data/ET-M772BH550GL.PAN +0 -75
  29. pvlib/data/NLD_Amsterdam062400_IWEC.epw +0 -8768
  30. pvlib/data/PVsyst_demo.csv +0 -10757
  31. pvlib/data/PVsyst_demo_model.csv +0 -3588
  32. pvlib/data/SRML-day-EUPO1801.txt +0 -1441
  33. pvlib/data/abq19056.dat +0 -6
  34. pvlib/data/bishop88_numerical_precision.csv +0 -101
  35. pvlib/data/bsrn-lr0100-pay0616.dat +0 -86901
  36. pvlib/data/bsrn-pay0616.dat.gz +0 -0
  37. pvlib/data/cams_mcclear_1min_verbose.csv +0 -60
  38. pvlib/data/cams_mcclear_monthly.csv +0 -42
  39. pvlib/data/cams_radiation_1min_verbose.csv +0 -72
  40. pvlib/data/cams_radiation_monthly.csv +0 -47
  41. pvlib/data/detect_clearsky_data.csv +0 -35
  42. pvlib/data/detect_clearsky_threshold_data.csv +0 -126
  43. pvlib/data/greensboro_kimber_soil_manwash.dat +0 -8761
  44. pvlib/data/greensboro_kimber_soil_nowash.dat +0 -8761
  45. pvlib/data/inverter_fit_snl_meas.csv +0 -127
  46. pvlib/data/inverter_fit_snl_sim.csv +0 -19
  47. pvlib/data/ivtools_numdiff.csv +0 -52
  48. pvlib/data/midc_20181014.txt +0 -1441
  49. pvlib/data/midc_raw_20181018.txt +0 -1441
  50. pvlib/data/midc_raw_short_header_20191115.txt +0 -1441
  51. pvlib/data/msn19056.dat +0 -6
  52. pvlib/data/precise_iv_curves1.json +0 -10251
  53. pvlib/data/precise_iv_curves2.json +0 -10251
  54. pvlib/data/precise_iv_curves_parameter_sets1.csv +0 -33
  55. pvlib/data/precise_iv_curves_parameter_sets2.csv +0 -33
  56. pvlib/data/pvgis_hourly_Timeseries_45.000_8.000_SA2_10kWp_CIS_5_2a_2013_2014.json +0 -1
  57. pvlib/data/pvgis_hourly_Timeseries_45.000_8.000_SA_30deg_0deg_2016_2016.csv +0 -35
  58. pvlib/data/pvgis_tmy_meta.json +0 -32
  59. pvlib/data/pvgis_tmy_test.csv +0 -8761
  60. pvlib/data/pvwatts_8760_rackmount.csv +0 -8779
  61. pvlib/data/pvwatts_8760_roofmount.csv +0 -8779
  62. pvlib/data/singleaxis_tracker_wslope.csv +0 -8761
  63. pvlib/data/spectrl2_example_spectra.csv +0 -123
  64. pvlib/data/surfrad-slv16001.dat +0 -1442
  65. pvlib/data/test_psm3_2017.csv +0 -17521
  66. pvlib/data/test_psm3_2019_5min.csv +0 -289
  67. pvlib/data/test_psm3_tmy-2017.csv +0 -8761
  68. pvlib/data/test_read_psm3.csv +0 -17523
  69. pvlib/data/test_read_pvgis_horizon.csv +0 -49
  70. pvlib/data/tmy_45.000_8.000_2005_2023.csv +0 -8789
  71. pvlib/data/tmy_45.000_8.000_2005_2023.epw +0 -8768
  72. pvlib/data/tmy_45.000_8.000_2005_2023.json +0 -1
  73. pvlib/data/tmy_45.000_8.000_2005_2023.txt +0 -8761
  74. pvlib/data/tmy_45.000_8.000_userhorizon.json +0 -1
  75. pvlib/spa_c_files/README.md +0 -81
  76. pvlib/spa_c_files/cspa_py.pxd +0 -43
  77. pvlib/spa_c_files/spa_py.pyx +0 -30
  78. pvlib/tests/__init__.py +0 -0
  79. pvlib/tests/bifacial/__init__.py +0 -0
  80. pvlib/tests/bifacial/test_infinite_sheds.py +0 -317
  81. pvlib/tests/bifacial/test_losses_models.py +0 -54
  82. pvlib/tests/bifacial/test_pvfactors.py +0 -82
  83. pvlib/tests/bifacial/test_utils.py +0 -192
  84. pvlib/tests/conftest.py +0 -476
  85. pvlib/tests/iotools/__init__.py +0 -0
  86. pvlib/tests/iotools/test_acis.py +0 -213
  87. pvlib/tests/iotools/test_bsrn.py +0 -131
  88. pvlib/tests/iotools/test_crn.py +0 -95
  89. pvlib/tests/iotools/test_epw.py +0 -23
  90. pvlib/tests/iotools/test_midc.py +0 -89
  91. pvlib/tests/iotools/test_panond.py +0 -32
  92. pvlib/tests/iotools/test_psm3.py +0 -198
  93. pvlib/tests/iotools/test_pvgis.py +0 -644
  94. pvlib/tests/iotools/test_sodapro.py +0 -298
  95. pvlib/tests/iotools/test_solaranywhere.py +0 -287
  96. pvlib/tests/iotools/test_solargis.py +0 -68
  97. pvlib/tests/iotools/test_solcast.py +0 -324
  98. pvlib/tests/iotools/test_solrad.py +0 -152
  99. pvlib/tests/iotools/test_srml.py +0 -124
  100. pvlib/tests/iotools/test_surfrad.py +0 -75
  101. pvlib/tests/iotools/test_tmy.py +0 -133
  102. pvlib/tests/ivtools/__init__.py +0 -0
  103. pvlib/tests/ivtools/test_sde.py +0 -230
  104. pvlib/tests/ivtools/test_sdm.py +0 -429
  105. pvlib/tests/ivtools/test_utils.py +0 -173
  106. pvlib/tests/spectrum/__init__.py +0 -0
  107. pvlib/tests/spectrum/conftest.py +0 -40
  108. pvlib/tests/spectrum/test_irradiance.py +0 -138
  109. pvlib/tests/spectrum/test_mismatch.py +0 -304
  110. pvlib/tests/spectrum/test_response.py +0 -124
  111. pvlib/tests/spectrum/test_spectrl2.py +0 -72
  112. pvlib/tests/test__deprecation.py +0 -97
  113. pvlib/tests/test_albedo.py +0 -84
  114. pvlib/tests/test_atmosphere.py +0 -351
  115. pvlib/tests/test_clearsky.py +0 -884
  116. pvlib/tests/test_conftest.py +0 -37
  117. pvlib/tests/test_iam.py +0 -555
  118. pvlib/tests/test_inverter.py +0 -213
  119. pvlib/tests/test_irradiance.py +0 -1487
  120. pvlib/tests/test_location.py +0 -356
  121. pvlib/tests/test_modelchain.py +0 -2020
  122. pvlib/tests/test_numerical_precision.py +0 -124
  123. pvlib/tests/test_pvarray.py +0 -71
  124. pvlib/tests/test_pvsystem.py +0 -2511
  125. pvlib/tests/test_scaling.py +0 -207
  126. pvlib/tests/test_shading.py +0 -391
  127. pvlib/tests/test_singlediode.py +0 -608
  128. pvlib/tests/test_snow.py +0 -212
  129. pvlib/tests/test_soiling.py +0 -230
  130. pvlib/tests/test_solarposition.py +0 -966
  131. pvlib/tests/test_spa.py +0 -454
  132. pvlib/tests/test_temperature.py +0 -470
  133. pvlib/tests/test_tools.py +0 -146
  134. pvlib/tests/test_tracking.py +0 -474
  135. pvlib/tests/test_transformer.py +0 -60
  136. pvlib-0.11.2.dist-info/RECORD +0 -191
  137. {pvlib-0.11.2.dist-info → pvlib-0.12.0.dist-info/licenses}/AUTHORS.md +0 -0
  138. {pvlib-0.11.2.dist-info → pvlib-0.12.0.dist-info/licenses}/LICENSE +0 -0
  139. {pvlib-0.11.2.dist-info → pvlib-0.12.0.dist-info}/top_level.txt +0 -0
@@ -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()