Skip to content

Cell aggregation API in raster layer #81

@wang-boyu

Description

@wang-boyu

What's the problem this feature will solve?

Currently if the users would like to find the min/max cell based on certain criteria, they'll have to it manually like this:

min(raster_layer.get_neighboring_cells(pos, ...),
    key=lambda cell: cell.attribute)

Describe the solution you'd like

To have a more powerful and fluent API for cell aggregation similar to Pandas, e.g.,

raster_layer.get_neighboring_cells(pos, ...).by("attribute").min()
raster_layer.get_neighboring_cells(pos, ...).by(lambda cell: cell.attribute).min()
raster_layer.get_neighboring_cells(pos, ...).by(["attribute_0", "attribute_1"]).agg(["min", "max"])
raster_layer.get_neighboring_cells(pos, ...).by("attribute").agg(lambda cell_list: random.choice(cell_list))

Additional context

See comments from #75 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions