Deltares / Deltares/imod-python

Additional arguments to `create_time_discretization` methods

Open
#440 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

In GitLab by @Huite on Jun 21, 2023, 15:06

The time discretization objects store duration of stress periods, the number of timesteps (generally 1.0) and a multiplication factor (for expontential growth).

We require the create_time_discretization method on the model or simulation, as it checks all packages and derives stress period definition from there. However, it's not uncommon to have one or a few steady-state periods in a simulation (especially at the start). This currently requires something like this:

model.create_time_discretization(["2000-01-01", "2010-01-01"])
model["time_discretization"]["transient"][0] = False

I would argue that something like this is nicer:

model.create_time_discretization(transient={"2000-01-01": False})

And similarly for the other settings:

model.create_time_discretization(transient={"2000-01-01": False}, n_timesteps={"2001-01-01": 5})

It's arguable whether the transient argument should be a dict, since its values are always boolean. It could also be a list of steady-state dates, but having dicts like these are consistent across the arguments.

The default values can remain the same: almost all stress periods are transient=True, n_timesteps is nearly always 1, and the multiplication is nearly always 1.0.
In the worst case, a user can still access the entire array in the "old way":

model["time_discretization"]["transient"][:] = False

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the model and simulation create_time_discretization methods and inspect how they derive the transient, n_timesteps, and multiplication settings. Define done as supporting the proposed date-keyed overrides while preserving the existing defaults and direct array access; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.