Skip to content

coregister=True drops the caller's chunking; reproject output reverts to 512x512 #3234

@brendancol

Description

@brendancol

Describe the bug

.xrs.open_geotiff(..., coregister=True) returns a dask array chunked at 512x512 no matter how the caller is chunked. The windowed read does pick up the caller's chunk size (_infer_caller_y_chunk feeds kwargs.setdefault('chunks', ...) in accessor.py), but the reproject() call that snaps the result onto the caller's grid is never given a chunk_size, so _compute_chunk_layout falls back to its 512 default.

>>> study_area = open_geotiff("USGS_1_n35w112.tif", chunks=2048)
>>> study_area.data.chunksize
(2048, 2048)
>>> veg = study_area.xrs.open_geotiff("LF2024_EVC_CONUS.tif", unpack=True, coregister=True)
>>> veg.data.chunksize
(512, 512)

Expected behavior

Coregister puts the result on the caller's exact grid, so it should keep the caller's chunking too. A 2048-chunked study area should produce a 2048-chunked veg layer, and blockwise ops on the pair should line up chunk for chunk.

The auto_reproject=True path has the same gap: the windowed read uses the caller's chunks but the reprojected output reverts to 512.

Additional context

reproject() already accepts chunk_size (int or (row, col) tuple); _open_geotiff_windowed never passes it. Derive chunk_size from the caller's dask chunks (or from the explicit chunks= kwarg when the caller is in-memory) and forward it to both reproject() calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggeotiffGeoTIFF module

    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