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