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
6 changes: 4 additions & 2 deletions docs/examples/twri.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ def plot_head(head, workspace):
nc_fpth = workspace / "twri.input.nc"
gwf.netcdf_file = nc_fpth

ds = gwf.to_xarray(format="structured")
nc_model = flopy4.mf6.netcdf.NetCDFModel.from_model(gwf)
ds = nc_model.to_xarray()
ds.to_netcdf(nc_fpth)

with flopy4.mf6.write_context.WriteContext(use_netcdf=True):
Expand All @@ -303,7 +304,8 @@ def plot_head(head, workspace):
nc_fpth = workspace / "twri.input.nc"
gwf.netcdf_file = nc_fpth

ds = gwf.to_xarray(format="layered")
nc_model = flopy4.mf6.netcdf.NetCDFModel.from_model(gwf, mesh="layered")
ds = nc_model.to_xarray()
ds.to_netcdf(nc_fpth)

with flopy4.mf6.write_context.WriteContext(use_netcdf=True):
Expand Down
3 changes: 2 additions & 1 deletion flopy4/mf6/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from flopy4.mf6.component import Component
from flopy4.mf6.converter import structure, unstructure
from flopy4.mf6.ims import Ims
from flopy4.mf6.netcdf import NetCDFModel
from flopy4.mf6.simulation import Simulation
from flopy4.mf6.tdis import Tdis
from flopy4.uio import DEFAULT_REGISTRY

__all__ = ["gwf", "simulation", "solution", "utils", "Ims", "Tdis", "Simulation"]
__all__ = ["gwf", "simulation", "solution", "utils", "Ims", "NetCDFModel", "Tdis", "Simulation"]


class WriteError(Exception):
Expand Down
174 changes: 0 additions & 174 deletions flopy4/mf6/converter/egress/dataset.py

This file was deleted.

13 changes: 0 additions & 13 deletions flopy4/mf6/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from abc import ABC

import xarray as xr
from xattree import xattree

from flopy4.mf6.context import Context
Expand All @@ -10,15 +9,3 @@
class Model(Context, ABC):
def default_filename(self) -> str:
return f"{self.name}.nam" # type: ignore

def to_xarray(self, format: str | None = None) -> xr.Dataset:
from flopy4.mf6.converter.egress.dataset import xarray_flat

dt = super().to_xarray()
if format is not None:
mesh_type = None
if format.lower() == "layered":
mesh_type = "layered"
return xarray_flat(dt, mesh_type)
else:
return dt
Loading
Loading