Sync geotiff compression docstrings against codec map (#1562)#1589
Merged
Conversation
_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.
2 tasks
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.
3 tasks
Contributor
There was a problem hiding this comment.
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'``. |
| @@ -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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_writer.writedocumented three compression codecs ('none','deflate','lzw') while_compression_tagaccepts nine.to_geotifflisted six and omitted'lz4','jpeg2000'/'j2k', and'lerc'. Sync both docstrings against_VALID_COMPRESSIONS/_compression_tagso readers see the real set.Also fill in the missing parameter docs on
_writer.writethat 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
python -c "from xrspatial.geotiff import to_geotiff; from xrspatial.geotiff._writer import write; print(write.__doc__); print(to_geotiff.__doc__)"renders both docstrings