Replies: 2 comments 4 replies
-
|
Hi @phaehnel, Models not written by imod-pythonUnsurprisingly, we run into similar issues when it comes to models made with alternative tools! I have posted a basic "Flopy-converter" here which we needed for a specific project: This uses Flopy to read the files (so at least we can deal with Python objects). An alternative approach can be found on this (very, very stale) PR: You might wonder why we don't "just" support reading MODFLOW 6 input files. The reason is that, unfortunately, MODFLOW 6 has a bewildering variety in its inputs. To name a few aspects:
We based imod-python on xarray and grid representations, because these are more transparent and easier to work with. Unfortunately, this means that there's no room for time series with alternatively spaced time indexes within a single package, or list-based inputs that have multiple boundaries for the same cell (since the grid representation can only hold a single value for a cell); as a consequence, list-inputs have to be expanded into separate package instances when imported into imod-python. For this reason, we've been hesitant to merge efforts into a release like a Flopy converter or the Modflow 6 input parsing. We could a read a certain subset of MODFLOW 6 inputs relatively easily, but e.g. list-based input with multiple boundaries in a single cell is extremely common and already requires a somewhat ugly workaround. And before you know, it's starts getting pretty complex with a lot of potential for bugs.(Worth noting: MODFLOW 6 is adding support for netCDF input with fully gridded data which matches our data model exactly.) The links above probably have useful code, but we haven't found the time to test them properly. So my recommendation would be: feel free to use it, but be aware that you need to check its correctness carefully and that you likely need to adapt it for your specific model (again, because MODFLOW 6 input has so many flavors). Disk spaceCasting everything a grid data indeed increases storage sizes, especially if the input is relatively sparse (e.g. a river package with boundaries on only 1% of the cells). Fortunately, this has a relatively simple workaround: enable compression on the netCDF writing. This is currently pretty tedious though, I guess: it requires setting the encoding on every package dataset (via Writing to Zarr instead of netCDF will automatically enable (very performant) compression. Incidentally, I've added an |
Beta Was this translation helpful? Give feedback.
-
|
Oh and I highly recommend writing binary input for MODFLOW 6! imod-python does so by default as you probably noticed, but it's substantially faster in writing. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear developers,
since I have several MODFLOW 6 models which were not created with imod-python, I was wondering if there is a way to load an existing MODFLOW 6 model with imod-python from the MODFLOW 6 input files directly. I couldn't find anything in the examples (https://deltares.github.io/imod-python/examples/index.html) or the API documentation (https://deltares.github.io/imod-python/api/index.html) regarding this.
So far I only found the option to load an existing model with the
sim.from_file()method that loads the existing model via a TOML file and netCDF files that represent the different MODFLOW packages' input files. This works fine if I have a model create with imod-python and usedsim.dump()beforehand to get the data required bysim.from_file().There are two scenarios where I think this could be useful:
Maybe I also have not quite fully understood how to work with the dump and TOML option or I have overseen some other functionality. However, I would be interested if you see any way in approaching this, e.g., the two scenarios mentioned above?
Cheers,
Patrick
Beta Was this translation helpful? Give feedback.
All reactions