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