You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Reading the MassBudgets from a MT3D-List file fails.
We are seeing two bugs here.
Reading out "CALLS TO GCG PACKAGE" (see attached file line 249) fails, because the expected character span (line[51:58]) does not match with the existing here.
The sourcecode tries to parse, but returns more characters than expected.
line = ' 1 CALLS TO GCG PACKAGE FOR TRANSPORT TIME STEP 1 IN FLOW TIME STEP 1 STRESS PERIOD 1'
print(line[51:58])
>>> ' 1 IN'
With activated ADV-Package, three additional lines regarding Particle Tracking are created for each Component and Step. Instead of parsing.
The sourcecode expects to parse:
CUMMULATIVE MASS BUDGETS AT END OF TRANSPORT STEP 21, TIME STEP 1, STRESS PERIOD 1
but it gets
TOTAL PARTICLES USED IN THE CURRENT STEP = 4264
To Reproduce
Steps to reproduce the behavior:
Attached goes the mt.list as zip-file.
Additional context
To solve the first bug I propose to use regex instead of static character spans.
This could be something like that, reading a number which in in between known strings.
def_extract_number_between_strings(input_string, start_string, end_string):
pattern=rf"{re.escape(start_string)}\s*(\d+)\s*{re.escape(end_string)}"match=re.search(pattern, input_string)
ifmatch:
returnint(match.group(1))
else:
raiseException(
f"Error extracting number between {start_string} and {end_string} in {input_string}"
)
To solve the second bug, I propose to add a simple conditional to skip 4 more lines if the string contains part of "TOTAL PARTICLES USED IN THE CURRENT STEP".
Describe the bug
Reading the MassBudgets from a MT3D-List file fails.
We are seeing two bugs here.
The sourcecode tries to parse, but returns more characters than expected.
The sourcecode expects to parse:
CUMMULATIVE MASS BUDGETS AT END OF TRANSPORT STEP 21, TIME STEP 1, STRESS PERIOD 1
but it gets
TOTAL PARTICLES USED IN THE CURRENT STEP = 4264
To Reproduce
Steps to reproduce the behavior:
Attached goes the mt.list as zip-file.
Additional context
To solve the first bug I propose to use regex instead of static character spans.
This could be something like that, reading a number which in in between known strings.
To solve the second bug, I propose to add a simple conditional to skip 4 more lines if the string contains part of "TOTAL PARTICLES USED IN THE CURRENT STEP".
We will provide a PR.
mt.list.zip
The text was updated successfully, but these errors were encountered: