Closed kerrybardot closed 6 months ago
@kerrybardot
This is already supported in FloPy. The intersect method accepts an optional z parameter
node = modelgrid.intersect(xcoord, ycoord, z=zcoord)
You can also get the x, y, and z coordinates for all nodes using:
xverts, yverts, zverts = modelgrid.xyzvertices
# or cell centers
xc = modelgrid.xcellcenters
yc = modelgrid.ycellcenters
zc = modelgrid.zcellcenters
It does accept the z parameter but only returns the Cell2d number (rather than the node number), which for Unstructured Grids doesn't make sense:
@kerrybardot The icell2d number is the same as the node number.
From the MF6 IO guide: "icell2d—is the cell2d number. Records in the CELL2D block must be listed in consecutive order from 1 to NODES."
Anyway, just letting you know that when you pass the x,y,z it returns the cell2d number, and it doesn't change what it returns when you change the z layer even if it is in another layer. That's OK.. I've scripted my own fix for now!
From: Joshua Larsen @.> Sent: Friday, April 26, 2024 1:42 AM To: modflowpy/flopy @.> Cc: Kerry Bardot @.>; Mention @.> Subject: Re: [modflowpy/flopy] feature: flopy.discretization.unstructuredgrid.intersect...but in 3D!? (Issue #2162)
@kerrybardothttps://github.com/kerrybardot The icell2d number is the same as the node number.
From the MF6 IO guide: "icell2d-is the cell2d number. Records in the CELL2D block must be listed in consecutive order from 1 to NODES."
- Reply to this email directly, view it on GitHubhttps://github.com/modflowpy/flopy/issues/2162#issuecomment-2077821523, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APRPR4IW7PBAJMJU6GLCR4LY7E57XAVCNFSM6AAAAABGSBEORKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXHAZDCNJSGM. You are receiving this because you were mentioned.Message ID: @.**@.>>
It would be nice to be able to extract the x,y,z coordinate given a node using an Unstructured Grid. Also, on the flipside, extracting the node given an x,y,z.
I am grateful for flopy.discretization.unstructuredgrid.intersect which does this in 2D... can we extend this to 3d please?!
Many methods for Unstructured Grids are quite useful, although still rely on layered format.
In the meantime, I will keep working with the utilities of the vertex grid, and then convert between vertex grid node number and unstructured grid node number. This might be easier for me for now anyway, but nice to have the above methods in the near future!