Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Jun 6, 2023

Attempt at supporting request in holoviz/hvplot#1080.

This is very much still work-in-progress.

@hoxbro hoxbro changed the title Work with not gridded data for xarray. Work with non-gridded xarray dataset Jun 6, 2023
@hoxbro hoxbro marked this pull request as draft June 6, 2023 18:28
@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2023

Codecov Report

Merging #5744 (925a7db) into main (14d7d9d) will increase coverage by 0.00%.
The diff coverage is 96.42%.

@@           Coverage Diff           @@
##             main    #5744   +/-   ##
=======================================
  Coverage   88.18%   88.18%           
=======================================
  Files         306      306           
  Lines       62739    62762   +23     
=======================================
+ Hits        55326    55348   +22     
- Misses       7413     7414    +1     
Impacted Files Coverage Δ
holoviews/core/data/xarray.py 88.96% <96.42%> (+0.09%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hoxbro
Copy link
Member Author

hoxbro commented Jun 15, 2023

My basic thought process is to treat data with empty vdims as tabular data, which makes it possible to do the following:

import holoviews as hv
import numpy as np
import xarray as xr

hv.extension("bokeh")

ds = xr.Dataset(
    data_vars={
        "lat": ("trajectory", np.linspace(30, 35, 15)),
        "lon": ("trajectory", np.linspace(16, 20, 15)),
        "example": ("trajectory", np.linspace(16, 20, 15)),
    },
    coords={"trajectory": np.arange(15)},
)

hv.Dataset(ds, kdims=["lat", "lon"], vdims=[]).to(hv.Points)  

image

And when not setting vdims to an empty list we get this (hv.Dataset(ds, kdims=["lat", "lon"]).to(hv.Points)):
image

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