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,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)