Repository navigation
fix: Retain tiled structure of original AEF embedding & resize to 16x16 - #79
Conversation
The 10x10 clipped image did not maintain the original COG's tiled structure, nor the ZSTD compression and overviews. Modified the `gdal raster clip` command's output options to ensure these features from the original AEF embedding TIFF are preserved.
| --window 0,0,10,10 \ | ||
| --output-format COG \ | ||
| --creation-option COMPRESS=ZSTD \ | ||
| --creation-option INTERLEAVE=BAND \ |
There was a problem hiding this comment.
Need to explicitly set INTERLEAVE=BAND otherwise GDAL defaults to INTERLEAVE=PIXEL apparently (see https://gdal.org/en/stable/drivers/raster/cog.html#general-creation-options).
COGs created by GDAL have a minimum BlockSize of 128, so just go with a regular TILED GeoTIFF, that has a minimum BlockSize of 16. No more overview levels.
| IFD | ||
| Id Size BlockSize Decimation | ||
| 0 10x10 10x10 0 | ||
| 0 10x10 16x16 0 |
There was a problem hiding this comment.
Should I change the crop window from 10x10 to 16x16 to follow the minimum blocksize? This will increase the filesize from 12.3kB to 17.3kB.
To match blocksize of 16x16. Note that it says Tiled=False, but technically it is tiled...
| Width: 16 | ||
| Height: 16 | ||
| Bands: 64 | ||
| Tiled: False |
There was a problem hiding this comment.
I don't know why cogeo info says this is not tiled when the width/height (16x16) matches the blocksize (16x16). Maybe because for a TIFF with a single tile, there is no difference between a tiled vs a striped TIFF?
At least async-tiff won't error with Not a tiled tiff anymore 🙂
Try pulling 3 bands out of 64 from the sample AlphaEarth Foundations embedding TIFF dataset. Updated geotiff-test-data from b7158c4 to 0b1055b which includes the tiled sample AEF embedding TIFF from developmentseed/geotiff-test-data#79
…IFF (#251) * Add band-interleaved multi-band sample TIFF * Fetch range of bands for a tile instead of all bands * Add specific test pulling specific band ranges from a TIFF * Enable fetching disjoint bands from a TIFF Change from passing in a Range<usize> to a Vec<usize> so specific bands can be indexed. * Change parameters from just bands to more extensible fetch_options Create a FetchOptions struct that allows passing specific parameters (currently only `bands`) when doing a fetch_tile operation. Keep the existing option of passing only None to do the default action of fetching of all bands. * Check that we are not fetching bands outside the max band count With some special handling to handle 0-based indexing. * Support fetching specific bands with `fetch_tiles` Use the same FetchOptions struct, included another unit test using the eox_cloudless.tif data as test case. * Rename to ReadOptions * Enable fetching specific bands via TIFF.fetch_tile and .fetch_tiles Add `bands` kwarg to TIFF.fetch_tile and TIFF.fetch_tiles to allow fetching only specific bands (or by default, all bands when `None` is given). Included a unit test to ensure it is possible to fetch only 2 bands from an RGB TIFF. * Update geotiff-test-data from efc3ee1 to b7158c4 Include updated uint8_1band_deflate_block128_unaligned_predictor2.tif file from developmentseed/geotiff-test-data#74 * Change unit test to check against AEF embedding dataset with 64 bands Try pulling 3 bands out of 64 from the sample AlphaEarth Foundations embedding TIFF dataset. Updated geotiff-test-data from b7158c4 to 0b1055b which includes the tiled sample AEF embedding TIFF from developmentseed/geotiff-test-data#79 * Rename fetch_options parameter to read_options Following the ReadOptions struct name used in 72e1071 * Change bands/planes to be kwarg only * Rename bands -> planes Xref #360 * Clarify that planes arguments should be using 0-based indexing E.g. [0, 1, 2] for the first three planes/bands. --------- Co-authored-by: Kyle Barron <[email protected]>
The sample 10x10 clipped AEF embedding TIFF did not maintain the original tiled structure, nor the ZSTD compression. Need to modify the
gdal raster clipcommand's output options to ensure these aspects from the original AEF embedding TIFF are preserved in the sample file.For ref, the original AEF TIFF is at https://source.coop/tge-labs/aef/v1/annual/2024/13N/xjejfvrbm1fbu1ecw-0000000000-0000008192.tiff. Output from
AWS_NO_SIGN_REQUEST=YES gdal info /vsis3/us-west-2.opendata.source.coop/tge-labs/aef/v1/annual/2024/13N/xjejfvrbmgives (truncated):Technically the AEF embedding TIFF is a COG, but COGs created by GDAL have a minimum blocksize of 128 apparently. So we'll just go with a regular TILED GeoTIFF with blocksize 16 to keep the file small.
Discovered the mistake while working on developmentseed/async-tiff#251, patches #34