We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e4060c commit 27834ffCopy full SHA for 27834ff
1 file changed
modflow_devtools/dfn.py
@@ -137,6 +137,21 @@ def get_blocks(dfn: "Dfn") -> Blocks:
137
)
138
139
140
+def get_fields(dfn: "Dfn") -> Fields:
141
+ """
142
+ Extract a flat dictionary of fields from an input definition.
143
+ Only top-level fields are included, i.e. subfields of records
144
+ or recarrays are not included.
145
146
+ fields = {}
147
+ for block in get_blocks(dfn).values():
148
+ for field in block.values():
149
+ if field["name"] in fields:
150
+ warn(f"Duplicate field name {field['name']} in {dfn['name']}")
151
+ fields[field["name"]] = field
152
+ return fields
153
+
154
155
class Field(TypedDict):
156
"""A field specification."""
157
0 commit comments