class_docstr: A VectorField represents a set of vectors in 2D space with an
  associated angle, as well as an optional magnitude and any number
  of other value dimensions. The angles are assumed to be defined in
  radians and by default the magnitude is assumed to be normalized
  to be between 0 and 1.
class_docstr_tok: ["A","VectorField","represents","a","set","of","vectors","in","2D","space","with","an","associated","angle",",","as","well","as","an","optional","magnitude","and","any","number","of","other","value","dimensions",".","The","angles","are","assumed","to","be","defined","in","radians","and","by","default","the","magnitude","is","assumed","to","be","normalized","to","be","between","0","and","1","."]
code: def from_uv(cls, data, kdims=None, vdims=None, **params):
      if kdims is None:
          kdims = ["x", "y"]
      if vdims is None:
          vdims = ["u", "v"]
      dataset = Dataset(data, kdims=kdims, vdims=vdims, **params)
      us, vs = (dataset.dimension_values(i) for i in range(2, 4))
  
      uv_magnitudes = np.hypot(us, vs)  # unscaled
      # this follows mathematical conventions,
      # unlike WindBarbs which follows meteorological conventions
      radians = np.arctan2(vs, us)
  
      # calculations on this data could mutate the original data
      # here we do not do any calculations; we only store the data
      repackaged_dataset = {}
      for kdim in kdims:
          repackaged_dataset[kdim] = dataset[kdim]
      repackaged_dataset["Angle"] = radians
      repackaged_dataset["Magnitude"] = uv_magnitudes
      for vdim in vdims[2:]:
          repackaged_dataset[vdim] = dataset[vdim]
      vdims = [
          Dimension("Angle", cyclic=True, range=(0, 2 * np.pi)),
          Dimension("Magnitude"),
      ] + vdims[2:]
      return cls(repackaged_dataset, kdims=kdims, vdims=vdims, **params)
  
file_path: holoviews/holoviews/element/geom.py
imports: import numpy
  import param
  from ..core import Dataset, Dimension, Element2D
  from .selection import Selection2DExpr, SelectionGeomExpr
label_desc: Use image node_id 1 for calling the VectorField obj's underlying member method code with example usage: obj.from_uv(cls, data, kdims, vdims) and returns: cls