Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reading walltime variables #289

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion xbout/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,11 @@ def _trim(ds, *, guards, keep_boundaries, nxpe, nype, is_restart):
):
trimmed_ds = trimmed_ds.drop_vars(name)

to_drop = _BOUT_PER_PROC_VARIABLES
if ds["MYPE"] == 0:
# Keep per-process variables from the root process
to_drop = None
else:
to_drop = _BOUT_PER_PROC_VARIABLES

return trimmed_ds.drop_vars(to_drop, errors="ignore")

Expand Down
6 changes: 3 additions & 3 deletions xbout/plotting/plotfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,9 @@ def create_or_update_plot(plot_objects=None, tind=None, this_save_as=None):
X, Y, Z, scalars=data, vmin=vmin, vmax=vmax, **kwargs
)
else:
plot_objects[
region_name + str(i)
].mlab_source.scalars = data
plot_objects[region_name + str(i)].mlab_source.scalars = (
data
)

if mayavi_view is not None:
mlab.view(*mayavi_view)
Expand Down
3 changes: 1 addition & 2 deletions xbout/tests/test_against_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,4 @@ def test_new_collect_indexing_slice(self, tmp_path_factory):


@pytest.mark.skip
class test_speed_against_old_collect:
...
class test_speed_against_old_collect: ...
6 changes: 2 additions & 4 deletions xbout/tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ def test_combine_along_y(self, tmp_path_factory, bout_xyt_example_files):
xrt.assert_identical(actual, fake)

@pytest.mark.skip
def test_combine_along_t(self):
...
def test_combine_along_t(self): ...

@pytest.mark.parametrize(
"bout_v5,metric_3D", [(False, False), (True, False), (True, True)]
Expand Down Expand Up @@ -623,8 +622,7 @@ def test_drop_vars(self, tmp_path_factory, bout_xyt_example_files):
assert "n" in ds.keys()

@pytest.mark.skip
def test_combine_along_tx(self):
...
def test_combine_along_tx(self): ...

def test_restarts(self):
datapath = Path(__file__).parent.joinpath(
Expand Down
16 changes: 10 additions & 6 deletions xbout/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,16 @@ def _1d_coord_from_spacing(spacing, dim, ds=None, *, origin_at=None):
)

point_to_use = {
spacing.metadata["bout_xdim"]: spacing.metadata.get("MXG", 0)
if spacing.metadata["keep_xboundaries"]
else 0,
spacing.metadata["bout_ydim"]: spacing.metadata.get("MYG", 0)
if spacing.metadata["keep_yboundaries"]
else 0,
spacing.metadata["bout_xdim"]: (
spacing.metadata.get("MXG", 0)
if spacing.metadata["keep_xboundaries"]
else 0
),
spacing.metadata["bout_ydim"]: (
spacing.metadata.get("MYG", 0)
if spacing.metadata["keep_yboundaries"]
else 0
),
spacing.metadata["bout_zdim"]: spacing.metadata.get("MZG", 0),
}

Expand Down