code: def range(cls, dataset, dimension):
      dimension = dataset.get_dimension(dimension, strict=True)
      dim = dimension.name
      edges = dataset._binned and dimension in dataset.kdims
      if edges:
          data = cls.coords(dataset, dim, edges=True)
      else:
          if cls.packed(dataset) and dim in dataset.vdims:
              data = dataset.data.values[..., dataset.vdims.index(dim)]
          else:
              data = dataset.data[dim]
          if dimension.nodata is not None:
              data = cls.replace_value(data, dimension.nodata)
  
      if not len(data):
          dmin, dmax = np.nan, np.nan
      elif data.dtype.kind == "M" or not edges:
          dmin, dmax = data.min(), data.max()
          if not edges:
              dmin, dmax = dmin.data, dmax.data
      else:
          dmin, dmax = np.nanmin(data), np.nanmax(data)
  
      da = dask_array_module()
      if da and isinstance(dmin, da.Array):
          dmin, dmax = da.compute(dmin, dmax)
      if isinstance(dmin, np.ndarray) and dmin.shape == ():
          dmin = dmin[()]
      if isinstance(dmax, np.ndarray) and dmax.shape == ():
          dmax = dmax[()]
      dmin = (
          dmin
          if np.isscalar(dmin) or isinstance(dmin, util.datetime_types)
          else dmin.item()
      )
      dmax = (
          dmax
          if np.isscalar(dmax) or isinstance(dmax, util.datetime_types)
          else dmax.item()
      )
      return finite_range(data, dmin, dmax)
  
imports: import sys
  import types
  import numpy
  import pandas
  from ..None import util
  from ..dimension import Dimension, asdim, dimension_name
  from ..element import Element
  from ..ndmapping import NdMapping, item_check, sorted_context
  from .grid import GridInterface
  from .interface import DataError, Interface
  from .util import dask_array_module, finite_range
label_desc: Use image node_id 11 for calling the XArrayInterface obj's underlying member method code with example usage: obj.range(cls, dataset, dimension) and returns: finite_range