Skip to content

Refactor GeoTIFF Phase 5e: extract _overview.py from _writer.py (PR-K of #2211) #2259

@brendancol

Description

@brendancol

Summary

Follow-up under epic #2211. Phase 5e deliverable: extract overview-building helpers (pyramid generation for COGs) out of _writer.py into a new _overview.py.

Scope

Mechanical extraction. Behavior-neutral. Touches _writer.py only — runs cleanly in parallel with PR-J (which touches _reader.py).

Files

  • Create: xrspatial/geotiff/_overview.py.
  • Modify: xrspatial/geotiff/_writer.py — remove the helpers being moved; import them from _overview.
  • Modify: any importers (likely _writers/eager.py, _writers/gpu.py, _writers/vrt.py).

What to move

Overview-building helpers in _writer.py (verify each name in the current file):

  • _make_overview
  • _replicate_pad_2d
  • _block_reduce_2d
  • _resolve_int_nodata (only if it is overview-scoped; otherwise leave it)
  • _validate_overview_levels

Leave in _writer.py: strip/tile encode helpers, photometric/predictor encode helpers, _write / _write_streaming orchestration, _compress_block, _validate_lowlevel_write_kwargs, fsspec write helpers.

Acceptance

  • _writer.py line count drops by ~400–460 lines.
  • All overview/COG tests pass unchanged: test_cog_overview_*.py, test_overview_*.py, test_block_reduce_*.py, test_resample_*.py, plus the broader geotiff write suite.
  • Public import paths preserved.
  • No public API change.

Non-goals

  • Splitting strip/tile encode out (that is PR-L, held until this PR merges).
  • Performance work.

Closes part of #2211.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions