modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
506 stars 306 forks source link

sim.write_simulation() dropping headers on external files #2233

Open wkitlasten opened 2 months ago

wkitlasten commented 2 months ago

Describe the bug

Headers on external files are being dropped after calling sim.write_simulation() with sim.set_all_data_external().

To Reproduce Create external files with a # header:

# k i j elev cond
1 1 90 247.7714385986328 900000.0
1 1 95 65.20931243896484 900000.0
...

Add the package to model:

flopy.mf6.ModflowGwfdrn(gwf, maxbound=nvals, pname='drn', 
                                        stress_period_data={0: {'filename': fname}})
sim.set_all_data_external()

At this point the external file still has the header. But after sim.write_simulation() the header disappears. This happens with external files in the DRN, GHB, and WEL packages, but does not appear to happen with reach or connection data in the SFR package.

Expected behavior I expect the original external file to remain unchanged by flopy to preserve any pre or post processing that may rely on the headers, as is the case with the SFR reach data and SFR connection data.

Desktop (please complete the following information):