From 0fc64426f7b6ed6cae4a2402a15dfb9105d3ffbc Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 24 Sep 2025 10:30:41 -0400 Subject: [PATCH 1/2] allow ValueError for older pandas versions --- pvlib/iotools/meteonorm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvlib/iotools/meteonorm.py b/pvlib/iotools/meteonorm.py index 5cc24f071c..2527f3bc8f 100644 --- a/pvlib/iotools/meteonorm.py +++ b/pvlib/iotools/meteonorm.py @@ -537,14 +537,14 @@ def _get_meteonorm( start = pd.Timestamp(start) start = start.tz_localize("UTC") if start.tzinfo is None else start start = start.strftime("%Y-%m-%dT%H:%M:%SZ") - except DateParseError: + except (ValueError, DateParseError): pass if (end is not None) & (end != 'now'): try: end = pd.Timestamp(end) end = end.tz_localize("UTC") if end.tzinfo is None else end end = end.strftime("%Y-%m-%dT%H:%M:%SZ") - except DateParseError: + except (ValueError, DateParseError): pass params = { From 8af26c3551cf308a7e6af6b5c1da38a7cf7032b1 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 24 Sep 2025 10:37:08 -0400 Subject: [PATCH 2/2] add explanatory comment --- pvlib/iotools/meteonorm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pvlib/iotools/meteonorm.py b/pvlib/iotools/meteonorm.py index 2527f3bc8f..88af396e42 100644 --- a/pvlib/iotools/meteonorm.py +++ b/pvlib/iotools/meteonorm.py @@ -532,6 +532,8 @@ def _get_meteonorm( # Check for None type in case of TMY request # Check for DateParseError in case of relative times, e.g., '+3hours' + # TODO: remove ValueError when our minimum pandas version is high enough + # to make it unnecessary (2.0?) if (start is not None) & (start != 'now'): try: start = pd.Timestamp(start)