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

Raise an error if data and angle shapes don't match in NIRReflectance #1107

Merged
merged 6 commits into from
Mar 25, 2020

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Mar 10, 2020

This is a fix to a minor bug that I encountered when using nir_reflectance modifier with VIIRS SDR data. By default Satpy loads the highest resolution (I channel) datasets, and when this modifier is used in a composite using M-channel data there's a crash because the arrays have different shapes.

Naturally, the correct way to define the composite is to use the nir_reflectance_lowres modifier where the proper resolution is defined.

  • Tests passed
  • Passes flake8 satpy

@djhoese
Copy link
Member

djhoese commented Mar 10, 2020

This should probably use projectables = self.match_data_arrays(projectables) instead to match the other compositors/modifiers and handle cases other than the area/shape differences.

@djhoese
Copy link
Member

djhoese commented Mar 10, 2020

Oh there are a couple compositors that don't use this. Thoughts on adding this to all of them?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 89.315% when pulling 20ed611 on pnuu:bugfix-nirreflectance-areas into bbfb44f on pytroll:master.

@codecov
Copy link

codecov bot commented Mar 10, 2020

Codecov Report

Merging #1107 into master will decrease coverage by 0.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1107      +/-   ##
==========================================
- Coverage   89.34%   89.32%   -0.02%     
==========================================
  Files         195      195              
  Lines       28785    28790       +5     
==========================================
+ Hits        25717    25718       +1     
- Misses       3068     3072       +4     
Impacted Files Coverage Δ
satpy/composites/__init__.py 78.67% <50.00%> (-0.31%) ⬇️
satpy/tests/test_composites.py 100.00% <100.00%> (ø)
satpy/scene.py 90.00% <0.00%> (-0.18%) ⬇️

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 bbfb44f...054eff0. Read the comment docs.

@pnuu
Copy link
Member Author

pnuu commented Mar 11, 2020

Oh, that was a new method to me! I've changed NIRReflectance and the emissive modifiers. I wasn't sure what to do when optional prereqs are used, like in PSPAtmosphericalCorrection.

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 fixing this, I stumble upon it myself recently.

@mraspaud mraspaud added this to the v0.21.0 milestone Mar 25, 2020
@mraspaud mraspaud merged commit 7b71a90 into pytroll:master Mar 25, 2020
@pnuu pnuu deleted the bugfix-nirreflectance-areas branch August 24, 2021 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants