Skip to content

Commit

Permalink
revert unintended changes due to version conflict in mfmodel.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarsen-usgs committed Aug 7, 2021
1 parent 462f910 commit 7aaa796
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,14 @@ def load_base(
print(" loading package {}...".format(ftype))
# load package
instance.load_package(ftype, fname, pname, strict, None)

sim_data = simulation.simulation_data
if ftype == "dis" and not sim_data.max_columns_user_set:
# set column wrap to ncol
dis = instance.get_package("dis")
if dis is not None and hasattr(dis, "ncol"):
sim_data.max_columns_of_data = dis.ncol.get_data()
sim_data.max_columns_user_set = False
sim_data.max_columns_auto_set = True
# load referenced packages
if modelname in instance.simulation_data.referenced_files:
for ref_file in instance.simulation_data.referenced_files[
Expand Down Expand Up @@ -981,6 +988,9 @@ def set_model_relative_path(self, model_ws):
Model working folder relative to simulation working folder
"""
# set all data internal
self.set_all_data_internal(False)

# update path in the file manager
file_mgr = self.simulation_data.mfpath
file_mgr.set_last_accessed_model_path()
Expand All @@ -992,6 +1002,10 @@ def set_model_relative_path(self, model_ws):
and model_ws != "."
and self.simulation.name_file is not None
):
model_folder_path = file_mgr.get_model_path(self.name)
if not os.path.exists(model_folder_path):
# make new model folder
os.makedirs(model_folder_path)
# update model name file location in simulation name file
models = self.simulation.name_file.models
models_data = models.get_data()
Expand Down Expand Up @@ -1172,7 +1186,26 @@ def rename_all_packages(self, name):
package.package_type,
)

def set_all_data_external(self, check_data=True):
def set_all_data_external(
self, check_data=True, external_data_folder=None
):
"""Sets the model's list and array data to be stored externally.
Parameters
----------
check_data : bool
Determines if data error checking is enabled during this
process.
external_data_folder
Folder, relative to the simulation path or model relative path
(see use_model_relative_path parameter), where external data
will be stored
"""
for package in self.packagelist:
package.set_all_data_external(check_data, external_data_folder)

def set_all_data_internal(self, check_data=True):
"""Sets the model's list and array data to be stored externally.
Parameters
Expand All @@ -1183,7 +1216,7 @@ def set_all_data_external(self, check_data=True):
"""
for package in self.packagelist:
package.set_all_data_external(check_data)
package.set_all_data_internal(check_data)

def register_package(
self,
Expand Down

0 comments on commit 7aaa796

Please sign in to comment.