How to ask for/query data in dataset with arrays as parameters. #5683
-
Hi a have the following xarray dataset with the antenna-baseline relationships. Basically two different antenna IDs make a baseline. As you see: 0 & 1 = Baseline 0, 0&2 = Baseline 1... etc....
And I have the following xarray DataArrays with antennas which IDs are in the dataset, but they might not have all the IDs in the dataset.
What I would like is to query the dataset with the values of my arrays to get the baseline ID (rowid in the dataset) and get something like this as result:
So first columns are basically the latter two arrays, and the last column is the ROWID got from the query on the dataset. I have tried to do this using
How can I do this using xarray? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Could you post the text |
Beta Was this translation helpful? Give feedback.
-
I have solve this myself. I will attach the piece of code just in case anyone need it:
|
Beta Was this translation helpful? Give feedback.
I have solve this myself. I will attach the piece of code just in case anyone need it:
baseline_id = da.argmax((baseline_obj.dataset.ANTENNA1.data[None, :] == antenna1_ids[:, None]) & (baseline_obj.dataset.ANTENNA2.data[None, :] == antenna2_ids[:, None]), axis=1).astype(np.int32)