xarray-contrib/cf-xarray

`.cf` accessor must be used first in chained calls

Closed this issue · 2 comments

Hi, thanks for this excellent package.

I'm not sure if this is working as designed or not, but this does not work:

[1] masked.weighted(weights).cf.sum(dim=['X', 'Y'])
AttributeError: 'DataArrayWeighted' object has no attribute 'cf'

where masked and weights are DataArrays.

However, putting the .cf accessor first works:

[1] masked.cf.weighted(weights).sum(dim=['X', 'Y'])

Yes that is how it is implemented. It's not possible to make your first call work, I don't think.

OK, thanks for the quick answer!