Skip to content

geotiff: validate tile_size and dask chunks at entry points #1752

@brendancol

Description

@brendancol

Describe the bug

Two public entry points accept size parameters without checking that they are positive integers:

  • to_geotiff(tiled=True, tile_size=0) reaches xrspatial/geotiff/_writer.py:648 where math.ceil(width / tw) divides by zero.
  • read_geotiff_dask(chunks=0) or chunks=(0, N) unpacks at xrspatial/geotiff/__init__.py:2051 and feeds the value to dask chunk math; negative or zero values produce confusing downstream errors.

This is not subtle data corruption, but the module aims to be watertight at the API surface.

Expected behavior

  • to_geotiff should raise ValueError when tile_size <= 0.
  • read_geotiff_dask should raise ValueError when any chunk dimension <= 0.

Both messages should name the offending parameter and the invalid value.

References

  • xrspatial/geotiff/_writer.py:648
  • xrspatial/geotiff/__init__.py:2051

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginput-validationInput validation and error messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions