[go: up one dir, main page]

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

Update norm function in transform.py #6366

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NolanBrb
Copy link

New feature / Bug Fix

Added default behaviour when values to normalize are all equal; previously holoviews would attempt division by zero and return a runtime warning.
Proposed change : if all values are equal to zero, set all values to 0; otherwise, set all values to 1.

added default behaviour when values to normalize are all equal; if they are all 0 then all values are set to 0, otherwise all values are set to 1
@hoxbro
Copy link
Member
hoxbro commented Aug 29, 2024

Can you explain why this is needed?

@NolanBrb
Copy link
Author
NolanBrb commented Aug 29, 2024

Sure !

I ran into this error because I'm working on xarray datasets with multiple variables and procedurally creating vectorfields for each variable. I'm controlling the scale of the vectors using .opts(magnitude=hv.dim("Magnitude").norm())
Some of the variables I use have fixed magnitude, and when displaying the plot the line above returned a warning because since min==max, norm() was attempting to divide by zero.

@hoxbro
Copy link
Member
hoxbro commented Sep 13, 2024

I'm not opposed to this PR, but currently, it breaks CI.

Did you try to pass in limits to hv.dim("Magnitude").norm(limits=(0, None))? Or would you like it to be dynamically updated?

Would you happen to have a small example I could play around with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants