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

feature: structured grid interpolation #1699

Open
wpbonelli opened this issue Jan 28, 2023 · 1 comment
Open

feature: structured grid interpolation #1699

wpbonelli opened this issue Jan 28, 2023 · 1 comment

Comments

@wpbonelli
Copy link
Contributor

wpbonelli commented Jan 28, 2023

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

@jlarsen-usgs
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants