imod.mf6.ConstantConcentration.from_file#

classmethod ConstantConcentration.from_file(path: str | Path, **kwargs) Self#

Loads an imod mf6 package from a file (currently only netcdf and zarr are supported). Note that it is expected that this file was saved with imod.mf6.Package.dataset.to_netcdf(), as the checks upon package initialization are not done again!

Parameters:
  • path (str, pathlib.Path) – Path to the file.

  • **kwargs (keyword arguments) – Arbitrary keyword arguments forwarded to xarray.open_dataset(), or xarray.open_zarr().

  • examples. (Refer to the)

Returns:

package – Returns a package with data loaded from file.

Return type:

imod.mf6.Package

Examples

To load a package from a file, e.g. a River package:

>>> river = imod.mf6.River.from_file("river.nc")

For large datasets, you likely want to process it in chunks. You can forward keyword arguments to xarray.open_dataset() or xarray.open_zarr():

>>> river = imod.mf6.River.from_file("river.nc", chunks={"time": 1})

Refer to the xarray documentation for the possible keyword arguments.