Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4 tasks
ghiggi opened this issue Jan 4, 2022 · 1 comment

Comments

@ghiggi
Copy link
Contributor

ghiggi commented Jan 4, 2022

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:

  • Definition of boundary method for SwathDefinition and AreaDefinition to retrieve AreaBoundary class
  • Definition of SphPolygon from AreaBoundary using self.polygon()
  • Enhancement of spherical.py geometrical operations
  • Upgrade of BaseDefinition methods to use self.boundary().polygon().<method>(...)

Draft PR coming in the next days ...

@ghiggi ghiggi changed the title __contains__, overlaps, overlap_rate, intersection, get_area methods provide errors/wrong results for SwathDef, polar/geos AreaDef __contains__, overlaps, overlap_rate, intersection, get_area methods provide errors/wrong results for geos AreaDef / SwathDef Jan 4, 2022
@gerritholl
Copy link
Member

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

@ghiggi ghiggi mentioned this issue Feb 10, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants