Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell aggregation API in raster layer #81

Open
wang-boyu opened this issue Jul 12, 2022 · 0 comments
Open

Cell aggregation API in raster layer #81

wang-boyu opened this issue Jul 12, 2022 · 0 comments
Labels
enhancement Release notes label
Milestone

Comments

@wang-boyu
Copy link
Member

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).

@wang-boyu wang-boyu changed the title Cell aggregation API in raster layers Cell aggregation API in raster layer Jul 12, 2022
@wang-boyu wang-boyu added this to the v0.4.0 milestone Aug 27, 2022
@wang-boyu wang-boyu added the enhancement Release notes label label Aug 27, 2022
@wang-boyu wang-boyu removed this from the v0.4.0 milestone Oct 18, 2022
@wang-boyu wang-boyu removed the backlog label Nov 24, 2022
@wang-boyu wang-boyu added this to the Backlog milestone Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Release notes label
Projects
None yet
Development

No branches or pull requests

1 participant