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 the ninjotiff writer to provide correct scale and offset #889

Merged
merged 14 commits into from Sep 30, 2019

Conversation

mraspaud
Copy link
Member

@mraspaud mraspaud commented Aug 28, 2019

@coveralls
Copy link

coveralls commented Aug 28, 2019

Coverage Status

Coverage increased (+0.08%) to 85.363% when pulling 3987683 on mraspaud:fix-ninjotiff-writer into 35739e4 on pytroll:master.

@codecov
Copy link

codecov bot commented Aug 28, 2019

Codecov Report

Merging #889 into master will increase coverage by 0.07%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #889      +/-   ##
==========================================
+ Coverage   85.28%   85.36%   +0.07%     
==========================================
  Files         174      174              
  Lines       25822    26023     +201     
==========================================
+ Hits        22022    22214     +192     
- Misses       3800     3809       +9
Impacted Files Coverage Δ
satpy/tests/compositor_tests/__init__.py 99.54% <100%> (+0.01%) ⬆️
satpy/tests/writer_tests/__init__.py 93.75% <100%> (ø) ⬆️
satpy/writers/ninjotiff.py 46.96% <37.03%> (+28.21%) ⬆️
satpy/composites/__init__.py 75.34% <91.66%> (+0.24%) ⬆️
satpy/tests/writer_tests/test_ninjotiff.py 97.61% <97.05%> (+47.61%) ⬆️
satpy/readers/abi_l2_nc.py 19.14% <0%> (-8.13%) ⬇️
satpy/readers/abi_base.py 88.42% <0%> (-2.4%) ⬇️
satpy/resample.py 92.97% <0%> (+0.02%) ⬆️
satpy/tests/test_resample.py 98.37% <0%> (+0.04%) ⬆️
satpy/scene.py 90.65% <0%> (+0.17%) ⬆️
... and 4 more

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 35739e4...3987683. Read the comment docs.

@mraspaud mraspaud marked this pull request as ready for review September 23, 2019 07:07
new_attrs["wavelength"] = None
new_attrs.pop("units", None)
new_attrs.pop('calibration', None)
new_attrs.pop('modifiers', None)
Copy link
Member

Choose a reason for hiding this comment

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

Doing this is risky. There are things like the DNB enhancements or any other single band composite where accidentally keeping any one of these would be incorrect. Especially wavelength. Yes the composite could/should be removing these but I think we've been depending on this being part of the base compositor. I could also see this being separated where BaseCompositor has all of the above functionality, but GenericCompositor (being made for images - L, RGB, etc) could remove these attributes because they don't make sense.

What composites do you have that you need to keep this information?

Copy link
Member Author

Choose a reason for hiding this comment

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

IR. It is important that we keep the units so that it can be converted to the right unit later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me check if I can revert this

Copy link
Member

Choose a reason for hiding this comment

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

What "IR"? If it is using GenericCompositor then it is an image and should be considered unitless, right? The subclass compositor could also re-add units although I'm not sure that is great either.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the thing with tiffs like these: the values in the file form an image be must be revertable to physical quantities

Copy link
Member Author

Choose a reason for hiding this comment

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

so it's both an image and a physical dataset

num = len(projectables)
if num != 1:
raise ValueError("Can't have more than one band in a single-band composite")
mode = attrs.get('mode', 'L')
Copy link
Member

Choose a reason for hiding this comment

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

Does mode make sense here? This is for non-image composites technically ("physical quantities").

Copy link
Member Author

Choose a reason for hiding this comment

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

Well it could be a single band image in the end...

Copy link
Member

Choose a reason for hiding this comment

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

True, but that's the default. If someone wants to provide the mode then there is no reason for the default and it should be preserved anyway. Plus this would be adding metadata to a compositor that is "preserving" the metadata. Very image-y.

Copy link
Member Author

Choose a reason for hiding this comment

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

It could also be P

Copy link
Member Author

Choose a reason for hiding this comment

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

or do you mean that mode is already set in attrs ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, if the image is an image then it is already set and if not then when this physical quantity gets saved as an image the L mode will be used by default.

@mraspaud mraspaud merged commit 5175291 into pytroll:master Sep 30, 2019
@mraspaud mraspaud deleted the fix-ninjotiff-writer branch September 30, 2019 13:03
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