Conversation
|
distance_transform_edt has the sampling argument that allows for rectangular cells instead of square cells |
|
Previously, the griddata interpolation function computed a value for all cells and not just for the cells with a missing value. This PR correctws that and thereby provides a great speed up for both structured grids and unstructured grids. The speedup for structured grids in which all cells have the same shape is even bigger. |
…or linear interpolation method in tests
There was a problem hiding this comment.
Thanks for speeding this up, this helps a lot. Most important comment is to use the nlmod/dims/shared.py methods for checking dimensions and gridtypes and maybe even add a function to check for rectangular cell shapes there.
I guess failing tests are not due to this PR right?
|
The following allows to pass only neighboring cells with valid values for vdis grids: _cell_connections = gwf.modelgrid.neighbors()
cell_connections = {k: _cell_connections[k] for k in np.where(ds.ahn.isnull())[0]}
unicons = set().union(*cell_connections.values()) - set(cell_connections.keys())
is_valid = np.zeros_like(ds["ahn"].values, dtype=bool)
is_valid[list(unicons)] = TrueThe following does the exact same for structured grids (as is implemented in this PR): is_valid = binary_dilation(is_invalid) & ~is_invalidEdit: proposed changes are now part of this PR |
…vent memory sharing issues. Update tests for fillnan_da_vertex_grid to ensure proper handling of coordinates and validate results.
OnnoEbbens
left a comment
There was a problem hiding this comment.
Nice addition with the neighboring cells.
I was expecting the shared module to be more useful in this case but at least it was useful for one function. Just one last comment and then you can merge it (I already approved it).
| If x is not provided and "x" is not in xar_in.coords, an error will be raised. | ||
| """ | ||
| if xar_in.dims != ("icell2d",): | ||
| if not is_vertex(xar_in): |
There was a problem hiding this comment.
So this will allow layered vertex arrays to pass which is not what you want (and avoided for the structured grid). I did not think of this when recommending the functions in the shared module.
There was a problem hiding this comment.
Hi @OnnoEbbens I don't follow you here. The code raises an error for everything that is not a vertex grid, which is desired here in this vertex function, right?
No description provided.