gwmod / nlmod

Python package to build, run and visualize MODFLOW 6 groundwater models in the Netherlands.
https://nlmod.readthedocs.io
MIT License
31 stars 2 forks source link

nlmod.to_model_ds() to accept vertex layer_models #298

Open bdestombe opened 9 months ago

bdestombe commented 9 months ago

Currently nlmod.to_model_ds() silently only accept structured layer_models. Supporting vertex grids is desired for when the constructed layer_model is not from REGIS but self constructed, i.e. interpreted triwaco layers with refined grids.

The current way of doing it, following example nb 3 would be to

I would propose the following:

Does this make sense? Which changes would this imply?

Furthermore, the ds_vertex has properties delr and delc that not make sense as it is a vertex grid now. There are some functions that use the delr and delc attributes, such as some reprojecting functions. These functions mostly also work with vertex grid. But shouldn't they produce an error because the delr and delc are invalid.

edit: renamed ds2 to ds_vertex

rubencalje commented 9 months ago

Can't you just add the information from your layers to a model-dataset without creating a layer model first:

# set layer to the amount of layers you need
ds = nlmod.get_ds([100_000, 110_000, 400_000, 405_000], delr=50, delc=50, layer=1)
ds = ds.refine(xxx)

After which you change top, botm, kh and kv based on your (triwaco) data.

The delr and delc attributes represent the properties of the base grid, before refining took place. I think they are ignored by all methods however, so it should be better to remove them.

bdestombe commented 9 months ago

Can't you just add the information from your layers to a model-dataset without creating a layer model first:

# set layer to the amount of layers you need
ds = nlmod.get_ds([100_000, 110_000, 400_000, 405_000], delr=50, delc=50, layer=1)
ds = ds.refine(xxx)

After which you change top, botm, kh and kv based on your (triwaco) data.

The delr and delc attributes represent the properties of the base grid, before refining took place. I think they are ignored by all methods however, so it should be better to remove them.

Hi Ruben, thanks for your response.

Yes, that work-around is similar to the first approach I am describing. But is having a more flexible ds construction routine, which accepts both structured and vertex grids seems preferable to me.

If not, the documentation, and maybe even the function name, should reflect that is only supports structured grids.