Skip to content

Commit 0ef3d7a

Browse files
committed
Merge branch 'main' of https://github.com/pvlib/pvlib-python into snow_depth
2 parents d46837c + 9fb2eb3 commit 0ef3d7a

File tree

15 files changed

+434
-65
lines changed

15 files changed

+434
-65
lines changed

docs/examples/shading/plot_martinez_shade_loss.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import pandas as pd
4848
import numpy as np
4949
import matplotlib.pyplot as plt
50-
from matplotlib.dates import ConciseDateFormatter
50+
from matplotlib.dates import DateFormatter
5151

5252
pitch = 4 # meters
5353
width = 1.5 # meters
@@ -235,10 +235,6 @@
235235
ax1.plot(times, shade_losses, label=k, linestyle=linestyle)
236236
ax1.legend(loc="upper center")
237237
ax1.grid()
238-
ax1.set_xlabel("Time")
239-
ax1.xaxis.set_major_formatter(
240-
ConciseDateFormatter("%H:%M", tz="Europe/Madrid")
241-
)
242238
ax1.set_ylabel(r"$P_{out}$ losses")
243239
ax1.set_title("Per module")
244240

@@ -248,9 +244,7 @@
248244
ax2.legend(loc="upper center")
249245
ax2.grid()
250246
ax2.set_xlabel("Time")
251-
ax2.xaxis.set_major_formatter(
252-
ConciseDateFormatter("%H:%M", tz="Europe/Madrid")
253-
)
247+
ax2.xaxis.set_major_formatter(DateFormatter("%H:%M", tz="Europe/Madrid"))
254248
ax2.set_ylabel(r"$P_{out}$ losses")
255249
ax2.set_title("Per row")
256250
fig.tight_layout()

docs/sphinx/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373

7474
# Enable hover tooltips
7575
hoverxref_auto_ref = True
76-
hoverxref_roles = ["class", "meth", "func", "ref", "term"]
76+
hoverxref_roles = [
77+
"class", "meth", "func", "ref", "term", "obj", "mod", "data"
78+
]
7779
hoverxref_role_types = dict.fromkeys(hoverxref_roles, "tooltip")
7880
hoverxref_domains = ["py"]
7981
hoverxref_intersphinx = list(intersphinx_mapping.keys())

docs/sphinx/source/reference/airmass_atmospheric.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Airmass and atmospheric models
1111
atmosphere.get_relative_airmass
1212
atmosphere.pres2alt
1313
atmosphere.alt2pres
14+
atmosphere.tdew_from_rh
15+
atmosphere.rh_from_tdew
1416
atmosphere.gueymard94_pw
1517
atmosphere.first_solar_spectral_correction
1618
atmosphere.bird_hulstrom80_aod_bb

docs/sphinx/source/whatsnew.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ What's New
66

77
These are new features and improvements of note in each release.
88

9+
.. include:: whatsnew/v0.11.3.rst
910
.. include:: whatsnew/v0.11.2.rst
1011
.. include:: whatsnew/v0.11.1.rst
1112
.. include:: whatsnew/v0.11.0.rst
Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
.. _whatsnew_01120:
22

33

4-
v0.11.2 (Anticipated December, 2024)
5-
------------------------------------
4+
v0.11.2 (December 16, 2024)
5+
---------------------------
66

77
Deprecations
88
~~~~~~~~~~~~
9-
* Deprecated terms ``dni_clearsky`` and ``clearsky_dni``, replaced with ``dni_clear``.
10-
Affected functions are :py:func:`~pvlib.irradiance.dirindex` and :py:func:`~pvlib.irradiance.dni`.
11-
(:issue:`2272`, :pull:`2274`)
12-
9+
* Deprecate terms ``dni_clearsky`` and ``clearsky_dni``, replace with ``dni_clear`` and ``ghi_clear``.
10+
Affected functions are :py:func:`~pvlib.irradiance.dirindex`, :py:func:`~pvlib.irradiance.dni`
11+
and :py:func:`~pvlib.irradiance.clearsky_index`.
1312

