Skip to content

Commit 04b7588

Browse files
joferkingtonWeatherGod
authored andcommitted
Add fix for incorrect Antarctica polygon
1 parent 3298462 commit 04b7588

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

utils/readboundaries_shp.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,31 @@ def get_coast_polygons(resolution):
8888
if lsd is not None:
8989
b = quantize(b,lsd)
9090
polybounds.append(b)
91+
92+
# Manual fix for incorrect Antarctica polygons at full resolution
93+
# This issue is only present in the shapefile version and may be fixed
94+
# in future versions of GSHHS!
95+
if resolution == 'f' and level == 5:
96+
i = [item[-1] for item in polymeta].index('4-E')
97+
coords = polybounds[i][2:-1, :]
98+
coords = np.vstack([coords,
99+
[180.0, -90.0],
100+
[0.0, -90.0]]).astype(np.float32)
101+
polybounds[i] = coords
102+
polymeta[i][-2] = len(coords)
103+
104+
j = [item[-1] for item in polymeta].index('4-W')
105+
coords = polybounds[j][3:, :]
106+
np.savetxt('coordinates.txt', coords)
107+
coords = np.vstack([coords,
108+
[0.0, coords[-1][1]],
109+
[0.0, -90.0],
110+
[-180.0, -90.0],
111+
coords[0]]).astype(np.float32)
112+
113+
polybounds[j] = coords
114+
polymeta[j][-2] = len(coords)
115+
91116
return polybounds, polymeta
92117

93118
def get_wdb_boundaries(resolution,level,rivers=False):

0 commit comments

Comments
 (0)