Is there a way to keep the coordinates when using xarray.quantile?
I am taking a (90th percentile) quantile of a dataset with coordinates lat, lon, and time. I want to have the time when the data values are in this quantile.
I run the command Data.quantile([.90],dim='time') which removes the 'time' coordinate and replaces it with 'quantile' Is there a way to retain the coordinate information AND perform the quantile operation?
There's the argument "keep_attrs" but I have yet to find anything on retaining coordinates. I want something like xarray.DataArray.argmax
You can use
.where()to filter according to.quantile():Given an xarray DataArray
da: