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, ...@@ -75,17 +75,21 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
points = shape_rec_extr.shape.points[0] points = shape_rec_extr.shape.points[0]
if shape_rec_extr.record.cyclone == 0: if "cyclone" in shape_rec_extr.record:
# Anti-cyclone if shape_rec_extr.record.cyclone == 0:
color = "red" # Anti-cyclone
color = "red"
else:
color = "blue"
else: else:
color = "blue" color = "green"
lines = ax.plot(points[0], points[1], markersize = 10, lines = ax.plot(points[0], points[1], markersize = 10,
color = color, fillstyle = "none", color = color, fillstyle = "none",
transform = src_crs) 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: if light:
lines[0].set_marker("+") lines[0].set_marker("+")
else: else:
...@@ -107,7 +111,8 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False, ...@@ -107,7 +111,8 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
transform = src_crs) transform = src_crs)
if not light: 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 # Invalid outermost contour
lines[0].set_marker("s") lines[0].set_marker("s")
lines[0].set_fillstyle("none") lines[0].set_fillstyle("none")
...@@ -122,11 +127,14 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False, ...@@ -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: if shape_m_s != None and shape_m_s.shapeType != shapefile.NULL:
points = np.array(shape_m_s.points) points = np.array(shape_m_s.points)
if shape_rec_extr.record.cyclone == 0: if "cyclone" in shape_rec_extr.record:
# Anti-cyclone if shape_rec_extr.record.cyclone == 0:
color = "magenta" # Anti-cyclone
color = "magenta"
else:
color = "cyan"
else: else:
color = "cyan" color = "green"
lines = ax.plot(points[:, 0], points[:, 1], color = color, lines = ax.plot(points[:, 0], points[:, 1], color = color,
transform = src_crs) transform = src_crs)
......
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