Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/exg-gwfgwf.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- exg gwfgwf options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-chd.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf chd options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-drn.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf drn options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-evt.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf evt options ---------------------
# flopy multi-package

block options
name fixed_cell
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-evta.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf evta options ---------------------
# flopy multi-package

block options
name readasarrays
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-ghb.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf ghb options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-lak.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf lak options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-maw.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf maw options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-rch.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf rch options ---------------------
# flopy multi-package

block options
name fixed_cell
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-rcha.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf rcha options ---------------------
# flopy multi-package

block options
name readasarrays
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-riv.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf riv options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-sfr.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf sfr options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-uzf.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf uzf options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/gwf-wel.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf wel options ---------------------
# flopy multi-package

block options
name auxiliary
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/utl-obs.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf obs options ---------------------
# flopy multi-package

block options
name digits
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/utl-spc.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- ssm spc options ---------------------
# flopy multi-package

block options
name print_input
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/utl-spca.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- ssm spca options ---------------------
# flopy multi-package

block options
name readasarrays
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/utl-tas.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf ts attributes ---------------------
# flopy multi-package

block attributes
name time_series_namerecord
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/data/dfn/utl-ts.dfn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --------------------- gwf ts attributes ---------------------
# flopy multi-package

block attributes
name time_series_namerecord
Expand Down
69 changes: 24 additions & 45 deletions flopy/mf6/data/mfstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ class Dfn:
folder containing package definition files (dfn)
common : path
file containing common information
multi_package : dict
contains the names of all packages that are allowed to have multiple
instances in a model/simulation

Methods
-------
Expand All @@ -70,31 +67,6 @@ def __init__(self):
# directories
self.dfndir = os.path.join(".", "dfn")
self.common = os.path.join(self.dfndir, "common.dfn")
# FIX: Transport - multi packages are hard coded
self.multi_package = {
"exggwfgwf": 0,
"gwfchd": 0,
"gwfwel": 0,
"gwfdrn": 0,
"gwfriv": 0,
"gwfghb": 0,
"gwfrch": 0,
"gwfrcha": 0,
"gwfevt": 0,
"gwfevta": 0,
"gwfmaw": 0,
"gwfsfr": 0,
"gwflak": 0,
"gwfuzf": 0,
"lnfcgeo": 0,
"lnfrgeo": 0,
"lnfngeo": 0,
"utlobs": 0,
"utlts": 0,
"utltas": 0,
"utlspc": 0,
"utlspca": 0,
}

def get_file_list(self):
file_order = [
Expand Down Expand Up @@ -192,8 +164,6 @@ class DfnPackage(Dfn):

Methods
-------
multi_package_support : () : bool
returns flag for multi-package support
get_block_structure_dict : (path : tuple, common : bool, model_file :
bool) : dict
returns a dictionary of block structure information for the package
Expand Down Expand Up @@ -225,17 +195,20 @@ def __init__(self, package):
)
self.dfn_list = package.dfn

def multi_package_support(self):
return self.package.package_abbr in self.multi_package

def get_block_structure_dict(self, path, common, model_file):
block_dict = {}
dataset_items_in_block = {}
self.dataset_items_needed_dict = {}
keystring_items_needed_dict = {}
current_block = None

for dfn_entry in self.dfn_list:
# get header dict
header_dict = {}
for item in self.dfn_list[0]:
if item == "multi-package":
header_dict["multi-package"] = True

for dfn_entry in self.dfn_list[1:]:
# load next data item
new_data_item_struct = MFDataItemStructure()
for next_line in dfn_entry:
Expand Down Expand Up @@ -389,7 +362,7 @@ def get_block_structure_dict(self, path, common, model_file):
)
block_dataset_struct.add_item(block_data_item_struct)
current_block.add_dataset(block_dataset_struct)
return block_dict
return block_dict, header_dict

