add support for `BitsPerSample=15`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
Research direction
Start by tracing tile decoding from fetch_tile through the decode path, focusing on how BitsPerSample=15 affects the expected sample count and output shape. Use the Sentinel-2 COG reproduction in the issue to verify the failure; done means decoding that tile succeeds without the reported shape or data length error.
Written by the indexing model from the issue text.
Description
Some Sentinel2 COGs in the planetary computer have BitsPerSample=15 which breaks async-tiff. Encountered this through async-geotiff, but opening the issue here.
ValueError: General error: Internal error: incorrect shape or data length passed to Array::try_new. Got data length 491520, expected 262144
Reproducible example (created wth claude):
# /// script
# requires-python = ">=3.11"
# dependencies = ["async-tiff==0.7.2", "obstore", "requests"]
# ///
"""async-tiff cannot decode a tile of a COG with BitsPerSample=15 (Planetary Computer Sentinel-2 L2A).
Run: uv run repro_async_tiff.py
"""
import asyncio
import requests
from async_tiff import TIFF
from obstore.store import AzureStore
ACCOUNT, CONTAINER = "sentinel2l2a01", "sentinel2-l2"
PATH = ("15/U/US/2025/04/26/S2B_MSIL2A_20250426T171859_N0511_R012_T15UUS_20250426T204945.SAFE/GRANULE/"
"L2A_T15UUS_A042509_20250426T172529/IMG_DATA/R10m/T15UUS_20250426T171859_B03_10m.tif")
async def main():
# a free, anonymous read token; the endpoint is rate-limited (429 with retry-after)
token = requests.get(f"https://planetarycomputer.microsoft.com/api/sas/v1/token/{ACCOUNT}/{CONTAINER}", timeout=60)
token.raise_for_status()
store = AzureStore(account_name=ACCOUNT, container_name=CONTAINER, sas_token=token.json()["token"])
tiff = await TIFF.open(PATH, store=store)
ifd = tiff.ifds[0]
print("bits_per_sample:", ifd.bits_per_sample, "sample_format:", ifd.sample_format)
print("tile:", ifd.tile_width, "x", ifd.tile_height, "compression:", ifd.compression)
tile = await tiff.fetch_tile(0, 0, 0) # fetching works
await tile.decode() # ValueError: ... Got data length 491520, expected 262144
asyncio.run(main())
- Dominant language
- Rust
- Stars
- 125
- Forks
- 17
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/async-tiff
-
Panic on TIFFs that omit the SamplesPerPixel tag (spec default is 1)Possibly taken @TomNicholas claimed this 130 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
developmentseed/async-tiff#318 ·
-
Difficulty 3/5 Half a day Newbie friendliness 58/100
developmentseed/async-tiff#354 ·
-
Claude suggestions for performance focusPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 5/5 Over a week Newbie friendliness 8/100
developmentseed/async-tiff#352 · 1 comment · 2 reactions ·
-
Make abi3t wheelsOpen
Difficulty 3/5 Half a day Newbie friendliness 22/100
developmentseed/async-tiff#350 ·
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
developmentseed/async-tiff#344 · 4 comments · 1 reaction ·
All issues in developmentseed/async-tiff
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
storytold/craft-anything#2472 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsotto/sotto-authenticator#68 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#1046 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nowledge-co/hawdb#1995 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swc-project/swc-next-issues#984 ·