Skip to content

Commit

Permalink
fix drop_none and attach_children
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 10, 2024
1 parent 4047f46 commit 173ccec
Show file tree
Hide file tree
Showing 114 changed files with 1,122 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/dfn2toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _attach_children(d: Any):
if isinstance(d, Mapping):
if "children" in d:
for n, c in d["children"].items():
d[n] = Shim._attach_children(c)
d[n] = c
del d["children"]
d = {k: Shim._attach_children(v) for k, v in d.items()}
return d
Expand All @@ -29,7 +29,7 @@ def _drop_none(d: Any):
return {
k: Shim._drop_none(v)
for k, v in d.items()
if (v or isinstance(v, bool))
if v is not None
}
else:
return d
Expand Down
5 changes: 5 additions & 0 deletions spec/toml/chf-cdb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ name = "stress_period_data"
type = "list"
shape = "(maxbound)"
block = "period"
description = ""

[period.stress_period_data.stress_period_data]
name = "stress_period_data"
type = "record"
block = "period"
description = ""

[period.stress_period_data.stress_period_data.cellid]
block = "period"
Expand All @@ -77,6 +79,7 @@ description = "is the cell identifier, and depends on the type of grid that is u
block = "period"
name = "idcxs"
type = "integer"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -89,6 +92,7 @@ numeric_index = "true"
block = "period"
name = "width"
type = "double precision"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -114,6 +118,7 @@ mf6internal = "auxvar"
block = "period"
name = "boundname"
type = "string"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand Down
4 changes: 4 additions & 0 deletions spec/toml/chf-chd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ name = "stress_period_data"
type = "list"
shape = "(maxbound)"
block = "period"
description = ""

[period.stress_period_data.stress_period_data]
name = "stress_period_data"
type = "record"
block = "period"
description = ""

[period.stress_period_data.stress_period_data.cellid]
block = "period"
Expand All @@ -97,6 +99,7 @@ description = "is the cell identifier, and depends on the type of grid that is u
block = "period"
name = "head"
type = "double precision"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -121,6 +124,7 @@ description = "represents the values of the auxiliary variables for each constan
block = "period"
name = "boundname"
type = "string"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand Down
9 changes: 9 additions & 0 deletions spec/toml/chf-cxs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ name = "packagedata"
type = "list"
shape = "(nsections)"
block = "packagedata"
description = ""

[packagedata.packagedata.packagedata]
name = "packagedata"
type = "record"
block = "packagedata"
description = ""

[packagedata.packagedata.packagedata.idcxs]
block = "packagedata"
name = "idcxs"
type = "integer"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -45,6 +48,7 @@ numeric_index = "true"
block = "packagedata"
name = "nxspoints"
type = "integer"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -56,16 +60,19 @@ name = "crosssectiondata"
type = "list"
shape = "(npoints)"
block = "crosssectiondata"
description = ""

[crosssectiondata.crosssectiondata.crosssectiondata]
name = "crosssectiondata"
type = "record"
block = "crosssectiondata"
description = ""

[crosssectiondata.crosssectiondata.crosssectiondata.xfraction]
block = "crosssectiondata"
name = "xfraction"
type = "double precision"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -76,6 +83,7 @@ description = "real value that defines the station (x) data for the cross-sectio
block = "crosssectiondata"
name = "height"
type = "double precision"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -86,6 +94,7 @@ description = "real value that is the height relative to the top of the lowest e
block = "crosssectiondata"
name = "manfraction"
type = "double precision"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand Down
1 change: 1 addition & 0 deletions spec/toml/chf-dis2d.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type = "double precision"
shape = "(ncol, nrow)"
block = "griddata"
description = "is the bottom elevation for each cell."
default = 0.0

[griddata.idomain]
name = "idomain"
Expand Down
4 changes: 4 additions & 0 deletions spec/toml/chf-disv1d.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ name = "vertices"
type = "list"
shape = "(nvert)"
block = "vertices"
description = ""

[vertices.vertices.vertices]
name = "vertices"
type = "record"
block = "vertices"
description = ""

[vertices.vertices.vertices.iv]
block = "vertices"
Expand Down Expand Up @@ -120,11 +122,13 @@ name = "cell1d"
type = "list"
shape = "(nodes)"
block = "cell1d"
description = ""

[cell1d.cell1d.cell1d]
name = "cell1d"
type = "record"
block = "cell1d"
description = ""

[cell1d.cell1d.cell1d.icell1d]
block = "cell1d"
Expand Down
4 changes: 4 additions & 0 deletions spec/toml/chf-disv2d.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ name = "vertices"
type = "list"
shape = "(nvert)"
block = "vertices"
description = ""

[vertices.vertices.vertices]
name = "vertices"
type = "record"
block = "vertices"
description = ""

[vertices.vertices.vertices.iv]
block = "vertices"
Expand Down Expand Up @@ -113,11 +115,13 @@ name = "cell2d"
type = "list"
shape = "(nodes)"
block = "cell2d"
description = ""

[cell2d.cell2d.cell2d]
name = "cell2d"
type = "record"
block = "cell2d"
description = ""

[cell2d.cell2d.cell2d.icell2d]
block = "cell2d"
Expand Down
4 changes: 4 additions & 0 deletions spec/toml/chf-flw.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ name = "stress_period_data"
type = "list"
shape = "(maxbound)"
block = "period"
description = ""

[period.stress_period_data.stress_period_data]
name = "stress_period_data"
type = "record"
block = "period"
description = ""

[period.stress_period_data.stress_period_data.cellid]
block = "period"
Expand All @@ -97,6 +99,7 @@ description = "is the cell identifier, and depends on the type of grid that is u
block = "period"
name = "q"
type = "double precision"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand All @@ -121,6 +124,7 @@ description = "represents the values of the auxiliary variables for each inflow.
block = "period"
name = "boundname"
type = "string"
shape = ""
tagged = "false"
in_record = "true"
reader = "urword"
Expand Down
1 change: 1 addition & 0 deletions spec/toml/chf-ic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ type = "double precision"
shape = "(nodes)"
block = "griddata"
description = "is the initial (starting) stage---that is, stage at the beginning of the swf model simulation. strt must be specified for all swf model simulations. one value is read for every model reach."
default = 0.0
2 changes: 2 additions & 0 deletions spec/toml/chf-nam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ description = "keyword that indicates whether the surface water stage in a reach
name = "packages"
type = "list"
block = "packages"
description = ""

[packages.packages.packages]
name = "packages"
type = "record"
block = "packages"
description = ""

[packages.packages.packages.ftype]
block = "packages"
Expand Down
Loading

0 comments on commit 173ccec

Please sign in to comment.