def _new_dataset(
self,
Expand Down Expand Up @@ -451,8 +424,6 @@ class DfnFile(Dfn):

Methods
-------
multi_package_support : () : bool
returns flag for multi-package support
dict_by_name : {} : dict
returns a dictionary of data item descriptions from the dfn file with
the data item name as the dictionary key
Expand Down Expand Up @@ -492,11 +463,6 @@ def __init__(self, file):
self.dataset_items_needed_dict = {}
self.dfn_list = []

def multi_package_support(self):
base_file = os.path.splitext(self.file)[0]
base_file = base_file.replace("-", "")
return base_file in self.multi_package

def dict_by_name(self):
name_dict = {}
name = None
Expand All @@ -520,6 +486,19 @@ def get_block_structure_dict(self, path, common, model_file):
current_block = None
dfn_fp = open(self._file_path, "r")

# load header
header_dict = {}
while True:
line = dfn_fp.readline()
if len(line) < 1 or line[0] != "#":
break
line_lst = line.strip().split()
if len(line_lst) > 2 and line_lst[1] == "flopy":
# load flopy data
if line_lst[2] == "multi-package":
header_dict["multi-package"] = True

# load file definitions
for line in dfn_fp:
if self._valid_line(line):
# load next data item
Expand Down Expand Up @@ -697,7 +676,7 @@ def get_block_structure_dict(self, path, common, model_file):
)
current_block.add_dataset(block_dataset_struct)
dfn_fp.close()
return block_dict
return block_dict, header_dict

def _new_dataset(
self,
Expand Down Expand Up @@ -2097,10 +2076,10 @@ def __init__(self, dfn_file, path, common, model_file):
self.model_file = model_file # file belongs to a specific model
self.read_as_arrays = False

self.multi_package_support = dfn_file.multi_package_support()
self.blocks = dfn_file.get_block_structure_dict(
self.blocks, self.header = dfn_file.get_block_structure_dict(
self.path, common, model_file
)
self.multi_package_support = "multi-package" in self.header
self.dfn_list = dfn_file.dfn_list

def is_valid(self):
Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/modflow/mfgnc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ListTemplateGenerator

Expand Down Expand Up @@ -104,6 +104,9 @@ class ModflowGnc(mfpackage.MFPackage):
dfn_file_name = "gwf-gnc.dfn"

dfn = [
[
"header",
],
[
"block options",
"name print_input",
Expand Down
2 changes: 1 addition & 1 deletion flopy/mf6/modflow/mfgwf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfmodel
from ..data.mfdatautil import ListTemplateGenerator, ArrayTemplateGenerator

Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/modflow/mfgwfapi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ListTemplateGenerator

Expand Down Expand Up @@ -68,6 +68,9 @@ class ModflowGwfapi(mfpackage.MFPackage):
dfn_file_name = "gwf-api.dfn"

dfn = [
[
"header",
],
[
"block options",
"name boundnames",
Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/modflow/mfgwfbuy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ListTemplateGenerator

Expand Down Expand Up @@ -96,6 +96,9 @@ class ModflowGwfbuy(mfpackage.MFPackage):
dfn_file_name = "gwf-buy.dfn"

dfn = [
[
"header",
],
[
"block options",
"name hhformulation_rhs",
Expand Down
6 changes: 5 additions & 1 deletion flopy/mf6/modflow/mfgwfchd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ListTemplateGenerator

Expand Down Expand Up @@ -117,6 +117,10 @@ class ModflowGwfchd(mfpackage.MFPackage):
dfn_file_name = "gwf-chd.dfn"

dfn = [
[
"header",
"multi-package",
],
[
"block options",
"name auxiliary",
Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/modflow/mfgwfcsub.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ListTemplateGenerator, ArrayTemplateGenerator

Expand Down Expand Up @@ -322,6 +322,9 @@ class ModflowGwfcsub(mfpackage.MFPackage):
dfn_file_name = "gwf-csub.dfn"

dfn = [
[
"header",
],
[
"block options",
"name boundnames",
Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/modflow/mfgwfdis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ArrayTemplateGenerator

Expand Down Expand Up @@ -90,6 +90,9 @@ class ModflowGwfdis(mfpackage.MFPackage):
dfn_file_name = "gwf-dis.dfn"

dfn = [
[
"header",
],
[
"block options",
"name length_units",
Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/modflow/mfgwfdisu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on October 29, 2021 21:09:57 UTC
# FILE created on December 22, 2021 17:36:26 UTC
from .. import mfpackage
from ..data.mfdatautil import ArrayTemplateGenerator, ListTemplateGenerator

Expand Down Expand Up @@ -205,6 +205,9 @@ class ModflowGwfdisu(mfpackage.MFPackage):
dfn_file_name = "gwf-disu.dfn"

dfn = [
[
"header",
],
[
"block options",
"name length_units",
Expand Down
Loading