Skip to content

Deprecate 'get_area_extent_for_subset' and fix incorrect return value - #749

Merged
djhoese merged 2 commits into
pytroll:mainfrom
djhoese:fix-returns-docstring-xrefs
Sep 13, 2026
Merged

djhoese merged 2 commits into
pytroll:mainfrom
djhoese:fix-returns-docstring-xrefs

Conversation

@djhoese

@djhoese djhoese commented Sep 11, 2026

Copy link
Copy Markdown
Member

Sphinx was complaining about bad type definitions in the docstring of 'get_area_extent_for_subset'. I decided to move the types to normal type annotations since we use that elsewhere. This revealed that this method hasn't returned a tuple of scalars since 2018. This method was added in 2018 in #44 and then later we changed how the get_proj_* methods work and dropped this scalar use case. Since no tests were ever added for this method the breakage was never caught. In this PR I fix the type annotations and deprecate the method in favor of the slicing logic available for AreaDefinition to create a subset area and then get the area extent. Oh yeah, Claude pointed out that this method was on the BaseDefinition but was using methods that only existed on the AreaDefinition.

I also added type annotations to a helper function when I was confused about how I wanted to replace the internals of this method.

Bottom line: This method has been broken for years, it is being removed.

CC @meteoswiss-mdr who originally added in in #44 (Ulrich)

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Fully documented

@djhoese djhoese self-assigned this Sep 11, 2026
@djhoese djhoese added bug documentation backwards-incompatibility Causes backwards incompatibility or introduces a deprecation labels Sep 11, 2026
@djhoese
djhoese requested review from mraspaud and pnuu September 11, 2026 18:33
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.71%. Comparing base (8aca19c) to head (f4a479f).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pyresample/geometry.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #749      +/-   ##
==========================================
+ Coverage   93.68%   93.71%   +0.03%     
==========================================
  Files          89       89              
  Lines       13721    13716       -5     
==========================================
  Hits        12854    12854              
+ Misses        867      862       -5     
Flag Coverage Δ
unittests 93.71% <60.00%> (+0.03%) ⬆️

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.

@pnuu pnuu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One comment inline.

Comment thread pyresample/geometry.py Outdated
@djhoese
djhoese merged commit 2140ced into pytroll:main Sep 13, 2026
24 of 26 checks passed
@djhoese
djhoese deleted the fix-returns-docstring-xrefs branch September 13, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards-incompatibility Causes backwards incompatibility or introduces a deprecation bug documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants