Commit 0c845db5 authored by Anthony's avatar Anthony
Browse files

Correcting some issues related to Spherical Geometry

parent b866f085
......@@ -216,6 +216,7 @@ def getland (geo, ist, ni, jst, nj) :
sys.exit()
elif "Contfrac" in vn :
land=geo.variables["Contfrac"][jst:jst+nj,ist:ist+ni]
land=np.ma.filled(land,0)
elif "elevation" in vn :
land=geo.variables["elevation"][jst:jst+nj,ist:ist+ni]
if "missing_value" in geo.variables["elevation"].ncattrs() :
......
......@@ -159,11 +159,13 @@ class compweights :
if hydrocell.contains_point(inside) and cell.contains_point(inside):
area_in[index[0],index[1]] = min(inter.area(), hydrocell.area())*(EarthRadius**2)
else:
if 4*np.pi-inter.area() > inter.area() :
ERROR("Point inside intersection polygone is outside of both gridboxes but no solution !")
area_in[index[0],index[1]] = 0.0
ar = min(inter.area(),(4*np.pi-inter.area())*(EarthRadius**2))
# The condition for the area to be realistic is smaller than the larger area of the polygon considered
if ar < max(area, hydrocell.area()*(EarthRadius**2)):
area_in[index[0],index[1]] = ar
else :
area_in[index[0],index[1]] = (4*np.pi-inter.area())*(EarthRadius**2)
ERROR("Point inside intersection polygone is outside of both gridboxes but no solution !")
area_in[index[0],index[1]] = 0.0
##############
# Output of Overlap areas for each grid point
......
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