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
Transfer color interpolation #114
Conversation
p.s. not sure why circleci is failing, but tests run fine on the dev machine:
|
rio_cogeo/cogeo.py
Outdated
# Transfer color interpolation | ||
ci = vrt_dst.colorinterp | ||
if nodata is None and not alpha: | ||
ci = [c for c in ci if c != ColorInterp.alpha] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand this part to be honest!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started writing an explanation, and then realized that it's not needed. I was thinking that for the cases where add_alpha=True
when creating the VRT I needed to remove the alpha band reference (that doesn't seem to be the case). I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so something like
if len(indexes) == 1:
tmp_dst.colorinterp = [ColorInterp.gray]
else:
tmp_dst.colorinterp = [vrt_dst.colorinterp[b - 1] for b in indexes]
should be enough then
rio_cogeo/cogeo.py
Outdated
if nodata is None and not alpha: | ||
ci = [c for c in ci if c != ColorInterp.alpha] | ||
if indexes: | ||
if len(indexes) == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add
if isinstance(indexes, int):
indexes = (indexes,)
at the beginning of the script (L118) so indexes is always a tuple or a list
Changes made 👍 |
thanks @pierotofy, This now lives in #117 |
Fantastic! Thanks @vincentsarago 🥇 |
Should fix #113