-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Interactive downsampling large vector fields (example gallery) #1372
Conversation
Hi @iuryt, it looks like pre-commit has caught that the notebook hasn't been cleaned up before being pushed to Github. You need to install pre-commit as described in the developer guide (and run it manually with |
Sorry. Gonna fix that. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1372 +/- ##
==========================================
+ Coverage 87.39% 88.80% +1.40%
==========================================
Files 50 51 +1
Lines 7490 7510 +20
==========================================
+ Hits 6546 6669 +123
+ Misses 944 841 -103 ☔ View full report in Codecov by Sentry. |
@maximlt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few suggestions, very nice addition!
"\n", | ||
"# Create interactive plot components\n", | ||
"range_xy = hv.streams.RangeXY() # Stream to capture range changes\n", | ||
"filtered = hv.DynamicMap(create_quiver, streams=[range_xy]) # Dynamic plot\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name it perhaps downsampled_quiver
?
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"If we just try to call `ds.hvplot.vectorfield` this is probably returning `MemoryError`. The alternative is to dynamically downsample the data based on the visible range. This helps manage memory consumption when dealing with large datasets, especially when plotting vector fields." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be nice to link to a HoloViews user guide and explain that we're going to use some HoloViews concepts to work around the memory error, while stile using hvPlot to create the quiver.
Co-authored-by: Maxime Liquet <35924738+maximlt@users.noreply.github.com>
Merge from main
Thanks @maximlt ! |
I made a promise almost a year ago to create this example and here I am.
The idea came from those discussions from discourse.
https://discourse.holoviz.org/t/highres-quiver-plot-returning-memory-error/6261/26
https://discourse.holoviz.org/t/dealing-high-resolution-vector-plots-xarray-holoviz/6310
Direct plotting large vector fields can quickly consume excessive memory, leading to
MemoryError
. To address this issue, we introduce a dynamic downsampling technique that enables interactive exploration of vector fields without sacrificing performance.