From 32619fb08f14b78ac29c77572c49c2e23079094c Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Tue, 9 Apr 2024 14:35:42 -0600 Subject: [PATCH] handle mixed types --- pvanalytics/features/snow.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pvanalytics/features/snow.py b/pvanalytics/features/snow.py index 179c1be9..4bdee425 100644 --- a/pvanalytics/features/snow.py +++ b/pvanalytics/features/snow.py @@ -262,15 +262,11 @@ def categorize(vmp_ratio, transmission, voltage, min_dcv, 50th Photovoltaic Specialists Conference (PVSC), San Juan, PR, USA, 2023, pp. 1-5, :doi:`10.1109/PVSC48320.2023.10360065`. """ - mode = np.zeros_like(voltage, dtype=object) # allows both int and None - umin = voltage > min_dcv # necessary for all modes except 0 uvr = np.where(vmp_ratio > threshold_vratio, 3, 1) utrans = np.where(transmission > threshold_transmission, 1, 0) - mode = umin * (uvr + utrans) - - # preserve nan - mode[np.isnan(vmp_ratio) | np.isnan(transmission)] = None + mode = np.where(np.isnan(vmp_ratio) | np.isnan(transmission), None, + umin * (uvr + utrans)) return mode