Skip to content

Conversation

@mikekryjak
Copy link
Collaborator

@mikekryjak mikekryjak commented Aug 7, 2025

This returns the final time slice of a Dataset or DataArray whether the data contains multiple time slices or not. This is helpful when working with multiple simulations, some of which may have only been run for one timestep for developer reasons.

Here is how this can be done with built-in Xarray functionality right now - let's say we are reading in a 1D model, want to get the final timeslice whether the dataset contains time or not, and then snip off guard cells:

ds = ds.isel(t=-1, missing_dims = "ignore")
ds = ds.isel(y = slice(2,-2))

With this PR we can now do:

ds = ds.bout.final_time().isel(y = slice(2,-2))

mikekryjak and others added 2 commits August 7, 2025 11:24
This returns the final time slice of a dataset or dataarray, whether the data contains multiple time slices or not. This is helpful when working with multiple simulations, some of which may have only been run for one timestep for developer reasons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant