Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added simple function to mfdis.py #2056

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions flopy/modflow/mfdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,31 @@ def get_final_totim(self):
"""
return self.get_totim()[-1]

def get_per_stp_perlen(self):
"""
Get lists for stress periods, time steps, and period lengths in the model.

Returns
-------
per: list of ints
Stress periods in the model
stp: list of ints
Timesteps in each stress period
perlen: list of ints
Length of each timestep
"""

nstp = self.nstp.array
nperlen = self.perlen.array
per = []
stp = []
perlen = []
for iper in range(self.nper):
per.append(iper + 1) # Use 1-based indexing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's probably best to return 0-based per flopy3+ convention

stp.append(nstp[iper])
perlen.append(nperlen[iper])
return per, stp, perlen

def get_kstp_kper_toffset(self, t=0.0, use_cached_totim=False):
"""
Get the stress period, time step, and time offset from passed time.
Expand Down