1413
Enhancements
1514
~~~~~~~~~~~~
15+
* Add :py:func:`~pvlib.atmosphere.rh_from_tdew` and :py:func:`~pvlib.atmosphere.tdew_from_rh`.
16+
(:issue:`1744`, :pull:`2286`)
1617
* :py:func:`~pvlib.ivtools.sdm.fit_desoto` now allows input of initial
1718
parameter guesses. (:issue:`1014`, :pull:`2291`)
1819

@@ -28,49 +29,51 @@ Bug Fixes
2829

2930
Bug fixes
3031
~~~~~~~~~
32+
* Change ``dni_extra`` to a required parameter in :py:func:`pvlib.irradiance.ghi_from_poa_driesse_2023`
33+
(:issue:`2279` :pull:`2331`)
3134
* :py:func:`~pvlib.spa.julian_day_dt` now accounts for the 10 day difference
3235
between Julian and Gregorian calendars prior to the year 1582. (:issue:`2077`, :pull:`2249`)
36+
* Correct sign of temperature coefficient ``dEgdT`` in :py:func:`~pvlib.ivtools.sdm.fit_desoto_sandia`.
37+
Results may differ slightly from previous versions. (:issue:`2311`, :pull:`2322`)
3338

3439
Documentation
3540
~~~~~~~~~~~~~
36-
* Edited docstrings for :py:func:`~pvlib.pvsystem.dc_ohms_from_percent` and
41+
* Edit docstrings for :py:func:`~pvlib.pvsystem.dc_ohms_from_percent` and
3742
:py:func:`~pvlib.pvsystem.dc_ohmic_losses` for clarity. (:issue:`1601`, :pull:`2229`)
38-
* Added 'freestanding' and 'insulated' `racking_model` options for cell
39-
temperature calculation in :py:class:`~pvlib.pvsystem.PVSystem`
43+
* Add 'freestanding' and 'insulated' `racking_model` options for cell
44+
temperature calculation in :py:class:`~pvlib.pvsystem.PVSystem`,
4045
:py:class:`~pvlib.pvsystem.SingleAxisTrackerMount`, and
4146
:py:class:`~pvlib.pvsystem.FixedMount` docstrings. Various formatting edits
4247
for clarity. (:issue:`1942`, :pull:`2232`)
43-
* Added a new citation style guide (:ref:`reference_style`) to the contributing
44-
page. (:issue:`2202`, :pull:`2226`)
45-
* Updated :py:func:`~pvlib.irradiance.reindl` to include definitions of terms
48+
* Update :py:func:`~pvlib.irradiance.reindl` to include definitions of terms
4649
and a new "notes" section (:issue:`2183`, :pull:`2193`)
47-
* Clarified the error message in :py:func:`~pvlib.clearsky.detect_clearsky` when
50+
* Clarify the error message in :py:func:`~pvlib.clearsky.detect_clearsky` when
4851
windows contain fewer than three data points (:issue:`2005`, :pull:`2281`)
49-
* Added a new :ref:`nomenclature` page, in place of the Variables and Symbols
52+
* Clarify mounting cases for parameters for :py:func:`~pvlib.temperature.sapm_module`,
53+
:py:func:`~pvlib.temperature.sapm_cell` and :py:func:`~pvlib.temperature.pvsyst_cell`.
54+
(:issue:`1323`, :pull:`2293`)
55+
* Add an example to :py:func:`~pvlib.pvsystem.retrieve_sam` docstring to
56+
demonstrate how to retrieve a database from the SAM repo. (:pull:`2313`)
57+
* Add a new citation style guide (:ref:`reference_style`) to the contributing
58+
page. (:issue:`2202`, :pull:`2226`)
59+
* Explain how to write docstrings for new functions in :ref:`example-docstring`
60+
(:discuss:`2081`, :pull:`2254`)
61+
* Add a section in the style guide for parameter naming and units best practices.
62+
See :ref:`documentation-units`. (:issue:`2205`, :pull:`2248`)
63+
* Add a new :ref:`nomenclature` page, in place of the Variables and Symbols
5064
page, using the sphinx glossary directive. (:issue:`1421`, :pull:`2234`)
51-
* Explained how to write docstrings for new functions in :ref:`example-docstring`
52-
(:discussion:`2081`, :pull:`2254`)
53-
* Added the following variables to the :ref:`nomenclature` page:
65+
* Add the following variables to the :ref:`nomenclature` page:
5466

