Skip to content

Commit bab6d3f

Browse files
committed
Enhance run_supy_sample with time-based data subsetting
Adds optional start and end parameters to `run_supy_sample()` function, enabling flexible temporal subsetting of sample forcing data. This improvement allows users to easily extract and simulate specific time ranges from the sample dataset without modifying the original data.
1 parent 357d84c commit bab6d3f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/supy/_supy_module.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ def save_supy(
585585

586586

587587
def run_supy_sample(
588+
start=None,
589+
end=None,
588590
save_state=False,
589591
chunk_day=3660,
590592
logging_level=logging.INFO,
@@ -631,6 +633,14 @@ def run_supy_sample(
631633
# Load sample data
632634
df_state_init, df_forcing = load_sample_data()
633635

636+
# subset forcing data
637+
if start is not None:
638+
df_forcing = df_forcing[start:]
639+
if end is not None:
640+
df_forcing = df_forcing[:end]
641+
if start is not None and end is not None:
642+
df_forcing = df_forcing[start:end]
643+
634644
# Run SuPy with the sample data
635645
df_output, df_state_final = run_supy(
636646
df_forcing=df_forcing,

0 commit comments

Comments
 (0)