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

Request to add transform_first keyword to barbs #2395

Open
greglucas opened this issue May 31, 2024 · 3 comments
Open

Request to add transform_first keyword to barbs #2395

greglucas opened this issue May 31, 2024 · 3 comments

Comments

@greglucas
Copy link
Contributor

Would it be possible to implement something similar to #1291 with barbs? I am experiencing significant slowdowns with the barb transformation with high-resolution data. Appears I'm not the only one: https://stackoverflow.com/questions/71578820/use-transform-first-keyword-in-barbs

Originally posted by @karlwx in #1291 (comment)

@greglucas
Copy link
Contributor Author

greglucas commented May 31, 2024

@karlwx I think it would be a little trickier because you need to transform vectors instead of just scalars, but it should in principle be doable. We do have a decorator that you could try playing around with to see whether it would work for your use-case and/or modifying it for the vector transform paths.

def _add_transform_first(func):

used in Contour here:
@_add_transform
@_add_transform_first
def contour(self, *args, **kwargs):

@karlwx
Copy link

karlwx commented Jun 2, 2024

Thanks @greglucas. Maybe an easier solution would be to add a keyword argument that would automatically thin the arrays of x, y, and data based on the number of data points within the map extent and the value of regrid_shape before transforming?

@greglucas
Copy link
Contributor Author

Possibly, I'm not sure what that would look like though... Would you be able to do that yourself beforehand something like barbs(x[::3, ::3], y[::3, ::3], ...)?

The regridding is located here if you want to dig in and try things out:

def _interpolate_to_grid(nx, ny, x, y, *scalars, **kwargs):

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

No branches or pull requests

2 participants