5567
- `spectra` and `spectra_components` (:issue:`2150`, :pull:`2264`)
5668

57-
* Added a section in the style guide for parameter naming and units best practices.
58-
See :ref:`documentation-units`. (:issue:`2205`, :pull:`2248`)
59-
* Added a example to :py:func:`~pvlib.pvsystem.retrieve_sam` docstring to
60-
demonstrate how to retrieve a database from the SAM repo. (:pull:`2313`)
6169

6270
Testing
6371
~~~~~~~
64-
* Updated test files to track new PVGIS 5.3 data. (:pull:`2305`)
65-
66-
67-
Requirements
68-
~~~~~~~~~~~~
69-
72+
* Update test files to track new PVGIS 5.3 data. (:pull:`2305`)
7073

7174
Maintenance
7275
~~~~~~~~~~~
73-
* Added a decorator to deprecate renamed keyword arguments in functions,
76+
* Add a decorator to deprecate renamed keyword arguments in functions,
7477
:py:func:`pvlib._deprecation.renamed_kwarg_warning`. (:pull:`2237`)
7578

7679

@@ -81,7 +84,22 @@ Contributors
8184
* Dave Pitts (:ghuser:`dgapitts`)
8285
* Kurt Rhee (:ghuser:`kurt-rhee`)
8386
* Mark Mikofski (:ghuser:`mikofski`)
84-
* matsuobasho (:ghuser:`matsuobasho`)
87+
* Roma Koulikov (:ghuser:`matsuobasho`)
8588
* Echedey Luis (:ghuser:`echedey-ls`)
8689
* Kevin Anderson (:ghuser:`kandersolar`)
8790
* Scott Nelson (:ghuser:`scttnlsn`)
91+
* Ioannis Sifnaios (:ghuser:`IoannisSifnaios`)
92+
* Adam R. Jensen (:ghuser:`AdamRJensen`)
93+
* Anton Driesse (:ghuser:`adriesse`)
94+
* Will Holmgren (:ghuser:`wholmgren`)
95+
* Umay Akkoseoglu (:ghuser:`uakkoseo`)
96+
* Mark Campanelli (:ghuser:`markcampanelli`)
97+
* :ghuser:`iblasi`
98+
* Hiromasa Ihara (:ghuser:`miettal`)
99+
* Yunho Kee (:ghuser:`yhkee0404`)
100+
* Hamilton Kibbe (:ghuser:`hamiltonkibbe`)
101+
* Felix Korbelius (:ghuser:`FelixKoTU`)
102+
* Michael Deceglie (:ghuser:`mdeceglie`)
103+
* Will Hobbs (:ghuser:`williamhobbs`)
104+
* Todd Karin (:ghuser:`toddkarin`)
105+
* Lucas Schneeberger (:ghuser:`lucasschn`)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.. _whatsnew_01130:
2+
3+
4+
v0.11.3 (Anticipated March, 2025)
5+
---------------------------------
6+
7+
Deprecations
8+
~~~~~~~~~~~~
9+
10+
11+
Enhancements
12+
~~~~~~~~~~~~
13+
14+
15+
Documentation
16+
~~~~~~~~~~~~~
17+
18+
19+
Testing
20+
~~~~~~~
21+
22+
23+
Requirements
24+
~~~~~~~~~~~~
25+
26+
27+
Contributors
28+
~~~~~~~~~~~~
29+
30+

pvlib/atmosphere.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,85 @@ def gueymard94_pw(temp_air, relative_humidity):
337337
return pw
338338

339339

340+
def rh_from_tdew(temp_air, temp_dew, coeff=(6.112, 17.62, 243.12)):
341+
"""
342+
Calculate relative humidity from dewpoint temperature using the Magnus
343+
equation.
344+
345+
Parameters
346+
----------
347+
temp_air : numeric
348+
Air temperature (dry-bulb temperature). [°C]
349+
temp_dew : numeric
350+
Dew-point temperature. [°C]
351+
coeff : tuple, default (6.112, 17.62, 243.12)
352+
Magnus equation coefficients (A, B, C). The default values are those
353+
recommended by the WMO [1]_.
354+
355+
Returns
356+
-------
357+
numeric
358+
Relative humidity (0.0-100.0). [%]
359+
360+
References
361+
----------
362+
.. [1] "Guide to Instruments and Methods of Observation",
363+
World Meteorological Organization, WMO-No. 8, 2023.
364+
https://library.wmo.int/idurl/4/68695
365+
"""
366+
367+
# Calculate vapor pressure (e) and saturation vapor pressure (es)
368+
e = coeff[0] * np.exp((coeff[1] * temp_air) / (coeff[2] + temp_air))
369+
es = coeff[0] * np.exp((coeff[1] * temp_dew) / (coeff[2] + temp_dew))
370+
371+
# Calculate relative humidity as percentage
372+
relative_humidity = 100 * (es / e)
373+
374+
return relative_humidity
375+
376+
377+
def tdew_from_rh(temp_air, relative_humidity, coeff=(6.112, 17.62, 243.12)):
378+
"""
379+
Calculate dewpoint temperature using the Magnus equation.
380+
This is a reversal of the calculation in :py:func:`rh_from_tdew`.
381+
382+
Parameters
383+
----------
384+
temp_air : numeric
385+
Air temperature (dry-bulb temperature). [°C]
386+
relative_humidity : numeric
387+
Relative humidity (0-100). [%]
388+
coeff: tuple, default (6.112, 17.62, 243.12)
389+
Magnus equation coefficients (A, B, C). The default values are those
390+
recommended by the WMO [1]_.
391+
392+
Returns
393+
-------
394+
numeric
395+
Dewpoint temperature. [°C]
396+
397+
References
398+
----------
399+
.. [1] "Guide to Instruments and Methods of Observation",
400+
World Meteorological Organization, WMO-No. 8, 2023.
401+
https://library.wmo.int/idurl/4/68695
402+
"""
403+
# Calculate the term inside the log
404+
# From RH = 100 * (es/e), we get es = (RH/100) * e
405+
# Substituting the Magnus equation and solving for dewpoint
406+
407+
# First calculate ln(es/A)
408+
ln_term = (
409+
(coeff[1] * temp_air) / (coeff[2] + temp_air)
410+
+ np.log(relative_humidity/100)
411+
)
412+
413+
# Then solve for dewpoint
414+
dewpoint = coeff[2] * ln_term / (coeff[1] - ln_term)
415+
416+
return dewpoint
417+
418+
340419
first_solar_spectral_correction = deprecated(
341420
since='0.10.0',
342421
alternative='pvlib.spectrum.spectral_factor_firstsolar'

pvlib/clearsky.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@ def haurwitz(apparent_zenith):
327327
'''
328328

329329
cos_zenith = tools.cosd(apparent_zenith.values)
330-
clearsky_ghi = np.zeros_like(apparent_zenith.values)
330+
ghi_clear = np.zeros_like(apparent_zenith.values)
331331
cos_zen_gte_0 = cos_zenith > 0
332-
clearsky_ghi[cos_zen_gte_0] = (1098.0 * cos_zenith[cos_zen_gte_0] *
333-
np.exp(-0.059/cos_zenith[cos_zen_gte_0]))
332+
ghi_clear[cos_zen_gte_0] = (1098.0 * cos_zenith[cos_zen_gte_0] *
333+
np.exp(-0.059/cos_zenith[cos_zen_gte_0]))
334334

335335
df_out = pd.DataFrame(index=apparent_zenith.index,
336-
data=clearsky_ghi,
336+
data=ghi_clear,
337337
columns=['ghi'])
338338

339339
return df_out

0 commit comments

Comments
 (0)