From b4aab17bd2adf8c37b51b31e97d6f7da55a90303 Mon Sep 17 00:00:00 2001 From: JB Date: Fri, 27 Mar 2026 16:45:18 +0100 Subject: [PATCH 1/5] Fix _m_to_cm: multiply by 100 to convert meters to cm --- pvlib/iotools/era5.py | 2 +- tests/iotools/test_era5.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pvlib/iotools/era5.py b/pvlib/iotools/era5.py index b19096b5f6..6736a4801b 100644 --- a/pvlib/iotools/era5.py +++ b/pvlib/iotools/era5.py @@ -37,7 +37,7 @@ def _j_to_w(j): def _m_to_cm(m): - return m / 100 + return m * 100 UNITS = { diff --git a/tests/iotools/test_era5.py b/tests/iotools/test_era5.py index bea2fe2ee1..c85116a10f 100644 --- a/tests/iotools/test_era5.py +++ b/tests/iotools/test_era5.py @@ -92,3 +92,7 @@ def test_get_era5_timeout(params): match = 'Request timed out. Try increasing' with pytest.raises(requests.exceptions.Timeout, match=match): df, meta = pvlib.iotools.get_era5(**params, timeout=1) + +def test_m_to_cm(): + from pvlib.iotools.era5 import _m_to_cm + assert _m_to_cm(0.01) == 1 # 0.01 m = 1 cm \ No newline at end of file From 7a88b7faafd7cbda028acf0c2f095a5b8091d8c8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Fri, 27 Mar 2026 16:55:35 +0100 Subject: [PATCH 2/5] Apply suggestion from @cwhanse Co-authored-by: Cliff Hansen --- tests/iotools/test_era5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/iotools/test_era5.py b/tests/iotools/test_era5.py index c85116a10f..b3ae93823f 100644 --- a/tests/iotools/test_era5.py +++ b/tests/iotools/test_era5.py @@ -93,6 +93,6 @@ def test_get_era5_timeout(params): with pytest.raises(requests.exceptions.Timeout, match=match): df, meta = pvlib.iotools.get_era5(**params, timeout=1) -def test_m_to_cm(): +def test__m_to_cm(): from pvlib.iotools.era5 import _m_to_cm assert _m_to_cm(0.01) == 1 # 0.01 m = 1 cm \ No newline at end of file From f9ada10b92b0e587bbf20fad80edf2e4a501aaa6 Mon Sep 17 00:00:00 2001 From: JB Date: Sat, 28 Mar 2026 08:06:33 +0100 Subject: [PATCH 3/5] Docs: document _m_to_cm conversion fix in changelog --- docs/sphinx/source/whatsnew/v0.15.1.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.15.1.rst b/docs/sphinx/source/whatsnew/v0.15.1.rst index f86fed987b..75ab242c94 100644 --- a/docs/sphinx/source/whatsnew/v0.15.1.rst +++ b/docs/sphinx/source/whatsnew/v0.15.1.rst @@ -20,6 +20,10 @@ Bug fixes * Fix a division-by-zero condition in :py:func:`pvlib.transformer.simple_efficiency` when ``load_loss = 0``. (:issue:`2645`, :pull:`2646`) +* Fix a bug in :py:func:`pvlib.iotools.era5._m_to_cm` where meters were + incorrectly divided by 100 instead of multiplied, causing precipitations to be + underestimated by a factor of 10,000 when ``map_variables=True``. + (:issue:`2724`, :pull:`2725`) Enhancements ~~~~~~~~~~~~ @@ -79,4 +83,5 @@ Contributors * Kevin Anderson (:ghuser:`kandersolar`) * Rohan Saxena (:ghuser:`r0hansaxena`) * Marco Fumagalli (:ghuser:`fuma900`) +* Jean-Baptiste Pasquier (:ghuser:`pasquierjb`) From 9ed0f2dda309264c94fa2029b6d5c325238f256b Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Sat, 28 Mar 2026 07:36:02 -0700 Subject: [PATCH 4/5] Update tests/iotools/test_era5.py Co-authored-by: Rajiv Daxini <143435106+RDaxini@users.noreply.github.com> --- tests/iotools/test_era5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/iotools/test_era5.py b/tests/iotools/test_era5.py index b3ae93823f..01c22b03d1 100644 --- a/tests/iotools/test_era5.py +++ b/tests/iotools/test_era5.py @@ -95,4 +95,4 @@ def test_get_era5_timeout(params): def test__m_to_cm(): from pvlib.iotools.era5 import _m_to_cm - assert _m_to_cm(0.01) == 1 # 0.01 m = 1 cm \ No newline at end of file + assert _m_to_cm(0.01) == 1 # 0.01 m = 1 cm From daf1dc25b5477035e50c68a09b92809e254c1f4f Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Sat, 28 Mar 2026 07:41:47 -0700 Subject: [PATCH 5/5] Apply suggestion from @RDaxini Co-authored-by: Rajiv Daxini <143435106+RDaxini@users.noreply.github.com> --- tests/iotools/test_era5.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/iotools/test_era5.py b/tests/iotools/test_era5.py index 01c22b03d1..452097c83c 100644 --- a/tests/iotools/test_era5.py +++ b/tests/iotools/test_era5.py @@ -93,6 +93,7 @@ def test_get_era5_timeout(params): with pytest.raises(requests.exceptions.Timeout, match=match): df, meta = pvlib.iotools.get_era5(**params, timeout=1) + def test__m_to_cm(): from pvlib.iotools.era5 import _m_to_cm assert _m_to_cm(0.01) == 1 # 0.01 m = 1 cm