Skip to content
Snippets Groups Projects
Commit 890dd970 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Bug fix: cannot test field with `in`

A record is not a dictionary. The bug comes from commit 1431d67b.
parent 4e2ab0a6
No related branches found
No related tags found
No related merge requests found
......@@ -75,20 +75,20 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
points = shape_rec_extr.shape.points[0]
if "cyclone" in shape_rec_extr.record:
try:
if shape_rec_extr.record.cyclone == 0:
# Anti-cyclone
color = "red"
else:
color = "blue"
else:
except AttributeError:
color = "green"
lines = ax.plot(points[0], points[1], markersize = 10,
color = color, fillstyle = "none",
transform = src_crs)
if "valid" not in shape_rec_extr.record \
if not hasattr(shape_rec_extr.record, "valid") \
or shape_rec_extr.record.valid == 1:
if light:
lines[0].set_marker("+")
......@@ -111,7 +111,7 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
transform = src_crs)
if not light:
if "valid" in shape_rec_extr.record \
if hasattr(shape_rec_extr.record, "valid") \
and shape_rec_extr.record.valid == 0:
# Invalid outermost contour
lines[0].set_marker("s")
......@@ -127,13 +127,13 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
if shape_m_s != None and shape_m_s.shapeType != shapefile.NULL:
points = np.array(shape_m_s.points)
if "cyclone" in shape_rec_extr.record:
try:
if shape_rec_extr.record.cyclone == 0:
# Anti-cyclone
color = "magenta"
else:
color = "cyan"
else:
except AttributeError:
color = "green"
lines = ax.plot(points[:, 0], points[:, 1], color = color,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment