pytroll / pyresample

Geospatial image resampling in Python
http://pyresample.readthedocs.org
GNU Lesser General Public License v3.0
349 stars 94 forks source link

`__contains__`, `overlaps`, `overlap_rate`, `intersection`, `get_area` methods provide errors/wrong results for geos AreaDef / SwathDef #412

Open ghiggi opened 2 years ago

ghiggi commented 2 years ago

Problem description

The methods __contains__, overlaps, overlap_rate, intersection, contains, get_area implemented in BaseDefinition class employs a polygon defined by the centroid of the pixel corners of the SwathDef / AreaDef to perform the geometrical computations. While this works correctly for many classical AreaDefinition, for:

Code example for GEO AreaDef

import satpy
geometry_def = satpy.resample.get_area_def("goes_east_abi_f_1km")
geometry_def.corners   # --> Illegal (lon, lat) coordinates: (inf, inf)
geometry_def.outer_boundary_corners # --> Illegal (lon, lat) coordinates: (inf, inf)
geometry_def.get_area() # --> Illegal (lon, lat) coordinates: (inf, inf)
geometry_def.overlaps(geometry_def) # --> Illegal (lon, lat) coordinates: (inf, inf)
geometry_def.overlap_rate(geometry_def) # --> Illegal (lon, lat) coordinates: (inf, inf)
geometry_def.intersection(geometry_def) # --> Illegal (lon, lat) coordinates: (inf, inf)
(10,20) in geometry_def # __contains__ method  # --> Illegal (lon, lat) coordinates: (inf, inf)

Proposed solution:

Draft PR coming in the next days ...

gerritholl commented 2 years ago

In your "see also" you referred once to #268 and twice to #393. Was there a third issue you meant to link?