Skip to content

Commit 894f752

Browse files
committed
Support squashing files with Z guards
1 parent 8e8cfb6 commit 894f752

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/boutdata/data.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ def __init__(
10441044
info=False,
10451045
xguards=True,
10461046
yguards=False,
1047+
zguards=False,
10471048
tind=None,
10481049
xind=None,
10491050
yind=None,
@@ -1063,6 +1064,7 @@ def __init__(
10631064
self._info = info
10641065
self._xguards = xguards
10651066
self._yguards = yguards
1067+
self._zguards = zguards
10661068
self._kwargs = kwargs
10671069
self._parallel = parallel
10681070
if suffix is None:
@@ -1111,7 +1113,7 @@ def __init__(
11111113
f,
11121114
xguards=self._xguards,
11131115
yguards=self._yguards,
1114-
zguards=False,
1116+
zguards=self._zguards,
11151117
tind=tind,
11161118
xind=xind,
11171119
yind=yind,
@@ -1143,16 +1145,17 @@ def __init__(
11431145

11441146
if self._info:
11451147
print(
1146-
"mxsub = {} mysub = {} mz = {}\n".format(
1148+
"mxsub = {} mysub = {} mzsub = {}\n".format(
11471149
self.grid_info["mxsub"],
11481150
self.grid_info["mysub"],
1149-
self.grid_info["nz"],
1151+
self.grid_info["mzsub"],
11501152
)
11511153
)
11521154
print(
1153-
"nxpe = {}, nype = {}, npes = {}\n".format(
1155+
"nxpe = {}, nype = {}, nzpe = {}, npes = {}\n".format(
11541156
self.grid_info["nxpe"],
11551157
self.grid_info["nype"],
1158+
self.grid_info["nzpe"],
11561159
self.grid_info["npes"],
11571160
)
11581161
)
@@ -1536,6 +1539,7 @@ def _collect(self, varname):
15361539
info=self._info,
15371540
xguards=self._xguards,
15381541
yguards=self._yguards,
1542+
zguards=self._zguards,
15391543
tind=self.tind,
15401544
xind=self.xind,
15411545
yind=self.yind,
@@ -1631,7 +1635,7 @@ def _collect_parallel(self, varname):
16311635
else:
16321636
global_slices.append(0)
16331637
if "z" in dimensions:
1634-
global_slices.append(slice(None))
1638+
global_slices.append(slice(None, None, self.zind.step))
16351639
else:
16361640
global_slices.append(0)
16371641
global_slices = tuple(global_slices)
@@ -1681,7 +1685,7 @@ def _worker_function(self, connection, proc_list, shared_buffer_raw):
16811685
zind=self.zind,
16821686
xguards=self._xguards,
16831687
yguards=self._yguards,
1684-
zguards=False,
1688+
zguards=self._zguards,
16851689
info=self._info,
16861690
parallel_read=True,
16871691
)

src/boutdata/squashoutput.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def squashoutput(
2323
zind=None,
2424
xguards=True,
2525
yguards="include_upper",
26+
zguards=True,
2627
drop_variables=None,
2728
singleprecision=False,
2829
compress=False,
@@ -156,6 +157,7 @@ def squashoutput(
156157
info=False,
157158
xguards=xguards,
158159
yguards=yguards,
160+
zguards=zguards,
159161
tind=tind,
160162
xind=xind,
161163
yind=yind,

0 commit comments

Comments
 (0)