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

Generalize for absent fields cyclone or valid

This occurs when we read results from the Matlab program.
parent 01a4802e
No related branches found
No related tags found
No related merge requests found
......@@ -75,17 +75,21 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
points = shape_rec_extr.shape.points[0]
if shape_rec_extr.record.cyclone == 0:
# Anti-cyclone
color = "red"
if "cyclone" in shape_rec_extr.record:
if shape_rec_extr.record.cyclone == 0:
# Anti-cyclone
color = "red"
else:
color = "blue"
else:
color = "blue"
color = "green"
lines = ax.plot(points[0], points[1], markersize = 10,
color = color, fillstyle = "none",
transform = src_crs)
if shape_rec_extr.record.valid == 1:
if "valid" not in shape_rec_extr.record \
or shape_rec_extr.record.valid == 1:
if light:
lines[0].set_marker("+")
else:
......@@ -107,7 +111,8 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
transform = src_crs)
if not light:
if shape_rec_extr.record.valid == 0:
if "valid" in shape_rec_extr.record \
and shape_rec_extr.record.valid == 0:
# Invalid outermost contour
lines[0].set_marker("s")
lines[0].set_fillstyle("none")
......@@ -122,11 +127,14 @@ 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 shape_rec_extr.record.cyclone == 0:
# Anti-cyclone
color = "magenta"
if "cyclone" in shape_rec_extr.record:
if shape_rec_extr.record.cyclone == 0:
# Anti-cyclone
color = "magenta"
else:
color = "cyan"
else:
color = "cyan"
color = "green"
lines = ax.plot(points[:, 0], points[:, 1], color = color,
transform = src_crs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment