Skip to content

Commit 0ff4e76

Browse files
committed
Add optional argument to make sure xbout reads David Bold's MMS output file as a dump file rather than a grid file.
1 parent c7dd274 commit 0ff4e76

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

xbout/load.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def open_boutdataset(
8484
run_name=None,
8585
info=True,
8686
is_restart=None,
87+
is_mms_dump=False,
8788
**kwargs,
8889
):
8990
"""
@@ -180,12 +181,12 @@ def open_boutdataset(
180181
chunks = {}
181182

182183
input_type = _check_dataset_type(datapath)
183-
184184
if is_restart is None:
185185
is_restart = input_type == "restart"
186186
elif is_restart is True:
187187
input_type = "restart"
188-
188+
if is_mms_dump:
189+
input_type = "dump"
189190
if "reload" in input_type:
190191
if input_type == "reload":
191192
if isinstance(datapath, Path):
@@ -633,7 +634,6 @@ def _auto_open_mfboutdataset(
633634
nxpe, nype, mxg, myg, mxsub, mysub, is_squashed_doublenull = _read_splitting(
634635
filepaths[0], info, keep_yboundaries
635636
)
636-
637637
if is_squashed_doublenull:
638638
# Need to remove y-boundaries after loading: (i) in case we are loading a
639639
# squashed data-set, in which case we cannot easily remove the upper
@@ -737,9 +737,10 @@ def _auto_open_mfboutdataset(
737737
)
738738

739739
if not is_restart:
740-
# Remove any duplicate time values from concatenation
741-
_, unique_indices = unique(ds["t_array"], return_index=True)
742-
ds = ds.isel(t=unique_indices)
740+
if "t_array" in ds.keys():
741+
# Remove any duplicate time values from concatenation
742+
_, unique_indices = unique(ds["t_array"], return_index=True)
743+
ds = ds.isel(t=unique_indices)
743744

744745
return ds, remove_yboundaries
745746

0 commit comments

Comments
 (0)