Open munichpavel opened 4 years ago
or my new favorite
cpt_array = xr.DataArray(
np.array([
[
[0.3, 0.7],
[0.7, 0.3]
],
[
[0.1, 0.9],
[0.2, 0.8]
]
]),
dims=('U', 'X', 'Y'),
coords={'U': range(2), 'X': range(2), 'Y': range(2)}
)
cpt_array.sel(U=0, X=1).values
# array([0.7, 0.3])
The mental bookkeeping required to access (conditional) probability tables might be made easier by using xarray, e.g.