Skip to content

bug: Headfile.reverse() changes time-step indices #2459

@shundt

Description

@shundt

Bug Description
I am attempting to use the Headfile.reverse() method to facilitate backwards particle tracking using PRT in sequence after GWF. PRT is crashing with the following error:

ERROR REPORT: 1. TIME STEP NUMBER IN HEAD FILE DOES NOT MATCH TIME STEP NUMBER IN TRANSPORT MODEL. IF THERE IS MORE THAN ONE TIME STEP IN THE HEAD FILE FOR A GIVEN STRESS PERIOD, HEAD FILE TIME STEPS MUST MATCH GWT MODEL TIME STEPS ONE-FOR-ONE IN THAT STRESS PERIOD.

It appears that the .reverse() method is adding 1 to all of the time-step indices for each stress period except for the first (which becomes the last in the reversed). The GWF model has 1 time step per stress period. Here is a screenshot showing how the time-step indices have changed:

Image

It is possible this issue is present in the budget file too, but I am having an issue (potentially related) loading the reversed budget file with flopy.

Possible Diagnosis
I was able to fix the behavior in the Headfile by changing header["kstp"] to (header["ktsp"] - 1) in the following function, but am not sure if that is a complete fix.

Image

System & versions

  • OS: Windows
  • Flopy version 3.9.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions