xarray geoviews vectorfield

31 views Asked by At

I'm having trouble implementing this for a vector field with a time dimension. My data is stored in an xarray dataset. Currently I am only implementing this for one time step of the data, whereas the colourmap shows a slider which will display all of the timesteps. Please see the current implemenetation below:

import hvplot.xarray
import holoviews as hv
import bokeh
import xarray as xr
from cartopy import crs
import geopandas as gpd
import pandas as pd
import geoviews as gv
import geoviews.feature as gf
gv.extension('bokeh', 'matplotlib')



test1 = xr.open_mfdataset("path_to_file")
dataset = gv.Dataset(test1)  #
ensemble = dataset.to(gv.Image, ['x', 'y'], 'WS')


x2d, y2d = np.meshgrid(test.x, test.y)

cm = ensemble.opts(cmap='viridis', colorbar=True, clim=(0,40), tools=['hover'])
vec = gv.VectorField((x2d, y2d, np.ones((len(test.y.values),len(test.x.values))), test.WD.values[0])) 
mask = gf.land() 

cm * vec * mask 
0

There are 0 answers