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

Fix Scene.coarsest/finest_area not returning consistent results #2098

Merged
merged 11 commits into from May 3, 2022

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented May 2, 2022

In rare cases some readers return multiple AreaDefinitions or SwathDefinitions of the same resolution, but with different coordinates. The case I ran into is the AMSR2 sensor with its A and B views. They have the same resolution (shape), but are slightly shifted from one another. Having Scene.coarsest_area and Scene.finest_area return either one of these is fine, but you run into issues if they are not consistent. In my case I was using the result to freeze a DynamicAreaDefinition and then compare my final geotiffs against expected results. Currently the Scene's choice between the A and B geometries is based on the order that the DataArrays is sorted which is essentially random. My tests would sometimes match and sometimes not match depending on what order was ultimately used.

This PR fixes this to include other properties of the geometry objects to decide which one should be returned. It isn't perfect, especially when it comes to SwathDefinitions, but it is a start.

  • Closes #xxxx
  • Tests added
  • Fully documented
  • Add your name to AUTHORS.md if not there already

@djhoese djhoese requested a review from mraspaud as a code owner May 2, 2022 20:45
@djhoese djhoese self-assigned this May 2, 2022
@djhoese djhoese added this to In progress in PCW Spring 2022 via automation May 2, 2022
@codecov
Copy link

codecov bot commented May 2, 2022

Codecov Report

Merging #2098 (3bd2473) into main (20434bf) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2098   +/-   ##
=======================================
  Coverage   93.89%   93.90%           
=======================================
  Files         283      283           
  Lines       42589    42615   +26     
=======================================
+ Hits        39991    40017   +26     
  Misses       2598     2598           
Flag Coverage Δ
behaviourtests 4.71% <8.19%> (+<0.01%) ⬆️
unittests 94.46% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
satpy/readers/viirs_sdr.py 86.94% <100.00%> (ø)
satpy/scene.py 93.12% <100.00%> (+0.14%) ⬆️
satpy/tests/test_scene.py 99.46% <100.00%> (+<0.01%) ⬆️

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 20434bf...3bd2473. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 94.401% when pulling 3bd2473 on djhoese:bugfix-minmax-area-amsr2 into 20434bf on pytroll:main.

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, thanks for reorganising the tests too!

@mraspaud mraspaud merged commit 2e1d845 into pytroll:main May 3, 2022
PCW Spring 2022 automation moved this from In progress to Done May 3, 2022
@djhoese djhoese deleted the bugfix-minmax-area-amsr2 branch May 3, 2022 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants