Open Huite opened 1 month ago
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.
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.