Skip to content

Commit 361bf75

Browse files
joferkingtonWeatherGod
authored andcommitted
Avoid writing degenerate lines in boundary data
1 parent 23dd289 commit 361bf75

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

utils/readboundaries_shp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@ def get_wdb_boundaries(resolution,level,rivers=False):
132132
if parts != [0]:
133133
print 'multipart polygon'
134134
raise SystemExit
135+
135136
verts = shp.points
137+
# Detect degenerate lines that are actually points...
138+
if len(verts) == 2 and np.allclose(verts[0], verts[1]):
139+
print 'Skipping degenerate line...'
140+
continue
141+
136142
lons, lats = list(zip(*verts))
137143
north = max(lats); south = min(lats)
138144
attdict={}

0 commit comments

Comments
 (0)