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
Optional mask #56
Optional mask #56
Conversation
This change seems to have broken my workflow. Can you help me troubleshoot? There is a good chance the cause is a poorly constructed input file but I'm not sure where to look. Input file is an Uint8 RGBNA geotif (red, green, blue, nir, alpha). ubuntugis/ubuntugis-unstable |
Hi @jaredairbusaerial,
I'll add a |
Driver: GTiff/GeoTIFF |
🤔 I was hoping not to see |
Let me try to find a data set I can process with phase one of my workflow (which converts 16bit to 8bit and adds the alpha channel). And then I'll share that. Why were you not wanting to see |
basically the band 5 is tag with |
It looks like when the source file is this, things work as expected. Let me set that flag on my original data set and see if that works. |
ah!
so here we have a similar file. the 5th band is a alpha band and I've set the ColorInterp to alpha with but when I read the data the alpha info is not translated to mask
|
posting the same, at the same time 👌 |
yep the |
@sgillies so this is a question that came back multiple time do you think it could be wise to add something like # use Alpha band if available even if nodata is shadowing
elif self.colorinterp[-1] == ColorInterp.alpha:
return self.read_masks(self.indexes[-1], **kwargs) in https://github.com/mapbox/rasterio/blob/master/rasterio/_io.pyx#L747-L749 |
🤦♂️ we already talked about it in rasterio/rasterio#1456 |
I'm not sure I totally understand. Are you saying the bug is in the reading of the file in cogeo? Or in the creation of the source tif (I am using rasterio libs)? However, I tried moving the alpha channel to band 4 but I have the same result when running cogeo. Band 1 Block=26925x1 Type=Byte, ColorInterp=Gray |
the bug is Rasterio |
note the proposed rasterio fix in #56 (comment) won't work because |
Struggling to figure out how to set the flags here... I'm pretty new to this. |
@jaredairbusaerial sadly I can't find a way to update the mask flag. as a quick fix, you should create a tmp file with only 4 bands
I'll think about re-adding the |
closes #54 #32 #20
This PR refactor the cli and cog_translate to make the internal mask optional.
We updated the documentations to add notes about overview levels, nodata/alpha handling and internal tile size.
Breaking change
This PR adds no main breaking changes: