Summary
The gpu keyword argument on the public xrspatial.geotiff reader/writer functions accepts three different value spaces depending on which function you call:
open_geotiff(..., gpu=False) — bool. Truthy routes to read_geotiff_gpu.
read_vrt(..., gpu=False) — bool. Truthy uploads to CuPy.
to_geotiff(..., gpu=None) — bool | None. None auto-detects from the input, truthy forces GPU.
read_geotiff_gpu(..., gpu='auto') — str literal, accepts only 'auto' or 'strict'. Controls failure mode when a GPU decode stage raises.
The read_geotiff_gpu case is the one that bites users: the name gpu= reads like "use GPU", but the values actually control the strict-vs-fallback policy when the GPU path itself fails. Calling read_geotiff_gpu(path, gpu=True) — the obvious mental model after using open_geotiff(path, gpu=True) — raises ValueError: gpu must be 'auto' or 'strict', got True.
Why this matters
Anyone who learns the API from open_geotiff and then drops down to the explicit read_geotiff_gpu for stricter semantics gets the ValueError on the first call. The kwarg shares a name across four public functions but carries three different meanings.
Proposed fix
Rename the read_geotiff_gpu parameter to something that describes what it actually controls — for example on_gpu_failure='auto' or gpu_failure='auto'. Add a deprecation shim that:
- Accepts both
gpu= (old) and the new name.
- Raises
TypeError if both are passed.
- Emits
DeprecationWarning if only gpu= is passed, then forwards.
- Updates the docstring and tests.
This is a breaking-change-with-shim path; the rename has to land with the deprecation in the same release.
Found during the geotiff API consistency sweep (Cat 1, HIGH).
Summary
The
gpukeyword argument on the publicxrspatial.geotiffreader/writer functions accepts three different value spaces depending on which function you call:open_geotiff(..., gpu=False)—bool. Truthy routes toread_geotiff_gpu.read_vrt(..., gpu=False)—bool. Truthy uploads to CuPy.to_geotiff(..., gpu=None)—bool | None.Noneauto-detects from the input, truthy forces GPU.read_geotiff_gpu(..., gpu='auto')—strliteral, accepts only'auto'or'strict'. Controls failure mode when a GPU decode stage raises.The
read_geotiff_gpucase is the one that bites users: the namegpu=reads like "use GPU", but the values actually control the strict-vs-fallback policy when the GPU path itself fails. Callingread_geotiff_gpu(path, gpu=True)— the obvious mental model after usingopen_geotiff(path, gpu=True)— raisesValueError: gpu must be 'auto' or 'strict', got True.Why this matters
Anyone who learns the API from
open_geotiffand then drops down to the explicitread_geotiff_gpufor stricter semantics gets the ValueError on the first call. The kwarg shares a name across four public functions but carries three different meanings.Proposed fix
Rename the
read_geotiff_gpuparameter to something that describes what it actually controls — for exampleon_gpu_failure='auto'orgpu_failure='auto'. Add a deprecation shim that:gpu=(old) and the new name.TypeErrorif both are passed.DeprecationWarningif onlygpu=is passed, then forwards.This is a breaking-change-with-shim path; the rename has to land with the deprecation in the same release.
Found during the geotiff API consistency sweep (Cat 1, HIGH).