-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Grid
It should be possible to create packages without reference to grid dimensions and coordinates, even if the package has variables aligned to them.
IMOD-Python allows this, see for instance in the 1d solute transport example
>>> ic = imod.mf6.InitialConditions(start=0.)
>>> ic
InitialConditions
<xarray.Dataset> Size: 8B
Dimensions: ()
Data variables:
start float64 8B 0.0By default we currently try to expand arrays from constants eagerly
>>> flopy4.mf6.gwf.ic.Ic(strt=0.0)
Traceback (most recent call last):
...
File "/Users/wbonelli/dev/pyphoenix-project/.pixi/envs/dev/lib/python3.11/site-packages/xattree/__init__.py", line 885, in _resolve_array
raise DimsNotFound(
xattree.DimsNotFound: "Class 'Ic' array 'strt' failed dim resolution: nodes"But we (nominally) support creating packages without dims with strict=False
>>> ic = Ic(strt=0.0, strict=False)However I realize this is a bit broken, the constant value isn't getting set.
>>> ic
Ic(filename=None, export_array_ascii=False, export_array_netcdf=False, strt=None, name='ic', strict=False)We also support passing dims explicitly
>>> Ic(strt=0.0, dims={"nodes": 5})
Ic(filename=None, ..., strt=<xarray.DataArray 'strt' (nodes: 5)> Size: 40B array([0., 0., 0., 0., 0.])
Dimensions without coordinates: nodes, name='ic', strict=True)I wonder whether we want strict or lenient by default.
Tangentially we could consider triggering expansion when grid dims are known. The discretization would have to signal somehow to packages.
Time
imod-python lets you to define the time discretization last, after the rest of the simulation, by inspecting the union of all datetimes configured for all packages (see the bottom of the same example linked above). We should support that too