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

Quality-of-life: automatically add top and bottom as coordinate to MF6 output #1240

Open
Huite opened this issue Oct 14, 2024 · 1 comment
Open

Comments

@Huite
Copy link
Contributor

Huite commented Oct 14, 2024

After discussion with @FransRoelofsen: making e.g. a streamfunction plot or a cross-section plot requires manually adding top and bottom coordinates to the DataArray -- this while we provide the GRB file during reading to infer the grid topology.

It seems like a minor effort to add top and bottom data by default: it's been read from the GRB file anyway, and we require the GRB file to read budget and head results.

@JoerivanEngelen
Copy link
Contributor

JoerivanEngelen commented Nov 22, 2024

I think the streamfunction and cross-section plots are odd in this aspect, as they are the only two functions that I can think of now where we require the user to add their top and bottom in the coords of a DataArray provided to the function.

It is more consistent with other functions in the public API to require the top and bottom grids to be provided as argument instead of as coordinates. With some utility methods to the Discretization packages people can relatively easily fetch the tops and bottoms. Or from the GRB path.

Something like:

# imod.visualize.cross_sections.py
def cross_section(da, top, bottom, colors=None, levels=None, **other_kwargs):
     ...

# imod.util.spatial.py
def top_and_bottom_from_grb(grb_path):
     ...
     return top, bottom

# When there is a Modflow6Simulation in the script:
>>> dis_pkg = gwf_model["dis"]
>>> cross_section(da, *dis_pkg.get_top_bot())
# Or from grb file
>>> top, bottom = top_and_bottom_from_grb("path/to/file.grb")
>>> cross_section(da, top, bottom)

Notice that I made colors and levels kwargs now, that's probably worthy a separate issue to investigate.

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

No branches or pull requests

2 participants