Skip to content

Commit

Permalink
handle mixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
cwhanse committed Apr 9, 2024
1 parent 8a73eef commit 32619fb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pvanalytics/features/snow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 32619fb

Please sign in to comment.