`__contains__`, `overlaps`, `overlap_rate`, `intersection`, `get_area` methods provide errors/wrong results for geos AreaDef / SwathDef
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 385
- Forks
- 102
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 9
Description
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:
- Geostationary AreaDef all methods crash (because of Inf values at the corners) (see also #393, #268) 3https://github.com/pytroll/pyresample/issues/393
- SwathDefinition, the corners of lats/lons arrays does not provide meaningful values in the case of ascending and descending orbits within SwathDefinition ...
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:
- Definition of
boundarymethod for SwathDefinition and AreaDefinition to retrieveAreaBoundaryclass - Definition of
SphPolygonfromAreaBoundaryusingself.polygon() - Enhancement of spherical.py geometrical operations
- Upgrade of
BaseDefinitionmethods to useself.boundary().polygon().<method>(...)
Draft PR coming in the next days ...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the BaseDefinition methods listed in the issue and inspect spherical.py, then trace the proposed AreaBoundary and polygon() entry points for AreaDefinition and SwathDefinition. Done means the listed geometry methods no longer fail on geostationary AreaDef inputs or produce wrong results for the described SwathDefinition cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100