Skip to content
Open
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
10 changes: 10 additions & 0 deletions xbout/boutdataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,3 +1169,13 @@ def as_cherab_emitter(
cylinder_rmax=cyliner_rmax,
step=step,
)

def final_time(self):
"""
Returns the final time in the Dataset whether
it contains a time dimension or not.
"""
if "t" in self.data.sizes:
return self.data.isel(t=-1)
else:
return self.data
10 changes: 10 additions & 0 deletions xbout/boutdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,16 @@ def with_cherab_grid(self):

return grid.ds_with_cherab_grid(self.data)

def final_time(self):
"""
Returns the final time in the Dataset whether
it contains a time dimension or not.
"""
if "t" in self.data.sizes:
return self.data.isel(t=-1)
else:
return self.data


def _find_major_vars(data):
"""
Expand Down
4 changes: 2 additions & 2 deletions xbout/xarraybackend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""License:
Distributed under the OSI-approved Apache License, Version 2.0. See
accompanying file Copyright.txt for details.
Distributed under the OSI-approved Apache License, Version 2.0. See
accompanying file Copyright.txt for details.
"""

from __future__ import annotations
Expand Down