flopy icon indicating copy to clipboard operation
flopy copied to clipboard

feature: structured grid interpolation

Open wpbonelli opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

StructuredGrid can interpolate between grid features with

  • array_at_verts_basic(a): cell center (node) to vertices with neighbor averaging
  • array_at_verts(a): cell center or face center to vertices (bi or trilinear)
  • array_at_faces(a, direction): cell center to pair of faces normal to x, y, or z axis (linear)

This is nice but may be hard for users to find, and not all possible mappings are supported

Describe the solution you'd like

Unifying the API could help make it more discoverable, maybe something like

interpolate(self, a, feat="c2v", **kwargs)

where a is a 3D array of known values and feat selects the site mapping. Would need to check that a's dimensions match the input feature. The direction for interpolation to faces, and other mapping-specific params, could be passed with **kwargs. Implementation could wrap the existing functions and add other mappings to/from edge midpoints, vertices to cell centers, etc

A signature with an option selected from an enumeration seems like a common choice for many-to-many conversions/mappings (e.g. OpenCV, discretize), though docs would be key as shape of input/output would vary

Minimal draft implementation with some expanded testing and docs

Describe alternatives you've considered

If flopy's focus is more to drive modflow and less fully-featured post-processing this may be out of scope. Could also be missing some reason it's misguided or not possible

wpbonelli avatar Jan 28 '23 04:01 wpbonelli

@wpbonelli

We should track down what this code is actually used for. If my memory serves me, this was implemented for a specific discharge vector postprocessing routine for mf2005 and probably does not get a ton of use. We should examine if it's used elsewhere in the code and/or consider separating it from the modelgrid if that's the only use case.

jlarsen-usgs avatar Dec 22 '23 18:12 jlarsen-usgs