Skip to content

fix(area): complete area definitions with explicit b parameter - #740

Closed
Manny7717 wants to merge 1 commit into
pytroll:mainfrom
Manny7717:fix/complete-area-projections
Closed

fix(area): complete area definitions with explicit b parameter#740
Manny7717 wants to merge 1 commit into
pytroll:mainfrom
Manny7717:fix/complete-area-projections

Conversation

@Manny7717

Copy link
Copy Markdown

What

Completes all incomplete area definitions in the repository. Several example projections (test fixtures and documentation) only define the equatorial radius a; while PROJ accepts this and treats the ellipsoid as a sphere, stricter tools such as GDAL reject these definitions when writing geotiffs (reported in #200, encountered by Satpy users).

Change

Add b = a to every projection that only defined a:

  • pyresample/test/test_files/areas.yaml — 13 area definitions
  • pyresample/test/test_geometry/test_area.py — projection dicts and PROJ.4 strings used as test fixtures
  • Docs: docs/areas.cfg, and howto examples in geo_def.rst, geometry_utils.rst, plot.rst, plot_cartopy_basemap.rst, plot_projections.rst, spherical_geometry.rst (dict, PROJ.4 string, YAML and .cfg forms)
  • Added a note in geo_def.rst documenting that both a and b should always be defined

Why it's safe

a-only and a+b (with b = a) definitions normalize to the identical CRS in pyproj (+R=6371228 sphere form, CRS.equals()True), so no coordinate behavior changes — this only removes the GDAL incompatibility.

Tests

  • python -m pytest pyresample/test/test_area_config.py pyresample/test/test_geometry/test_area.py221 passed (same as before the change)
  • All .. doctest:: blocks in the edited howtos still pass unchanged (verified expected outputs are byte-identical)
  • All YAML code blocks in edited docs parse with yaml.safe_load
  • ruff check clean on the modified test file

Some example area definitions (test fixtures and documentation) only
defined the equatorial radius a. While PROJ accepts this, stricter
tools such as GDAL fail when saving geotiffs for these areas.

Add b (= a for spherical projections) to all incomplete definitions:
test_files/areas.yaml, test_geometry/test_area.py fixtures, doc
examples (dict, PROJ.4 string, YAML and areas.cfg forms), and document
the requirement in the howto. Closes pytroll#200
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.68%. Comparing base (2e7a3c8) to head (650d137).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #740   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files          89       89           
  Lines       13715    13715           
=======================================
  Hits        12849    12849           
  Misses        866      866           
Flag Coverage Δ
unittests 93.68% <100.00%> (ø)

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.

@djhoese

djhoese commented Aug 31, 2026

Copy link
Copy Markdown
Member

This is a duplicate of #735. As commented there the original case I described in #200 doesn't seem to error out any more so these changes may not be necessary. Similarly pyresample has been using pyproj CRS objects so a lot of this a/b and other projection parameter resolution has been pushed to pyproj to resolve and normalize. Additionally PROJ.4 strings are relatively deprecated and should be relied on as little as possible once they are converted to a CRS object (stick with WKT definitions instead).

I'm going to close this and the #200 issue for now. If one of the other maintainers or power users of pyresample wants to present a strong opinion on this matter then go for it and I will happily reconsider. As the original issue creator for #200 though I'm comfortable closing this for now. Thanks @Manny7717 for making the PR but I'm choosing to not merge this at least for now.

@djhoese djhoese closed this Aug 31, 2026
@Manny7717
Manny7717 deleted the fix/complete-area-projections branch August 31, 2026 18:16
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.

2 participants