Commit b981f16a authored by Anthony Schrapffer's avatar Anthony Schrapffer
Browse files

Polygon of modelgrid : Handle the case lon/lat = 0

parent 5b030bc4
......@@ -96,10 +96,13 @@ def corners(indF, proj, istart, jstart, lon, lat) :
polyll=proj.ijll(polyg)
centll=proj.ijll([[istart+ij[0],jstart+ij[1]]])[0]
#
allon.append([p[0] for p in polyll])
allat.append([p[1] for p in polyll])
lons = [p[0] if p[0]!=0 else 0.0000001 for p in polyll]
lats = [p[1] if p[1]!=0 else 0.0000001 for p in polyll]
allon.append(lons)
allat.append(lats)
#
sphpoly=polygon.SphericalPolygon.from_lonlat([p[0] for p in polyll], [p[1] for p in polyll], center=centll)
sphpoly=polygon.SphericalPolygon.from_lonlat(lons, lats, center=centll)
#
areas.append((sphpoly.area())*EarthRadius**2)
cornerspoly.append(sphpoly)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment