File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -624,8 +624,8 @@ def _draw_pulse_axis(
624624 """Draw pulse-mode colour bar (blue=Long, orange=Short) using time-proportional x."""
625625 from matplotlib .patches import Rectangle
626626
627- colors = {0 : "#2196F3" , 1 : "#FF9800" }
628- labels_map = {0 : "Long pulse" , 1 : "Short pulse" }
627+ colors = {0 : "#2196F3" , 1 : "#FF9800" , - 1 : "#9E9E9E" }
628+ labels_map = {0 : "Long pulse" , 1 : "Short pulse" , - 1 : "Unknown" }
629629
630630 x_min , x_max = x_hours [0 ], x_hours [- 1 ]
631631 total_span = x_max - x_min
@@ -738,7 +738,11 @@ def render_echogram(
738738
739739 pulse_mode = None
740740 if "pulse_mode" in ds :
741- pulse_mode = ds ["pulse_mode" ].values
741+ pm = ds ["pulse_mode" ].values
742+ # Replace NaN with -1 (unknown) so int conversion works
743+ if np .issubdtype (pm .dtype , np .floating ):
744+ pm = np .where (np .isnan (pm ), - 1 , pm ).astype (np .int8 )
745+ pulse_mode = pm
742746
743747 has_pulse = pulse_mode is not None
744748
You can’t perform that action at this time.
0 commit comments