-
Notifications
You must be signed in to change notification settings - Fork 9
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
⭐ (feature) ragged operation on ragged xarray *datasets* #527
Comments
Hi @selipot , I see what you want to accomplish, but I'm not sure how this could be automated, especially when dealing with For example, when you do:
how the function is setup right now, is not simple to link this new dimension of Plus, when you get to the last step, For this to work, we would need to recreate a new dataset at each step to adjust the dimensions of As a workaround, you can always create datasets with your new variables and then use For example:
|
Thanks @philippemiron. Yes, for sure, your proposed solution is what I ended up doing. But of course we lose the information from the variables with dimension |
But even if the segments were in the same dataset, there is no link between the |
I am wondering if it would not be worth to extend some of the functionalities of the
ragged
module to operate not only on ragged arrays, such as xarray DataArrays, but also on xarray Datasets.As an example, imagine we want to use the
segment
function to "split" the trajectories of a ragged xarray datasetds
with dimensionstraj
andobs
and a row size variablerowsize
of dimensiontraj
. Thesegment
function might be applied on a ragged array variable ofds
of dimensionobs
, such asds["time"]
, and returns an array which is a new rowsize variable callednew_rowsize
that segments/divides the input array into new rows (more rows than previously). Then, what if we want to substitute thatnew_rowsize
in the original xarray datasetds
and work from there? In other words we would need to transform the entire xarray dataset to change the dimensiontraj
to matchlen(new_rowsize)
. This would include splitting also accordingly all the variables of dimensiontraj
to map them on the new dimensionlen(new_rowsize)
.Or maybe this type of functionality should be folded in
subset
? @philippemiron I would love to hear what you think.Here is what I tried which in the end does not work:
The text was updated successfully, but these errors were encountered: