Skip to content

Densify the geostationary bounding polygon before reprojecting in AreaSlicer#729

Open
lorenzo-cingano wants to merge 1 commit into
pytroll:mainfrom
lorenzo-cingano:fix_partial_geostationary_disk_slicing
Open

Densify the geostationary bounding polygon before reprojecting in AreaSlicer#729
lorenzo-cingano wants to merge 1 commit into
pytroll:mainfrom
lorenzo-cingano:fix_partial_geostationary_disk_slicing

Conversation

@lorenzo-cingano

Copy link
Copy Markdown

AreaSlicer.get_polygon_to_contain builds the bounding polygon of a geostationary source disk and reprojects it into the destination projection to compute the source slice. When the source is a partial disk (rapid scan or region of interest data), clipping the disk to its area extent introduces straight chord edges with only two vertices. Those chords are not straight in the destination projection, so the reprojected polygon cuts the corner and the source slice comes out too small, leaving part of the destination empty. A full disk source is unaffected, because its whole boundary is the densely sampled disk arc.

This densifies the polygon with segmentize before reprojecting it, so the chord edges keep enough vertices to follow their true shape in the destination projection. The problem was found in satpy when resampling MSG rapid scan data to a polar stereographic area with gradient_search.

segmentize needs shapely 2.0 or newer. shapely is currently unpinned in the dependencies, so a shapely>=2.0 pin can be added if you want it explicit.

…aSlicer

AreaSlicer.get_polygon_to_contain builds the bounding polygon of a
geostationary source disk and reprojects it into the destination
projection to compute the source slice. When the source is a partial
disk (rapid scan or region of interest data), clipping the disk to its
area extent introduces straight chord edges with only two vertices.
Those chords are not straight in the destination projection, so the
reprojected polygon cuts the corner and the source slice comes out too
small, leaving part of the destination without data.

Densify the polygon with segmentize before reprojecting it, so the chord
edges keep enough vertices to follow their true shape in the destination
projection.
@djhoese

djhoese commented Jul 2, 2026

Copy link
Copy Markdown
Member

Thanks for this PR! I just wanted to let you know that we're not ignoring you, but most of us are on vacation or (like me) don't have time to review this right now. I hope to review it next week though.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.69%. Comparing base (2e7a3c8) to head (99f9c93).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #729   +/-   ##
=======================================
  Coverage   93.68%   93.69%           
=======================================
  Files          89       89           
  Lines       13715    13725   +10     
=======================================
+ Hits        12849    12859   +10     
  Misses        866      866           
Flag Coverage Δ
unittests 93.69% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Successfully merging this pull request may close these issues.

gradient_search leaves part of the destination empty for a partial geostationary disk

2 participants