Skip to content

classify: stale docstring example outputs (reclassify, equal_interval) and five classifiers with no example #3506

Description

@brendancol

Some docstring examples in xrspatial/classify.py print results that do not match what the functions return, and five public classifiers have no Examples section.

Wrong example output (printed array differs from the actual result for the given input)

  • reclassify: the numpy, dask, and cupy blocks all print
    [[nan,1,1,1,1],[1,2,2,2,2],[2,2,2,2,2],[2,3,3,3,3]]
    but running the example produces
    [[nan,1,1,1,1],[1,1,1,1,1],[1,2,2,2,2],[2,3,3,3,nan]].
  • equal_interval: the block prints
    [[nan,0,0,0,0],[0,0,0,0,1],[1,1,1,1,1],[1,2,2,2,2],[2,2,2,2,nan]]
    but running it produces
    [[nan,0,0,0,0],[0,1,1,1,1],[2,2,2,2,2],[3,3,3,3,4],[4,4,4,4,nan]].
  • binary: the printed array uses np.nan where numpy reprs plain nan.

The test_classify.py fixtures confirm the functions behave correctly, so the docstring outputs are stale, not the code.

Missing Examples section

std_mean, head_tail_breaks, percentiles, maximum_breaks, and box_plot have Parameters, Returns, and References but no Examples block.

Scope

Documentation only (docstrings). No behavior change. Found via the documentation sweep on the classify module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Fields

    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