def get_xarray_subset( dataset, variable_name, time_step_indices, xy_slice_indices ):
    """
    Returns a subset of the provided dataset.  The source dataset is restricted to the
    variable and indices supplied.  When contiguous time step and XY slice indices are
    supplied, the resulting DataArray is a view of the original.

    Takes 4 arguments:

      dataset           - xarray.Dataset or xarray.DataArray object to return a view
                          from.
      variable_name     - Variable to restrict the view to.
      time_step_indices - Time step values to restrict the view to.
      xy_slice_indices  - XY slice indices to restrict the view to.

    Returns 1 value:

      data_array - xarray.DataArray object representing a subset of dataset.

    """

    # create a new DataArray from the indices provided.
    #
    # NOTE: we select time steps by value and XY slices by array index.  XY
    #       slices are generated contiguously, so array index maps to the slice
    #       index for the vast majority (all?) of use cases.  netCDF4 datasets
    #       may be constructed from multiple files selected via file name
    #       globbing, meaning time steps may not increase monotonically, meaning
    #       we should select time steps by value.
    #
    data_array = (dataset[variable_name]
                  .sel( Cycle=time_step_indices )
                  .isel( z=xy_slice_indices ))

    return data_array