Skip to content

Commit e6c61f3

Browse files
committed
update xattree and spec field array decorator wrapper to support dtype
1 parent 9cb90f3 commit e6c61f3

File tree

16 files changed

+73
-43
lines changed

16 files changed

+73
-43
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
}
1414
},
1515
"python.analysis.typeCheckingMode": "off",
16+
"debugpy.debugJustMyCode": false,
1617
"files.exclude": {
1718
"**/.git": true,
1819
"**/.svn": true,

flopy4/mf6/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
MF6 = "mf6"
44
FILL_DEFAULT = np.nan
55
FILL_DNODATA = 1e30
6+
LENBOUNDNAME = 40

flopy4/mf6/gwf/chd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from xattree import xattree
88

99
from flopy4.mf6.component import update_maxbound
10+
from flopy4.mf6.constants import LENBOUNDNAME
1011
from flopy4.mf6.converter import dict_to_array
1112
from flopy4.mf6.package import Package
1213
from flopy4.mf6.spec import array, field, path
@@ -51,6 +52,7 @@ class Chd(Package):
5152
on_setattr=update_maxbound,
5253
)
5354
boundname: Optional[NDArray[np.str_]] = array(
55+
dtype=f"<U{LENBOUNDNAME}",
5456
block="period",
5557
dims=(
5658
"nper",

flopy4/mf6/gwf/dis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Dis(Package):
6464
dims=("nlay", "nrow", "ncol"),
6565
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
6666
)
67-
idomain: Optional[NDArray[np.int32]] = array(
67+
idomain: Optional[NDArray[np.int64]] = array(
6868
block="griddata",
6969
default=1,
7070
dims=("nlay", "nrow", "ncol"),

flopy4/mf6/gwf/drn.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from xattree import xattree
88

99
from flopy4.mf6.component import update_maxbound
10+
from flopy4.mf6.constants import LENBOUNDNAME
1011
from flopy4.mf6.converter import dict_to_array
1112
from flopy4.mf6.package import Package
1213
from flopy4.mf6.spec import array, field, path
@@ -57,6 +58,7 @@ class Drn(Package):
5758
on_setattr=update_maxbound,
5859
)
5960
boundname: Optional[NDArray[np.str_]] = array(
61+
dtype=f"<U{LENBOUNDNAME}",
6062
block="period",
6163
dims=(
6264
"nper",

flopy4/mf6/gwf/npf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Xt3dOptions:
5050
export_array_netcdf: bool = field(block="options", default=False)
5151
dev_no_newton: bool = field(block="options", default=False)
5252
dev_omega: Optional[float] = field(block="options", default=None)
53-
icelltype: NDArray[np.integer] = array(
53+
icelltype: NDArray[np.int64] = array(
5454
block="griddata",
5555
dims=("nodes",),
5656
default=0,

flopy4/mf6/gwf/oc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,28 @@ class Period:
4747
# TODO: needs coverter and then rename?
4848
head: Optional[Format] = field(block="options", default=None)
4949
save_head: Optional[NDArray[np.str_]] = array(
50+
dtype=np.dtypes.StringDType(),
5051
block="period",
5152
default="all",
5253
dims=("nper",),
5354
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
5455
)
5556
save_budget: Optional[NDArray[np.str_]] = array(
57+
dtype=np.dtypes.StringDType(),
5658
block="period",
5759
default="all",
5860
dims=("nper",),
5961
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
6062
)
6163
print_head: Optional[NDArray[np.str_]] = array(
64+
dtype=np.dtypes.StringDType(),
6265
block="period",
6366
default="all",
6467
dims=("nper",),
6568
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
6669
)
6770
print_budget: Optional[NDArray[np.str_]] = array(
71+
dtype=np.dtypes.StringDType(),
6872
block="period",
6973
default="all",
7074
dims=("nper",),

flopy4/mf6/gwf/rch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from xattree import xattree
88

99
from flopy4.mf6.component import update_maxbound
10+
from flopy4.mf6.constants import LENBOUNDNAME
1011
from flopy4.mf6.converter import dict_to_array
1112
from flopy4.mf6.package import Package
1213
from flopy4.mf6.spec import array, field, path
@@ -51,6 +52,7 @@ class Rch(Package):
5152
on_setattr=update_maxbound,
5253
)
5354
boundname: Optional[NDArray[np.str_]] = array(
55+
dtype=f"<U{LENBOUNDNAME}",
5456
block="period",
5557
dims=(
5658
"nper",

flopy4/mf6/gwf/sto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Sto(Package):
2424
export_array_netcdf: bool = field(block="options", default=False)
2525
dev_original_specific_storage: bool = field(block="options", default=False)
2626
dev_oldstorageformulation: bool = field(block="options", default=False)
27-
iconvert: NDArray[np.int32] = array(
27+
iconvert: NDArray[np.int64] = array(
2828
block="griddata",
2929
dims=("nodes",),
3030
default=0,

flopy4/mf6/gwf/wel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from xattree import xattree
88

99
from flopy4.mf6.component import update_maxbound
10+
from flopy4.mf6.constants import LENBOUNDNAME
1011
from flopy4.mf6.converter import dict_to_array
1112
from flopy4.mf6.package import Package
1213
from flopy4.mf6.spec import array, field, path
@@ -55,6 +56,7 @@ class Wel(Package):
5556
on_setattr=update_maxbound,
5657
)
5758
boundname: Optional[NDArray[np.str_]] = array(
59+
dtype=f"<U{LENBOUNDNAME}",
5860
block="period",
5961
dims=(
6062
"nper",

0 commit comments

Comments
 (0)