Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
17 stars 3 forks source link

Start addressing #1116 #1117

Open Huite opened 2 months ago

Huite commented 2 months ago

This is a start of addressing the issues described in #1116.

I haven't run any of this code, but it does contain most of the ideas. In my mind, this:

The last point is the most contentious. You have logic for converting the list of dicts with dataframes into a dataset. What this PR does address is the fact that for the simple IDFs, they have to be "turned off" every next stress period definition: essentially, we are turning the project file + simple IDFs into a time series for each well point too.

However, this requires inserting starting and end times into the dataframes. That could be done here, but it may be easier to do in the subsequent processing step. I find that difficult to judge. Note that the associated IPFs already have a time column.

Huite commented 2 months ago

I've currently just written the helper functions in the body of the main function. Given the complexity here, it's probably better to move it into a separate module. There's already a prj folder, after all. The only thing to keep in mind is that _try_read_with_func should then be split off into another module to avoid circular imports.

Huite commented 2 months ago

I think I've just thought of another complication: this currently uses the associated IPF entries of the first stress period block to define them. However, it's technically possible to use the same associated IPF twice, but with a different layer entry. This means the current check is inadequate. So technically, I guess any unique (layer, associated IPF) is fine.

However, I think it's more reasonable to disallow assigning an associated IPF to more than one layer. It's pretty weird, and seems more likely to be the result of user error.

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud