Replies: 3 comments 1 reply
-
Can you make a minimal reproducible example please? https://matthewrocklin.com/minimal-bug-reports |
Beta Was this translation helpful? Give feedback.
-
Hello
If "M" has a single value, this works, for example: However, I have different values of "M" for each element of dimension b,
|
Beta Was this translation helpful? Give feedback.
-
i'm a xarray noob, but you could do this: done = []
for b_cord in M.b:
q_sub = Q.sel(b=b_cord)
m_sub = M.sel(b=b_cord)
ds_res = xr.apply_ufunc(routing, q_sub, int(m_sub))
done.append(ds_res)
Q_m = xr.concat(done, dim='b') at least this is how i would do it. maybe there is a more elegant solution... |
Beta Was this translation helpful? Give feedback.
-
Hi, I need help.
I'm not an expert in xarray, however everything was going fine until I came to the following problem.
I am trying to apply a function to a dataset. The function contains a loop, however, the number of cycles is different for each of the elements of a dimension (nodeID) en el dataset Qhbv. The value of maxbas is the number of cycles, plus there are three values of maxbas for each nodeID.
These are the datasets:
FUNCTION
I have tried several ways to solve this problem, including apply_ufunc, but I have not been successful.
Do you have any idea?
Beta Was this translation helpful? Give feedback.
All reactions