We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
cf.weighted
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Looks like .cf.weighted breaks with DataArrays.
.cf.weighted
from cf_xarray.datasets import airds weights = xr.ones_like(airds["air"]) weights.attrs = {} airds.cf.weighted(weights)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Note that I can't do this, because only Datasets and DataArrays have the .cf accessor:
Datasets
DataArrays
.cf
airds.weighted(weights).cf.mean("T")
AttributeError: 'DatasetWeighted' object has no attribute 'cf'
One possible workaround is:
airds.weighted(weights).mean(airds.cf.axes["T"])
or
airds = airds.assign_coords(weights=weights) airds["air"].attrs["cell_measures"] += " weights: weights" airds.cf.weighted("weights").mean("T")
but I don't think that's what we want.
The text was updated successfully, but these errors were encountered:
airds.cf.weighted(weights)
I think we could fix this in the mapper. Pretty sure we only test airds.cf.weighted('area')
airds.cf.weighted('area')
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Looks like
.cf.weighted
breaks with DataArrays.Note that I can't do this, because only
Datasets
andDataArrays
have the.cf
accessor:One possible workaround is:
or
but I don't think that's what we want.
The text was updated successfully, but these errors were encountered: