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

Ensure pixel_ratio is applied when computing resampling coordinates #6373

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Sep 16, 2024

Closes #6372

Before:

Screen.Recording.2024-09-16.at.3.13.05.PM.mov

After:

Screen.Recording.2024-09-16.at.3.13.53.PM.mov
import pandas as pd
import holoviews as hv
from holoviews.operation import apply_when
from holoviews.operation.datashader import rasterize
from functools import partial
import panel as pn

hv.extension("bokeh")

df = pd.DataFrame(
    {
        "lon": [45.5531, 46.4731, 47.4731, 48.41234],
        "lat": [34.5531, 35.4731, 36.4731, 37.41234],
    }
)

def _resample_obj(operation, obj, opts):
    def exceeds_resample_when(plot):
        return len(plot) > 1000

    processed = apply_when(
        obj, operation=partial(operation, **opts), predicate=exceeds_resample_when
    )
    return processed


points = hv.Points(df, ["lon", "lat"])
resampled_points = _resample_obj(rasterize, points, {})
pn.serve(resampled_points)

@ahuang11 ahuang11 added the type: bug Something isn't correct or isn't working label Sep 16, 2024
@ahuang11 ahuang11 changed the title do not apply pixel ratio for re-creating dataarray Do not apply pixel ratio for re-creating DataArray Sep 16, 2024
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.50%. Comparing base (c233dd1) to head (bf7c777).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6373   +/-   ##
=======================================
  Coverage   88.49%   88.50%           
=======================================
  Files         323      323           
  Lines       68180    68194   +14     
=======================================
+ Hits        60338    60355   +17     
+ Misses       7842     7839    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@philippjfr philippjfr changed the title Do not apply pixel ratio for re-creating DataArray Ensure pixel_ratio is applied when computing resampling coordinates Sep 17, 2024
@philippjfr philippjfr merged commit 099d3de into main Sep 17, 2024
13 checks passed
@philippjfr philippjfr deleted the fix_pixel_ratio branch September 17, 2024 13:08
hoxbro pushed a commit that referenced this pull request Sep 23, 2024
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resampling_when breaks when zooming in
2 participants