-
Notifications
You must be signed in to change notification settings - Fork 333
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
Improving VoronoiDelaunayGrid by new FramedVoronoiGrid with fixed boundary and minimal distance between nodes #1450
Comments
…_grid Creates FramedVoronoiGrid with general idea developed in #1450. New notebook presenting all classes of grids. May impact other grids and graphs with these files modified: ``` landlab/__init__.py docs/build_grid_func_docs.py landlab/graph/__init__.py landlab/grid/__init__.py tests/grid/test_constructors.py ```
@mcflugen it seems I missed your last comment on the pull request:
@sebastien-lenard Sorry, I still don't get why a user would want to have separate seeds for the x and y moves. The only reason I can think of is if they wanted the moves to be the same (i.e. not independent). How about, instead, something like the following (seed is either an int or None),
" |
@sebastien-lenard It wasn't quite ready to be merged yet. There was still the issue with the random number generator. No problem, though, I'll also create a new pull request with my proposed changes to the edge node ids. |
@mcflugen I created the pull request. |
Thanks! |
@mcflugen if you want you can push your changes on this pull request, I think I achieved the modifications required to simplify to seed = one int. My concern for your adaptation is whether I'll be able to know the node id of node Y for instance in the FramedVoronoiGrid below: |
@sebastien-lenard Thanks. This is good to know. Without any changes, I think the way you would do this is through the nodes_at_left_edge and nodes_at_right_edge arrays. I believe those arrays are ordered by row so, in your example, the id for node y would be Another possibility. For a >>> grid = RasterModelGrid((3, 4))
>>> grid.nodes
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]]) We could do something like that for Do either of those ideas address your concern? Rather than adding it to this pull request, I'll put this in a separate one to keep the two pull requests focused. |
Yes, @mcflugen the first idea addresses my concern. The nodes at left edge are ordered by node id. For the second idea, the thing is that FramedVoronoiGrid might also be based on a hex or a radial grid (before random moves) in the future, so I guess it's not very flexible. |
The present implementation of VoronoiDelaunayGrid let the user construct the set of x-y coordinates of nodes that the grid receives as input. This has two drawbacks:
To bypass these drawbacks, I propose to implement a new type of grid, the FramedVoronoiGrid, following a structure of classes and methods similar to the HexModelGrid. Four new classes are associated: the grid itself, FramedVoronoiGrid, a dual graph, DualFramedVoronoiGrid, which is parent of the grid, FramedVoronoiGraph, which is parent of DualFramedVoronoiGrid, and HorizontalRectVoronoiGraph, a static class implementing the methods necessary to instantiate a FramedVoronoiGraph.
The FramedVoronoiGrid starts by constructing a rectangular network of nodes. The boundary nodes are then fixed. This means that they are not determined by the ConvexHull as in the VoronoiDelaunayGrid. The core nodes are then moved around their position, in such a way that the distance between nodes don't exceed a certain threshold. While loosing the full potential of a fully random unstructured grid, the FramedVoronoiGrid is remains irregular and may fulfill some needs not currently fulfilled by the VoronoiDelaunayGrid or the HexModelGrid.
The text was updated successfully, but these errors were encountered: