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,124 +0,0 @@
1
- """
2
- Test numerical precision of explicit single diode calculation using symbolic
3
- mathematics. SymPy is a computer algebra system, that uses infinite precision
4
- symbols instead of standard floating point and integer computer number types.
5
- http://docs.sympy.org/latest/modules/evalf.html#accuracy-and-error-handling
6
-
7
- This module can be executed from the command line to generate a high precision
8
- dataset of I-V curve points to test the explicit single diode calculations
9
- :func:`pvlib.singlediode.bishop88`::
10
-
11
- $ python test_numeric_precision.py
12
-
13
- This generates a file in the pvlib data folder, which is specified by the
14
- constant ``DATA_PATH``. When the test is run using ``pytest`` it will compare
15
- the values calculated by :func:`pvlib.singlediode.bishop88` with the
16
- high-precision values generated with SymPy.
17
- """
18
-
19
- import logging
20
- import numpy as np
21
- import pandas as pd
22
- from pvlib import pvsystem
23
- from pvlib.singlediode import bishop88, estimate_voc
24
- from .conftest import DATA_DIR
25
-
26
- logging.basicConfig()
27
- LOGGER = logging.getLogger(__name__)
28
- LOGGER.setLevel(logging.DEBUG)
29
- TEST_DATA = 'bishop88_numerical_precision.csv'
30
- DATA_PATH = DATA_DIR / TEST_DATA
31
- POA = 888
32
- TCELL = 55
33
- # module parameters from CEC module SunPower SPR-E20-327
34
- SPR_E20_327 = {
35
- 'alpha_sc': 0.004522,
36
- 'a_ref': 2.6868,
37
- 'I_L_ref': 6.468,
38
- 'I_o_ref': 1.88e-10,
39
- 'R_s': 0.37,
40
- 'R_sh_ref': 298.13,
41
- }
42
- # apply temp/irrad desoto corrections
43
- ARGS = pvsystem.calcparams_desoto(
44
- effective_irradiance=POA, temp_cell=TCELL,
45
- EgRef=1.121, dEgdT=-0.0002677, **SPR_E20_327,
46
- )
47
- IL, I0, RS, RSH, NNSVTH = ARGS
48
- IVCURVE_NPTS = 100
49
-
50
- try:
51
- from sympy import symbols, exp as sy_exp
52
- except ImportError as exc:
53
- LOGGER.exception(exc)
54
- symbols = NotImplemented
55
- sy_exp = NotImplemented
56
-
57
-
58
- def generate_numerical_precision(): # pragma: no cover
59
- """
60
- Generate expected data with infinite numerical precision using SymPy.
61
- :return: dataframe of expected values
62
- """
63
- if symbols is NotImplemented:
64
- LOGGER.critical("SymPy is required to generate expected data.")
65
- raise ImportError("could not import sympy")
66
- il, io, rs, rsh, nnsvt, vd = symbols('il, io, rs, rsh, nnsvt, vd')
67
- a = sy_exp(vd / nnsvt)
68
- b = 1.0 / rsh
69
- i = il - io * (a - 1.0) - vd * b
70
- v = vd - i * rs
71
- c = io * a / nnsvt
72
- grad_i = - c - b # di/dvd
73
- grad_v = 1.0 - grad_i * rs # dv/dvd
74
- # dp/dv = d(iv)/dv = v * di/dv + i
75
- grad = grad_i / grad_v # di/dv
76
- p = i * v
77
- grad_p = v * grad + i # dp/dv
78
- grad2i = -c / nnsvt
79
- grad2v = -grad2i * rs
80
- grad2p = (
81
- grad_v * grad + v * (grad2i/grad_v - grad_i*grad2v/grad_v**2) + grad_i
82
- )
83
- # generate exact values
84
- data = dict(zip((il, io, rs, rsh, nnsvt), ARGS))
85
- vdtest = np.linspace(0, estimate_voc(IL, I0, NNSVTH), IVCURVE_NPTS)
86
- expected = []
87
- for test in vdtest:
88
- data[vd] = test
89
- test_data = {
90
- 'i': np.float64(i.evalf(subs=data)),
91
- 'v': np.float64(v.evalf(subs=data)),
92
- 'p': np.float64(p.evalf(subs=data)),
93
- 'grad_i': np.float64(grad_i.evalf(subs=data)),
94
- 'grad_v': np.float64(grad_v.evalf(subs=data)),
95
- 'grad': np.float64(grad.evalf(subs=data)),
96
- 'grad_p': np.float64(grad_p.evalf(subs=data)),
97
- 'grad2p': np.float64(grad2p.evalf(subs=data))
98
- }
99
- LOGGER.debug(test_data)
100
- expected.append(test_data)
101
- return pd.DataFrame(expected, index=vdtest)
102
-
103
-
104
- def test_numerical_precision():
105
- """
106
- Test that there are no numerical errors due to floating point arithmetic.
107
- """
108
- expected = pd.read_csv(DATA_PATH)
109
- vdtest = np.linspace(0, estimate_voc(IL, I0, NNSVTH), IVCURVE_NPTS)
110
- results = bishop88(vdtest, *ARGS, gradients=True)
111
- assert np.allclose(expected['i'], results[0])
112
- assert np.allclose(expected['v'], results[1])
113
- assert np.allclose(expected['p'], results[2])
114
- assert np.allclose(expected['grad_i'], results[3])
115
- assert np.allclose(expected['grad_v'], results[4])
116
- assert np.allclose(expected['grad'], results[5])
117
- assert np.allclose(expected['grad_p'], results[6])
118
- assert np.allclose(expected['grad2p'], results[7])
119
-
120
-
121
- if __name__ == '__main__': # pragma: no cover
122
- expected = generate_numerical_precision()
123
- expected.to_csv(DATA_PATH)
124
- test_numerical_precision()
@@ -1,71 +0,0 @@
1
- import numpy as np
2
- import pandas as pd
3
- from numpy.testing import assert_allclose
4
- from .conftest import assert_series_equal
5
- import pytest
6
-
7
- from pvlib import pvarray
8
-
9
-
10
- def test_pvefficiency_adr():
11
- g = [1000, 200, 1000, 200, 1000, 200, 0.0, np.nan]
12
- t = [25, 25, 50, 50, 75, 75, 25, 25]
13
- params = [1.0, -6.651460, 0.018736, 0.070679, 0.054170]
14
-
15
- # the expected values were calculated using the new function itself
16
- # hence this test is primarily a regression test
17
- eta = [1.0, 0.949125, 0.928148, 0.876472, 0.855759, 0.803281, 0.0, np.nan]
18
-
19
- result = pvarray.pvefficiency_adr(g, t, *params)
20
- assert_allclose(result, eta, atol=1e-6)
21
-
22
-
23
- def test_fit_pvefficiency_adr():
24
- g = [1000, 200, 1000, 200, 1000, 200]
25
- t = [25, 25, 50, 50, 75, 75]
26
- eta = [1.0, 0.949125, 0.928148, 0.876472, 0.855759, 0.803281]
27
-
28
- # the expected values were calculated using the new function itself
29
- # hence this test is primarily a regression test
30
- params = [1.0, -6.651460, 0.018736, 0.070679, 0.054170]
31
-
32
- result = pvarray.fit_pvefficiency_adr(g, t, eta, dict_output=False)
33
- # the fitted parameters vary somewhat by platform during the testing
34
- # so the tolerance is higher on the parameters than on the efficiencies
35
- # in the other tests
36
- assert_allclose(result, params, rtol=1e-3)
37
-
38
- result = pvarray.fit_pvefficiency_adr(g, t, eta, dict_output=True)
39
- assert 'k_a' in result
40
-
41
-
42
- def test_pvefficiency_adr_round_trip():
43
- g = [1000, 200, 1000, 200, 1000, 200]
44
- t = [25, 25, 50, 50, 75, 75]
45
- eta = [1.0, 0.949125, 0.928148, 0.876472, 0.855759, 0.803281]
46
-
47
- params = pvarray.fit_pvefficiency_adr(g, t, eta, dict_output=False)
48
- result = pvarray.pvefficiency_adr(g, t, *params)
49
- assert_allclose(result, eta, atol=1e-6)
50
-
51
-
52
- def test_huld():
53
- pdc0 = 100
54
- res = pvarray.huld(1000, 25, pdc0, cell_type='cSi')
55
- assert np.isclose(res, pdc0)
56
- exp_sum = np.exp(1) * (np.sum(pvarray._infer_k_huld('cSi', pdc0)) + pdc0)
57
- res = pvarray.huld(1000*np.exp(1), 26, pdc0, cell_type='cSi')
58
- assert np.isclose(res, exp_sum)
59
- res = pvarray.huld(100, 30, pdc0, k=(1, 1, 1, 1, 1, 1))
60
- exp_100 = 0.1 * (pdc0 + np.log(0.1) + np.log(0.1)**2 + 5 + 5*np.log(0.1)
61
- + 5*np.log(0.1)**2 + 25)
62
- assert np.isclose(res, exp_100)
63
- # Series input, and irradiance = 0
64
- eff_irr = pd.Series([1000, 100, 0])
65
- tm = pd.Series([25, 30, 30])
66
- expected = pd.Series([pdc0, exp_100, 0])
67
- res = pvarray.huld(eff_irr, tm, pdc0, k=(1, 1, 1, 1, 1, 1))
68
- assert_series_equal(res, expected)
69
- with pytest.raises(ValueError,
70
- match='Either k or cell_type must be specified'):
71
- res = pvarray.huld(1000, 25, 100)