Skip to content

reproject/merge docstring polish and missing edge-case tests #1459

@brendancol

Description

@brendancol

A handful of small docstring and test gaps in xrspatial/reproject/__init__.py and xrspatial/tests/test_reproject.py.

C-3: chunk_size default behavior is opaque

Both reproject() and merge() accept chunk_size=None. The default applied internally is not the same in every code path:

  • _compute_chunk_layout falls back to (512, 512) (_grid.py:351).
  • The streaming and dask-cupy paths bump it to 2048 (__init__.py:603, 1006).

A reader has to dig through source to learn this. Spell it out in the docstring.

C-6: no Examples section in reproject() or merge()

geoid_height and itrf_transform already have Examples blocks. The two highest-traffic entry points in this subpackage do not. Add a short illustrative Examples block to each.

T-6: no +/-Inf input test

test_reproject.py covers NaN inputs but never feeds np.inf. Add a test that confirms reproject does not crash on infinite values. Output behavior is implementation-defined (Inf may propagate or convert to NaN); the test only needs to verify it does not raise or hang.

T-7: chunk_size tuple form and max_memory are not exercised

The tuple form of chunk_size and the max_memory kwarg both have parsing logic that no test currently covers. Add:

  • test_reproject_chunk_size_tuple: dask-backed reproject with chunk_size=(64, 32), asserts the output chunk shape.
  • test_reproject_max_memory_string_arg: pass '256MB' and '1GB'; both must be accepted.
  • test_reproject_max_memory_int_arg: pass an integer byte count; also accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions