File tree Expand file tree Collapse file tree 3 files changed +37
-5
lines changed
Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ dev = [
5555 " mkdocs>=1.6.1" ,
5656 " mkdocstrings>=0.29.1" ,
5757 " mkdocstrings-python>=1.16.10" ,
58+ " rioxarray>=0.19.0" ,
5859]
5960
6061[tool .pixi .workspace ]
@@ -192,4 +193,4 @@ skip-magic-trailing-comma = false
192193line-ending = " auto"
193194
194195[tool .ruff .lint .isort ]
195- known-first-party = [" src/virtual_tiff" ]
196+ known-first-party = [" src/virtual_tiff" ]
Original file line number Diff line number Diff line change @@ -160,10 +160,9 @@ def _add_dim_for_samples_per_pixel(
160160) -> tuple [tuple [int , ...], tuple [int , ...]]:
161161 sample_dim_length = int (ifd .samples_per_pixel )
162162 shape = (sample_dim_length ,) + shape
163- if ifd .photometric_interpretation == 2 and ifd .planar_configuration == 2 :
164- # For PlanarConfiguration = 2, the StripOffsets for the component planes are stored
165- # in the indicated order: first the Red component plane StripOffsets, then the Green plane
166- # StripOffsets, then the Blue plane StripOffsets.
163+ if ifd .planar_configuration == 2 :
164+ # For PlanarConfiguration = 2, the offsets for each component plane are stored
165+ # separately. Each plane has its own set of offsets, ordered by component.
167166 chunks = (1 ,) + chunks
168167 else :
169168 chunks = (sample_dim_length ,) + chunks
Original file line number Diff line number Diff line change 1+ import xarray as xr
2+ from obstore .store import S3Store
3+ from virtualizarr .registry import ObjectStoreRegistry
4+
5+ from virtual_tiff import VirtualTIFF
6+
7+
8+ def test_multiband_planar_tiff_from_source_coop ():
9+ """Test multi-band TIFF with PlanarConfiguration=2 and non-RGB PhotometricInterpretation.
10+
11+ This tests the fix for the TIFF 6.0 spec compliance issue where PlanarConfiguration=2
12+ was only handled for RGB images (PhotometricInterpretation=2).
13+
14+ The AEF embedding TIFFs have:
15+ - PhotometricInterpretation = 1 (BlackIsZero)
16+ - SamplesPerPixel = 64 (embedding dimensions)
17+ - PlanarConfiguration = 2 (separate planes)
18+ """
19+ filepath = "s3://us-west-2.opendata.source.coop/tge-labs/aef/v1/annual/2023/10N/xjtqldak16clgy5os-0000000000-0000008192.tiff"
20+ store = S3Store (
21+ bucket = "us-west-2.opendata.source.coop" ,
22+ skip_signature = True ,
23+ region = "us-west-2" ,
24+ )
25+ registry = ObjectStoreRegistry ({"s3://us-west-2.opendata.source.coop/" : store })
26+ parser = VirtualTIFF (ifd = 0 )
27+ ms = parser (filepath , registry = registry )
28+ ds = xr .open_zarr (ms , zarr_format = 3 , consolidated = False )
29+
30+ assert isinstance (ds , xr .Dataset )
31+ assert "band" in ds ["0" ].dims
32+ assert ds ["0" ].sizes ["band" ] == 64
You can’t perform that action at this time.
0 commit comments