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

Update AreaDefinition equality to use pyproj CRS #415

Merged
merged 2 commits into from
Feb 2, 2022

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jan 31, 2022

Pyproj has issued a warning for a long time now to tell the user to avoid using PROJ.4 strings and dictionaries as they are considered inaccurate as far as completely defining a projection (where WKT is now preferred). This PR updates one usage of this in AreaDefinition.__eq__ so it compares the pyproj CRS objects directly instead of the PROJ.4 strings. This change does make equality a lot more strict, but probably in a good way. It now fails if your ellipsoid was defined in different ways or if axis order is different. This is very common with EPSG inputs.

This PR updates a few things to improve on this in the tests. It also includes a backwards incompatible change to the rasterio utilities to bring the argument name inline with AreaDefinition and be more accurate (projection instead of proj_dict).

Note: With these changes I am able to generate an ABI true_color composite in Satpy with no PROJ warnings.

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Passes git diff origin/main **/*py | flake8 --diff
  • Fully documented

Previously this used PROJ.4 strings which produced a UserWarning from pyproj.
This also includes updates to creating an area from rasterio to use a CRS directly.
@djhoese djhoese added enhancement backwards-incompatibility Causes backwards incompatibility or introduces a deprecation labels Jan 31, 2022
@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #415 (98fba93) into main (565966f) will increase coverage by 0.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #415      +/-   ##
==========================================
+ Coverage   93.86%   93.88%   +0.01%     
==========================================
  Files          65       65              
  Lines       11125    11124       -1     
==========================================
+ Hits        10443    10444       +1     
+ Misses        682      680       -2     
Flag Coverage Δ
unittests 93.88% <83.33%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
pyresample/utils/rasterio.py 53.57% <69.23%> (-0.82%) ⬇️
pyresample/geometry.py 87.01% <100.00%> (ø)
pyresample/test/test_geometry.py 99.46% <100.00%> (+0.15%) ⬆️
pyresample/test/test_utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 565966f...98fba93. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 93.709% when pulling 98fba93 on djhoese:refactor-crs-equality into 565966f on pytroll:main.

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM!

@djhoese djhoese merged commit 1904b05 into pytroll:main Feb 2, 2022
@djhoese djhoese deleted the refactor-crs-equality branch February 2, 2022 18:01
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 enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants