Skip to content
New issue

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

.where() returning Xarray objects #985

Open
philipc2 opened this issue Oct 1, 2024 · 0 comments
Open

.where() returning Xarray objects #985

philipc2 opened this issue Oct 1, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@philipc2
Copy link
Member

philipc2 commented Oct 1, 2024

Hi @philipc2, I have another small question about something that doesn't seem to be working. I would like to use the .where() functionality with a uxds array, something like

variable = variable.where(variable<0,0)

and this doesn't give any complaints by itself, but when I try to plot the result of something like this, it gives a weird complaint about not recognizing the "title" I've put into the .plot() command. Here is the code I'm trying to use:

upwp_ug = uxds['UPWP_UG_CLUBB']
upwp_ug = upwp_ug.where(upwp_ug<0,0)
#upwp_ug = abs(upwp_ug)
upwp_ug_sum=upwp_ug.sum(dim='ilev')
print(upwp_ug_sum.shape)
upwp_ug_sum.mean(dim='time').plot(title="3a1 minus dflt, sum(abs(UPWP_UG_CLUBB)) (m2/s2)", projection=ccrs.PlateCarree()) * gf.coastline(projection=projection)

If I comment out the line with .where() and uncomment the abs() value line, it plots fine. But as is, it complains about the title:

AttributeError: Line2D.set() got an unexpected keyword argument 'title'

Any ideas? Does .where() not work yet with UXARRAY? Thanks!

Originally posted by @bstephens82 in #861 (comment)

@philipc2 philipc2 self-assigned this Oct 9, 2024
@philipc2 philipc2 added the bug Something isn't working label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📝 To-Do
Development

No branches or pull requests

1 participant