imod.mf6.Modflow6Simulation.dump#
- Modflow6Simulation.dump(directory='.', validate: bool = True, mdal_compliant: bool = False, crs=None) None [source]#
Dump simulation to files. Writes a model definition as .TOML file, which points to data for each package. Each package is stored as a separate NetCDF. Structured grids are saved as regular NetCDFs, unstructured grids are saved as UGRID NetCDF. Structured grids are always made GDAL compliant, unstructured grids can be made MDAL compliant optionally.
- Parameters:
directory (str or Path, optional) – directory to dump simulation into. Defaults to current working directory.
validate (bool, optional) – Whether to validate simulation data. Defaults to True.
mdal_compliant (bool, optional) – Convert data with
imod.prepare.spatial.mdal_compliant_ugrid2d()
to MDAL compliant unstructured grids. Defaults to False.crs (Any, optional) – Anything accepted by rasterio.crs.CRS.from_user_input Requires
rioxarray
installed.
Examples
Dump simulation to directory:
>>> mf6_sim.dump("path/to/directory")
You can load the dumped simulation back with:
>>> loaded_sim = Modflow6Simulation.from_file("path/to/directory/simulation_name.toml")
If you keep on getting ValidationErrors, you can set
validate=False
to skip validation, but this is not recommended.>>> mf6_sim.dump("path/to/directory", validate=False)
You can then fix the issues later after loading the simulation in a later stage. If you want to dump the simulation in a form that is nicely loaded into QGIS, you can set
mdal_compliant=True
:>>> mf6_sim.dump("path/to/directory", mdal_compliant=True, crs="EPSG:4326")