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 'mitiff' writer not clipping enhanced data before scaling to 8 bit values #712

Merged
merged 2 commits into from Apr 11, 2019

Conversation

TAlonglong
Copy link
Collaborator

After enhancement some data points may have values lower than 0.

Clip this to 0 before scaling to 8bit values.

This is needed in the mitiff writer as the 0 value is treated as nodata.

@TAlonglong TAlonglong changed the title MITFF writer: Need to clip enhanced data before scaling to 8 bit values MITIFF writer: Need to clip enhanced data before scaling to 8 bit values Apr 10, 2019
@mraspaud mraspaud added this to the v0.15 milestone Apr 10, 2019
@codecov
Copy link

codecov bot commented Apr 10, 2019

Codecov Report

Merging #712 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #712      +/-   ##
==========================================
+ Coverage   79.99%   80.02%   +0.02%     
==========================================
  Files         147      147              
  Lines       21471    21498      +27     
==========================================
+ Hits        17176    17203      +27     
  Misses       4295     4295
Impacted Files Coverage Δ
satpy/tests/writer_tests/test_mitiff.py 96.58% <100%> (+1.02%) ⬆️
satpy/writers/mitiff.py 79.88% <100%> (ø) ⬆️

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 ff45d3f...08766cf. Read the comment docs.

@coveralls
Copy link

coveralls commented Apr 10, 2019

Coverage Status

Coverage increased (+0.02%) to 80.017% when pulling 08766cf on TAlonglong:bug-need-to-clip-enhanced-mitiff into ff45d3f on pytroll:master.

@TAlonglong
Copy link
Collaborator Author

Will try to add a test for this.

tif = TIFF.open(os.path.join(self.base_dir, filename))
for image in tif.iter_images():
np.testing.assert_allclose(image, expected, atol=1.e-6, rtol=0)

Copy link
Member

Choose a reason for hiding this comment

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

Could you delete the file when the test is finished ? Or do you do that later ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think cleanup does that. Will check

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tearDown removes the temp directory.

Copy link
Member

Choose a reason for hiding this comment

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

Perfect. Merging.

@mraspaud mraspaud modified the milestones: v0.15, v0.14.1 Apr 11, 2019
@mraspaud mraspaud merged commit f703097 into pytroll:master Apr 11, 2019
@djhoese djhoese changed the title MITIFF writer: Need to clip enhanced data before scaling to 8 bit values Fix 'mitiff' writer not clipping enhanced data before scaling to 8 bit values Apr 12, 2019
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

3 participants