Repository navigation
Should set_sim_path() preserve external array structure? #2863
|
Hi, I have a MODFLOW 6 simulation whose NPF and STO packages contain arrays stored externally using I am trying to load the simulation and write it to a new workspace using a workflow like this: sim = flopy.mf6.MFSimulation.load(
sim_ws=original_sim_ws,
)
sim.set_sim_path(new_sim_ws)
sim.write_simulation()After writing the simulation to However, if I first copy the entire model directory, then load and write the simulation without changing In summary: I am not modifying the package data or arrays between loading and writing. The only change is the simulation workspace. Copying the entire model directory before loading is not ideal because the original workspace also contains files that are not required to run the simulation, such as PEST and PLPROC files. I have read about lazy_io, but as I understand it, this option does not guarantee preservation of the external-file structure, filenames, and OPEN/CLOSE references when changing sim_ws. Is this intended behavior or a FloPy bug? Would upgrading to FloPy 3.11 resolve it, or is there a recommended workflow for writing a loaded simulation to a new workspace while preserving its existing external-array storage? |
Replies: 1 comment 2 replies
|
This is intended. set_sim_path calls set_all_data_internal() first, in both 3.10 and 3.11. You can skip it like this. import os
import flopy
sim = flopy.mf6.MFSimulation.load(sim_ws=original_sim_ws)
os.makedirs(new_sim_ws, exist_ok=True)
sim.simulation_data.mfpath.set_sim_path(new_sim_ws, True)
sim.simulation_data.mfpath.copy_files()
sim.write_simulation()I tested it and the OPEN/CLOSE files kept their names. Only files the model uses get copied, so your PEST files stay behind. |
This is intended. set_sim_path calls set_all_data_internal() first, in both 3.10 and 3.11. You can skip it like this.
I tested it and the OPEN/CLOSE files kept their names. Only files the model uses get copied, so your PEST files stay behind.