In pandas I can do something like –
pd.read_csv(path).loc[lambda df: df.col > 10, cols]
And I’m wondering if there’s an equivalent in Xarray? I’ve tried –
xr.open_dataset(path)["var"].sel(
time=lambda da: ~((da.time.dt.month == 2) & (da.time.dt.day == 29))
)
and
xr.open_dataset(path)["var"].loc[
lambda da: ~((da.time.dt.month == 2) & (da.time.dt.day == 29))
]
Neither work. Obviously I can achieve this in two lines but it’s cleaner code to read when in one line given I have to open and process similarly multiple datasets.