Skip to content

Commit

Permalink
add check for numpy array
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasjkeel committed Jan 16, 2025
1 parent 16f7fb2 commit 8672f4c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions jsmetrics/utils/spatial_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,9 @@ def get_one_contour_linestring(dataarray, contour_level):
), "Data array needs to have latitude and longitude coords"
if "time" in dataarray.dims:
dataarray = dataarray.squeeze("time")
try:
assert contour_level == False
except:
raise AssertionError(f"FAILED: {type(contour_level)}")
one_contour = dataarray.plot.contour(levels=[float(contour_level[0])])
if not isinstance(contour_level, np.ndarray):
contour_level = np.array(contour_level)
one_contour = dataarray.plot.contour(levels=[float(contour_level)])
matplotlib.pyplot.close()
one_contour_segments = seperate_one_contour_into_line_segments(
one_contour.get_paths()[0]
Expand Down

0 comments on commit 8672f4c

Please sign in to comment.