Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nlmod/gwf/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_heads_da(
# gwf.output.head() defaults to a structured grid
if gwf is not None and ds is None and fname is None:
kwargs["modelgrid"] = gwf.modelgrid
da = _get_heads_da(hobj, **kwargs)
da = _get_heads_da(hobj, name="head", **kwargs)
da.attrs["units"] = "m NAP"

# set time index if ds/gwf are provided
Expand Down
2 changes: 1 addition & 1 deletion nlmod/gwt/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_concentration_da(
# gwt.output.concentration() defaults to a structured grid
if gwt is not None and ds is None and fname is None:
kwargs["modelgrid"] = gwt.modelgrid
da = _get_heads_da(cobj, **kwargs)
da = _get_heads_da(cobj, name="concentration", **kwargs)
da.attrs["units"] = "concentration"

# set time index if ds/gwt are provided
Expand Down
8 changes: 5 additions & 3 deletions nlmod/mfoutput/mfoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_time_index(fobj, ds=None, gwf_or_gwt=None):
return tindex


def _create_da(arr, modelgrid, times, hdry=-1e30, hnoflo=1e30):
def _create_da(arr, modelgrid, times, hdry=-1e30, hnoflo=1e30, name=None):
"""Create data array based on array, modelgrid, and time array.

Parameters
Expand All @@ -103,6 +103,8 @@ def _create_da(arr, modelgrid, times, hdry=-1e30, hnoflo=1e30):
hnoflo : float, optional
The value of no-flow cells, which will be replaced by NaNs. If hnoflo is None,
the values of no-flow cells will not be replaced by NaNs. The default is 1e30.
name : str, optional
name of the data variable

Returns
-------
Expand All @@ -113,7 +115,7 @@ def _create_da(arr, modelgrid, times, hdry=-1e30, hnoflo=1e30):
# create data array
dims, coords = get_dims_coords_from_modelgrid(modelgrid)

da = xr.DataArray(data=arr, dims=("time",) + dims, coords=coords)
da = xr.DataArray(data=arr, dims=("time",) + dims, coords=coords, name=name)

if hdry is not None or hnoflo is not None:
# set dry/no-flow to nan
Expand Down Expand Up @@ -247,7 +249,7 @@ def _get_budget_da(
)

# create data array
da = _create_da(stacked_arr, modelgrid, cbcobj.get_times())
da = _create_da(stacked_arr, modelgrid, cbcobj.get_times(), name=text)

return da

Expand Down
Loading