Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/earthkit/data/readers/geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ def _match_magic(magic):
# https://docs.ogc.org/is/19-008r4/19-008r4.html#_tiff_core_test
# Bytes 0-1: 'II' (little endian) or 'MM' (big endian)
# Bytes 2-3: 42 as short in the corresponding byte order
# or 43 for a bigtiff file
# Bytes 4-7: offset to first image file directory
return magic is not None and len(magic) >= 8 and magic[:4] in {b"II*\x00", b"MM\x00*"}
return magic is not None and len(magic) >= 8 and magic[:4] in {b"II*\x00", b"II+\x00", b"MM\x00*"}


def reader(source, path, *, magic=None, **kwargs):
Expand Down
Binary file not shown.
7 changes: 5 additions & 2 deletions tests/readers/test_geotiff_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@

@pytest.mark.skipif(NO_RIOXARRAY, reason="rioxarray not available")
@pytest.mark.with_proj
def test_geotiff_reader_with_multiband():
s = from_source("file", earthkit_test_data_file("dgm50hs_col_32_368_5616_nw.tif"))
@pytest.mark.parametrize(
"fname", [("dgm50hs_col_32_368_5616_nw.tif"), ("dgm50hs_col_32_368_5616_nw_bigtiff.tiff")]
)
def test_geotiff_reader_with_multiband(fname):
s = from_source("file", earthkit_test_data_file(fname))
assert len(s) == 3
assert isinstance(s[0], GeoTIFFField)
assert isinstance(s[1], GeoTIFFField)
Expand Down
Loading