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

Bug fix: convert polyline to list

Method poly of shapefile writer requires a list of lists, not a list
of numpy arrays. This bug goes unnoticed in pyshp `2.1.0` but raises an
exception with pyshp `2.1.3`.
parent f6182656
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,7 @@ def write(writers, cell, cyclone):
eddy_index = eddy_index)
lon = matlab_data[eddy[4]][:].squeeze()
lat = matlab_data[eddy[5]][:].squeeze()
polyline = np.stack((lon, lat), axis = 1)
polyline = np.stack((lon, lat), axis = 1).tolist()
writers["outer"].poly([polyline])
if cyclone:
......@@ -81,7 +81,7 @@ def write(writers, cell, cyclone):
eddy_index = eddy_index)
lon = matlab_data[eddy[8]][:].squeeze()
lat = matlab_data[eddy[9]][:].squeeze()
polyline = np.stack((lon, lat), axis = 1)
polyline = np.stack((lon, lat), axis = 1).tolist()
writers["max_speed"].poly([polyline])
n_shapes = len(writers["extr"])
......
......@@ -77,7 +77,7 @@ def write(writers, cell, cyclone):
writers["outer"].record(r_eq_area = eddy[6], ssh = ssh, days_1950 = d,
eddy_index = eddy_index)
polyline = np.stack((eddy[4], eddy[5]), axis = 1)
polyline = np.stack((eddy[4], eddy[5]), axis = 1).tolist()
writers["outer"].poly([polyline])
if cyclone:
......@@ -87,7 +87,7 @@ def write(writers, cell, cyclone):
writers["max_speed"].record(r_eq_area = eddy[10], ssh = ssh,
days_1950 = d, eddy_index = eddy_index)
polyline = np.stack((eddy[8], eddy[9]), axis = 1)
polyline = np.stack((eddy[8], eddy[9]), axis = 1).tolist()
writers["max_speed"].poly([polyline])
n_shapes = len(writers["extr"])
......
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