pvlib 0.10.4__py3-none-any.whl → 0.11.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 (47) hide show
  1. pvlib/__init__.py +1 -0
  2. pvlib/albedo.py +168 -0
  3. pvlib/bifacial/utils.py +2 -1
  4. pvlib/data/ASTMG173.csv +2004 -0
  5. pvlib/iam.py +28 -28
  6. pvlib/iotools/__init__.py +0 -1
  7. pvlib/iotools/midc.py +15 -10
  8. pvlib/iotools/psm3.py +10 -25
  9. pvlib/iotools/srml.py +1 -61
  10. pvlib/iotools/surfrad.py +1 -1
  11. pvlib/irradiance.py +133 -95
  12. pvlib/location.py +16 -6
  13. pvlib/modelchain.py +2 -165
  14. pvlib/pvarray.py +7 -5
  15. pvlib/pvsystem.py +75 -106
  16. pvlib/scaling.py +4 -2
  17. pvlib/shading.py +350 -0
  18. pvlib/singlediode.py +37 -9
  19. pvlib/snow.py +3 -1
  20. pvlib/spectrum/__init__.py +5 -0
  21. pvlib/spectrum/mismatch.py +573 -43
  22. pvlib/spectrum/spectrl2.py +8 -8
  23. pvlib/tests/bifacial/test_utils.py +6 -5
  24. pvlib/tests/iotools/test_psm3.py +0 -18
  25. pvlib/tests/iotools/test_srml.py +1 -43
  26. pvlib/tests/test_albedo.py +84 -0
  27. pvlib/tests/test_inverter.py +2 -2
  28. pvlib/tests/test_irradiance.py +35 -2
  29. pvlib/tests/test_location.py +26 -18
  30. pvlib/tests/test_modelchain.py +0 -57
  31. pvlib/tests/test_pvsystem.py +73 -128
  32. pvlib/tests/test_shading.py +167 -1
  33. pvlib/tests/test_singlediode.py +68 -29
  34. pvlib/tests/test_spectrum.py +283 -22
  35. pvlib/tests/test_temperature.py +7 -7
  36. pvlib/tests/test_tools.py +24 -0
  37. pvlib/tests/test_transformer.py +60 -0
  38. pvlib/tools.py +27 -0
  39. pvlib/transformer.py +117 -0
  40. pvlib/version.py +1 -5
  41. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/METADATA +3 -4
  42. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/RECORD +46 -42
  43. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/WHEEL +1 -1
  44. pvlib/data/astm_g173_am15g.csv +0 -2003
  45. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/AUTHORS.md +0 -0
  46. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/LICENSE +0 -0
  47. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/top_level.txt +0 -0
pvlib/__init__.py CHANGED
@@ -4,6 +4,7 @@ from pvlib import ( # noqa: F401
4
4
  # list spectrum first so it's available for atmosphere & pvsystem (GH 1628)
5
5
  spectrum,
6
6
 
7
+ albedo,
7
8
  atmosphere,
8
9
  bifacial,
9
10
  clearsky,
pvlib/albedo.py ADDED
@@ -0,0 +1,168 @@
1
+ """
2
+ The ``albedo`` module contains functions for modeling albedo.
3
+ """
4
+
5
+ from pvlib.tools import sind
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ # Sources of for the albedo values are provided in
11
+ # pvlib.irradiance.get_ground_diffuse.
12
+ SURFACE_ALBEDOS = {
13
+ 'urban': 0.18,
14
+ 'grass': 0.20,
15
+ 'fresh grass': 0.26,
16
+ 'soil': 0.17,
17
+ 'sand': 0.40,
18
+ 'snow': 0.65,
19
+ 'fresh snow': 0.75,
20
+ 'asphalt': 0.12,
21
+ 'concrete': 0.30,
22
+ 'aluminum': 0.85,
23
+ 'copper': 0.74,
24
+ 'fresh steel': 0.35,
25
+ 'dirty steel': 0.08,
26
+ 'sea': 0.06,
27
+ }
28
+
29
+ WATER_COLOR_COEFFS = {
30
+ 'clear_water_no_waves': 0.13,
31
+ 'clear_water_ripples_up_to_2.5cm': 0.16,
32
+ 'clear_water_ripples_larger_than_2.5cm_occasional_whitecaps': 0.23,
33
+ 'clear_water_frequent_whitecaps': 0.3,
34
+ 'green_water_ripples_up_to_2.5cm': 0.22,
35
+ 'muddy_water_no_waves': 0.19
36
+ }
37
+
38
+ WATER_ROUGHNESS_COEFFS = {
39
+ 'clear_water_no_waves': 0.29,
40
+ 'clear_water_ripples_up_to_2.5cm': 0.7,
41
+ 'clear_water_ripples_larger_than_2.5cm_occasional_whitecaps': 1.25,
42
+ 'clear_water_frequent_whitecaps': 2,
43
+ 'green_water_ripples_up_to_2.5cm': 0.7,
44
+ 'muddy_water_no_waves': 0.29
45
+ }
46
+
47
+
48
+ def inland_water_dvoracek(solar_elevation, surface_condition=None,
49
+ color_coeff=None, wave_roughness_coeff=None):
50
+ r"""
51
+ Estimation of albedo for inland water bodies.
52
+
53
+ The available surface conditions are for inland water bodies, e.g., lakes
54
+ and ponds. For ocean/open sea, see
55
+ :py:const:`pvlib.albedo.SURFACE_ALBEDOS`.
56
+
57
+ Parameters
58
+ ----------
59
+ solar_elevation : numeric
60
+ Sun elevation angle. [degrees]
61
+
62
+ surface_condition : string, optional
63
+ If supplied, overrides ``color_coeff`` and ``wave_roughness_coeff``.
64
+ ``surface_condition`` can be one of the following:
65
+
66
+ * ``'clear_water_no_waves'``
67
+ * ``'clear_water_ripples_up_to_2.5cm'``
68
+ * ``'clear_water_ripples_larger_than_2.5cm_occasional_whitecaps'``
69
+ * ``'clear_water_frequent_whitecaps'``
70
+ * ``'green_water_ripples_up_to_2.5cm'``
71
+ * ``'muddy_water_no_waves'``
72
+
73
+ color_coeff : float, optional
74
+ Water color coefficient. [-]
75
+
76
+ wave_roughness_coeff : float, optional
77
+ Water wave roughness coefficient. [-]
78
+
79
+ Returns
80
+ -------
81
+ albedo : numeric
82
+ Albedo for inland water bodies. [-]
83
+
84
+ Raises
85
+ ------
86
+ ValueError
87
+ If neither of ``surface_condition`` nor a combination of
88
+ ``color_coeff`` and ``wave_roughness_coeff`` are given.
89
+ If ``surface_condition`` and any of ``color_coeff`` or
90
+ ``wave_roughness_coeff`` are given. These parameters are
91
+ mutually exclusive.
92
+
93
+ KeyError
94
+ If ``surface_condition`` is invalid.
95
+
96
+ Notes
97
+ -----
98
+ The equation for calculating the albedo :math:`\rho` is given by
99
+
100
+ .. math::
101
+ :label: albedo
102
+
103
+ \rho = c^{(r \cdot \sin(\alpha) + 1)}
104
+
105
+ Inputs to the model are the water color coefficient :math:`c` [-], the
106
+ water wave roughness coefficient :math:`r` [-] and the solar elevation
107
+ :math:`\alpha` [degrees]. Parameters are provided in [1]_ , and are coded
108
+ for convenience in :data:`~pvlib.albedo.WATER_COLOR_COEFFS` and
109
+ :data:`~pvlib.albedo.WATER_ROUGHNESS_COEFFS`. The values of these
110
+ coefficients are experimentally determined.
111
+
112
+ +------------------------+-------------------+-------------------------+
113
+ | Surface and condition | Color coefficient | Wave roughness |
114
+ | | (:math:`c`) | coefficient (:math:`r`) |
115
+ +========================+===================+=========================+
116
+ | Clear water, no waves | 0.13 | 0.29 |
117
+ +------------------------+-------------------+-------------------------+
118
+ | Clear water, ripples | 0.16 | 0.70 |
119
+ | up to 2.5 cm | | |
120
+ +------------------------+-------------------+-------------------------+
121
+ | Clear water, ripples | 0.23 | 1.25 |
122
+ | larger than 2.5 cm | | |
123
+ | (occasional whitecaps) | | |
124
+ +------------------------+-------------------+-------------------------+
125
+ | Clear water, | 0.30 | 2.00 |
126
+ | frequent whitecaps | | |
127
+ +------------------------+-------------------+-------------------------+
128
+ | Green water, ripples | 0.22 | 0.70 |
129
+ | up to 2.5cm | | |
130
+ +------------------------+-------------------+-------------------------+
131
+ | Muddy water, no waves | 0.19 | 0.29 |
132
+ +------------------------+-------------------+-------------------------+
133
+
134
+ References
135
+ ----------
136
+ .. [1] Dvoracek M.J., Hannabas B. (1990). "Prediction of albedo for use in
137
+ evapotranspiration and irrigation scheduling." IN: Visions of the Future
138
+ American Society of Agricultural Engineers 04-90: 692-699.
139
+ """
140
+
141
+ if surface_condition is not None and (
142
+ color_coeff is None and wave_roughness_coeff is None
143
+ ):
144
+ # use surface_condition
145
+ color_coeff = WATER_COLOR_COEFFS[surface_condition]
146
+ wave_roughness_coeff = WATER_ROUGHNESS_COEFFS[surface_condition]
147
+
148
+ elif surface_condition is None and not (
149
+ color_coeff is None or wave_roughness_coeff is None
150
+ ):
151
+ # use provided color_coeff and wave_roughness_coeff
152
+ pass
153
+ else:
154
+ raise ValueError(
155
+ "Either a `surface_condition` has to be chosen or"
156
+ " a combination of `color_coeff` and"
157
+ " `wave_roughness_coeff`.")
158
+
159
+ solar_elevation_positive = np.where(solar_elevation < 0, 0,
160
+ solar_elevation)
161
+
162
+ albedo = color_coeff ** (wave_roughness_coeff *
163
+ sind(solar_elevation_positive) + 1)
164
+
165
+ if isinstance(solar_elevation, pd.Series):
166
+ albedo = pd.Series(albedo, index=solar_elevation.index)
167
+
168
+ return albedo
pvlib/bifacial/utils.py CHANGED
@@ -4,6 +4,7 @@ modeling.
4
4
  """
5
5
  import numpy as np
6
6
  from pvlib.tools import sind, cosd, tand
7
+ from scipy.integrate import trapezoid
7
8
 
8
9
 
9
10
  def _solar_projection_tangent(solar_zenith, solar_azimuth, surface_azimuth):
@@ -220,7 +221,7 @@ def vf_ground_sky_2d_integ(surface_tilt, gcr, height, pitch, max_rows=10,
220
221
  vf = vf_ground_sky_2d(r, gcr, z, pitch, height, max_rows)
221
222
  fz_sky[:, k] = vf[:, 0] # remove spurious rotation dimension
222
223
  # calculate the integrated view factor for all of the ground between rows
223
- return np.trapz(fz_sky, z, axis=0)
224
+ return trapezoid(fz_sky, z, axis=0)
224
225
 
225
226
 
226
227
  def _vf_poly(surface_tilt, gcr, x, delta):