Skip to content

Sync geotiff compression docstrings against codec map (#1562)#1589

Merged
brendancol merged 3 commits into
mainfrom
issue-1562
May 11, 2026
Merged

Sync geotiff compression docstrings against codec map (#1562)#1589
brendancol merged 3 commits into
mainfrom
issue-1562

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

_writer.write documented three compression codecs ('none', 'deflate', 'lzw') while _compression_tag accepts nine. to_geotiff listed six and omitted 'lz4', 'jpeg2000'/'j2k', and 'lerc'. Sync both docstrings against _VALID_COMPRESSIONS / _compression_tag so readers see the real set.

Also fill in the missing parameter docs on _writer.write that grew silently as features landed: compression_level, overview_resampling, crs_wkt, raster_type, x_resolution, y_resolution, resolution_unit, gdal_metadata_xml, extra_tags, bigtiff, max_z_error.

Closes #1562.

Test plan

  • Docs-only change; no behavior modified
  • python -c "from xrspatial.geotiff import to_geotiff; from xrspatial.geotiff._writer import write; print(write.__doc__); print(to_geotiff.__doc__)" renders both docstrings

_writer.write listed three codecs ('none', 'deflate', 'lzw') while
_compression_tag accepts nine. to_geotiff listed six and omitted
'lz4', 'jpeg2000'/'j2k', and 'lerc'. Update both docstrings to match
_VALID_COMPRESSIONS / _compression_tag.

Also fill in the missing parameter docs on _writer.write that grew
silently as features landed: compression_level, overview_resampling,
crs_wkt, raster_type, x_resolution, y_resolution, resolution_unit,
gdal_metadata_xml, extra_tags, bigtiff, max_z_error.

Docs-only change.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 11, 2026
brendancol added a commit that referenced this pull request May 11, 2026
Prints draft, author_association, and event action on every PR to
diagnose why the request-copilot-review gate is evaluating to false
on maintainer PRs (e.g. #1589). Remove once the gate is fixed.
@brendancol brendancol requested a review from Copilot May 11, 2026 15:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates GeoTIFF writer docstrings to accurately reflect the compression codecs and parameters supported by the underlying implementation (aligning _writer.write and to_geotiff docs with _compression_tag / _VALID_COMPRESSIONS), addressing #1562.

Changes:

  • Expanded _writer.write’s docstring to list all supported compression codecs and to document previously-undocumented parameters (e.g., crs_wkt, compression_level, overview/metadata/tag options, BigTIFF, LERC error budget).
  • Updated to_geotiff’s docstring to list the full codec set and clarify current JPEG write rejection behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
xrspatial/geotiff/_writer.py Docstring updates to enumerate supported compression names and document additional writer parameters.
xrspatial/geotiff/__init__.py to_geotiff docstring updated to match _VALID_COMPRESSIONS and clarify codec behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

'none', 'deflate', or 'lzw'.
Codec name. One of ``'none'``, ``'deflate'``, ``'lzw'``,
``'jpeg'``, ``'packbits'``, ``'zstd'``, ``'lz4'``,
``'jpeg2000'`` (alias ``'j2k'``), or ``'lerc'``.
Comment thread xrspatial/geotiff/_writer.py Outdated
@@ -1015,6 +1024,30 @@ def write(data: np.ndarray, path: str, *,
overview_levels : list of int or None
Overview decimation factors (e.g. [2, 4, 8]).
- JPEG entry in the compression= list now notes the hard uint8 + 1-or-3
  bands constraint enforced in write().
- overview_levels docstring no longer implies the values are decimation
  factors. The implementation only consumes the list length; each
  overview unconditionally halves the previous resolution.
@brendancol brendancol merged commit afb2e24 into main May 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants