imod.flow - Create iMODFLOW model¶
Create iMODFLOW model.
With this module full iMODFLOW models can be written to disk. In imod.wq
this is done with classes that understand more about the model and can therefore
offer more help. Here a more rudimentary approach is used where you can pass a
dictionary with all data. This works, but you need to be extra careful about
writing a full and correct model definition, since no extra checks are done by
this module.
-
imod.flow.
write
(path, model, name=None, runfile_parameters=None, output_packages=['shd'])[source]¶ Writes an iMODFLOW model, including runfile, as specified by
model
into directorypath
.Directory
path
is created if it does not already exist.When
runfile_parameters
is specified, its values are used to fill in the runfile instead of those generated automatically from the data inmodel
. This is necessary when the default runfile parameters do not suffice, but you do not want to change the runfile after it is written.Note: every
xarray.DataArray
inmodel
must have layer coordinates specified; useda.assign_coords(layer=...)
.- Parameters
path (str) – The directory to write the model to.
model (collections.OrderedDict) – Dictionary containing the package data as
xarray.DataArray
orpandas.DataFrame
.name (str) – Name given to the runfile. Defaults to “runfile”.
runfile_parameters (dict) – Dictionary containing the runfile parameters. Defaults to None, in which case runfile_parameters is generated from data in
model
.output_packages (list) – List of package names for which to write output, following the iMODFLOW conventions. For example, providing output_packages=[“shd”, “bnd”] writes heads, bdgfff, bdgflf, and bdgfrf.
- Returns
- Return type
None
Examples
Write the model data in dictionary
a
as iMODFLOW model files, to directory “example_dir”:>>> imod.flow.write(path="example_dir", model=a)
Generate runfile parameters for data in dictionary
a
usingimod.run.get_runfile()
, change the value forhclose
, and write:>>> runfile_parameters = imod.run.get_runfile(model=a) >>> runfile_parameters["hclose"] = 0.00001 >>> imod.flow.write(path="example_dir", model=a, runfile_parameters=runfile_parameters)