Skip to content

Commit

Permalink
Merge pull request #699 from djhoese/bugfix-negarea-swaths
Browse files Browse the repository at this point in the history
Workaround swaths crossing the anti-meridian causing negative coverage percentages
  • Loading branch information
djhoese committed Jun 26, 2024
2 parents 01eaab8 + b72a61b commit cfae513
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions polar2grid/filters/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def boundary_for_area(area_def: PRGeometry) -> Boundary:
try:
adp = area_def.boundary()
adp.decimate(int(freq_fraction * area_def.shape[0]))
if adp.contour_poly.area() < 0:
# https://github.com/ssec/polar2grid/issues/696
raise ValueError("Failed to generate valid polygon for area. Polygon has a negative area.")
except ValueError:
if not isinstance(area_def, SwathDefinition):
logger.error("Unable to generate bounding geolocation polygon")
Expand Down

0 comments on commit cfae513

Please sign in to comment.