Skip to content

geotiff: _writer.write docstring lists 3 compression codecs but the function supports 9 #1562

@brendancol

Description

@brendancol

Summary

xrspatial/geotiff/_writer.py:968 defines write() (the eager numpy writer called by to_geotiff). Its docstring at line 1003 says:

compression : str
    'none', 'deflate', or 'lzw'.

The actual _compression_tag map at line 114 accepts nine names:

'none', 'deflate', 'lzw', 'jpeg', 'packbits', 'zstd', 'lz4',
'jpeg2000', 'j2k', 'lerc'

The public to_geotiff docstring lists more codecs but still omits some (jpeg2000, lerc). Anyone reading _writer.write to understand the supported set comes away with three codecs out of nine.

Same function omits docstring entries for several real parameters: compression_level, raster_type, x_resolution, y_resolution, resolution_unit, gdal_metadata_xml, extra_tags, bigtiff, max_z_error. They are all in the signature with type hints; the docstring just stops short.

Why this matters

_writer.write is private (_ prefix), but it is the function that actually accepts and validates these kwargs. Maintainers and the public to_geotiff wrapper read the docstring to confirm what is supported. A docstring three codecs short is a docs-vs-code disagreement that grew silently as PRs added codecs.

Proposed fix

Sync _writer.write and to_geotiff docstrings against _compression_tag's map. Add docstring entries for the parameters currently missing. The fix is docs-only.

Found during the geotiff API consistency sweep (Cat 3, MEDIUM).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions