Skip to content

Commit

Permalink
correct the check in the TimToForcingConverter to compare units, us…
Browse files Browse the repository at this point in the history
…er_defined_names, and columns
  • Loading branch information
MAfarrag committed Jan 20, 2025
1 parent 430ebbe commit 3e1e359
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions hydrolib/tools/ext_old_to_new/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,10 @@ def convert(
if units is None or user_defined_names is None:
raise ValueError("Both 'units' and 'user_defined_names' must be provided.")

if len(units) != len(user_defined_names):
first_record = tim_model.timeseries[0].data
if len(units) != len(user_defined_names) != len(first_record):
raise ValueError(
"The lengths of 'units' and 'user_defined_names' must match."
)

if len(tim_model.timeseries) != len(user_defined_names):
raise ValueError(
"The number of timeseries in TimModel must match the number of user-defined names."
"The lengths of 'units', 'user_defined_names' and length of the columns in the first row must match."
)

df = tim_model.as_dataframe()
Expand Down

0 comments on commit 3e1e359

Please sign in to comment.