nodes: 0, module; 1, function_definition; 2, function_name:interp; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, import_from_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, function_definition; 17, function_definition; 18, expression_statement; 19, for_statement; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, comment:# attach indexer as coordinate; 24, expression_statement; 25, expression_statement; 26, comment:# Extract coordinates from indexers; 27, expression_statement; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, return_statement; 32, identifier:coords; 33, None; 34, identifier:method; 35, string; 36, identifier:assume_sorted; 37, False; 38, identifier:kwargs; 39, dictionary; 40, identifier:coords_kwargs; 41, comment:""" Multidimensional interpolation of Dataset.
  
          Parameters
          ----------
          coords : dict, optional
              Mapping from dimension names to the new coordinates.
              New coordinate can be a scalar, array-like or DataArray.
              If DataArrays are passed as new coordates, their dimensions are
              used for the broadcasting.
          method: string, optional.
              {'linear', 'nearest'} for multidimensional array,
              {'linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic'}
              for 1-dimensional array. 'linear' is used by default.
          assume_sorted: boolean, optional
              If False, values of coordinates that are interpolated over can be
              in any order and they are sorted first. If True, interpolated
              coordinates are assumed to be an array of monotonically increasing
              values.
          kwargs: dictionary, optional
              Additional keyword passed to scipy's interpolator.
          **coords_kwarg : {dim: coordinate, ...}, optional
              The keyword arguments form of ``coords``.
              One of coords or coords_kwargs must be provided.
  
          Returns
          -------
          interpolated: xr.Dataset
              New dataset on the new coordinates.
  
          Notes
          -----
          scipy is required.
  
          See Also
          --------
          scipy.interpolate.interp1d
          scipy.interpolate.interpn
          """; 42, relative_import; 43, dotted_name; 44, assignment; 45, assignment; 46, assignment; 47, function_name:maybe_variable; 48, parameters; 49, comment:# workaround to get variable for dimension without coordinate.; 50, block; 51, function_name:_validate_interp_indexer; 52, parameters; 53, comment:# In the case of datetimes, the restrictions placed on indexers; 54, comment:# used with interp are stronger than those which are placed on; 55, comment:# isel, so we need an additional check after _validate_indexers.; 56, block; 57, assignment; 58, pattern_list; 59, call; 60, block; 61, assignment; 62, assignment; 63, assignment; 64, call; 65, call; 66, assignment; 67, call; 68, call; 69, assignment; 70, call; 71, string_content:linear; 72, import_prefix; 73, identifier:missing; 74, identifier:coords; 75, call; 76, identifier:indexers; 77, call; 78, identifier:obj; 79, conditional_expression:self if assume_sorted else self.sortby([k for k in coords]); 80, identifier:obj; 81, identifier:k; 82, try_statement; 83, identifier:x; 84, identifier:new_x; 85, if_statement; 86, identifier:variables; 87, call; 88, identifier:name; 89, identifier:var; 90, attribute; 91, argument_list; 92, if_statement; 93, identifier:coord_names; 94, call; 95, identifier:indexes; 96, call; 97, identifier:selected; 98, call; 99, attribute; 100, argument_list; 101, attribute; 102, generator_expression; 103, pattern_list; 104, parenthesized_expression; 105, attribute; 106, argument_list; 107, attribute; 108, argument_list; 109, identifier:coord_names; 110, parenthesized_expression; 111, attribute; 112, argument_list; 113, identifier:either_dict_or_kwargs; 114, argument_list; 115, identifier:OrderedDict; 116, argument_list; 117, identifier:self; 118, identifier:assume_sorted; 119, call; 120, block; 121, except_clause; 122, parenthesized_expression; 123, block; 124, else_clause; 125, identifier:OrderedDict; 126, argument_list; 127, attribute; 128, identifier:items; 129, comparison_operator:name not in indexers; 130, block; 131, attribute; 132, argument_list; 133, identifier:OrderedDict; 134, generator_expression; 135, attribute; 136, argument_list; 137, identifier:variables; 138, identifier:update; 139, identifier:indexers; 140, identifier:indexes; 141, identifier:update; 142, tuple; 143, for_in_clause; 144, if_clause; 145, identifier:coord_vars; 146, identifier:new_indexes; 147, call; 148, identifier:variables; 149, identifier:update; 150, identifier:coord_vars; 151, identifier:indexes; 152, identifier:update; 153, identifier:new_indexes; 154, call; 155, identifier:self; 156, identifier:_replace_with_new_dims; 157, identifier:variables; 158, identifier:coord_names; 159, keyword_argument; 160, identifier:coords; 161, identifier:coords_kwargs; 162, string; 163, call; 164, attribute; 165, argument_list; 166, return_statement; 167, identifier:KeyError; 168, block; 169, boolean_operator; 170, raise_statement; 171, block; 172, identifier:obj; 173, identifier:_variables; 174, identifier:name; 175, identifier:indexers; 176, if_statement; 177, call; 178, identifier:intersection; 179, attribute; 180, tuple; 181, for_in_clause; 182, if_clause; 183, identifier:self; 184, identifier:_replace_with_new_dims; 185, call; 186, identifier:coord_names; 187, keyword_argument; 188, identifier:k; 189, call; 190, pattern_list; 191, call; 192, comparison_operator:v.dims == (k,); 193, attribute; 194, argument_list; 195, attribute; 196, argument_list; 197, identifier:indexes; 198, identifier:indexes; 199, string_content:interp; 200, attribute; 201, argument_list; 202, identifier:self; 203, identifier:sortby; 204, list_comprehension; 205, subscript; 206, return_statement; 207, call; 208, not_operator; 209, call; 210, return_statement; 211, comparison_operator:var.dtype.kind in 'uifc'; 212, block; 213, elif_clause; 214, identifier:set; 215, argument_list; 216, identifier:obj; 217, identifier:_coord_names; 218, identifier:k; 219, identifier:v; 220, pattern_list; 221, call; 222, comparison_operator:k not in indexers; 223, attribute; 224, argument_list; 225, identifier:indexes; 226, identifier:indexes; 227, attribute; 228, argument_list; 229, identifier:k; 230, identifier:v; 231, attribute; 232, argument_list; 233, attribute; 234, tuple; 235, identifier:selected; 236, identifier:_get_indexers_coords_and_indexes; 237, identifier:coords; 238, call; 239, identifier:union; 240, identifier:coord_vars; 241, identifier:self; 242, identifier:_validate_indexers; 243, identifier:coords; 244, identifier:k; 245, for_in_clause; 246, attribute; 247, identifier:k; 248, call; 249, identifier:_contains_datetime_like_objects; 250, argument_list; 251, call; 252, identifier:TypeError; 253, argument_list; 254, tuple; 255, attribute; 256, string; 257, expression_statement; 258, expression_statement; 259, call; 260, comment:# keep unrelated object array; 261, block; 262, identifier:variables; 263, identifier:k; 264, identifier:v; 265, attribute; 266, argument_list; 267, identifier:k; 268, identifier:indexers; 269, identifier:variables; 270, identifier:copy; 271, identifier:v; 272, identifier:to_index; 273, identifier:indexers; 274, identifier:items; 275, identifier:v; 276, identifier:dims; 277, identifier:k; 278, attribute; 279, argument_list; 280, identifier:k; 281, identifier:coords; 282, identifier:obj; 283, identifier:_variables; 284, identifier:as_variable; 285, argument_list; 286, identifier:x; 287, identifier:_contains_datetime_like_objects; 288, argument_list; 289, call; 290, identifier:x; 291, identifier:new_x; 292, attribute; 293, identifier:kind; 294, string_content:uifc; 295, assignment; 296, assignment; 297, identifier:all; 298, generator_expression; 299, expression_statement; 300, attribute; 301, identifier:items; 302, call; 303, identifier:intersection; 304, attribute; 305, tuple; 306, identifier:new_x; 307, attribute; 308, argument_list; 309, identifier:var; 310, identifier:dtype; 311, identifier:var_indexers; 312, dictionary_comprehension; 313, subscript; 314, call; 315, comparison_operator:d not in indexers; 316, for_in_clause; 317, assignment; 318, identifier:obj; 319, identifier:indexes; 320, identifier:set; 321, argument_list; 322, identifier:obj; 323, identifier:_coord_names; 324, identifier:k; 325, call; 326, concatenated_string; 327, identifier:format; 328, identifier:new_x; 329, pair; 330, for_in_clause; 331, if_clause; 332, identifier:variables; 333, identifier:name; 334, attribute; 335, argument_list; 336, identifier:d; 337, identifier:indexers; 338, identifier:d; 339, attribute; 340, subscript; 341, identifier:var; 342, identifier:variables; 343, identifier:range; 344, argument_list; 345, string; 346, string; 347, string; 348, string; 349, string; 350, identifier:k; 351, call; 352, pattern_list; 353, call; 354, comparison_operator:k in var.dims; 355, identifier:missing; 356, identifier:interp; 357, identifier:var; 358, identifier:var_indexers; 359, identifier:method; 360, dictionary_splat; 361, identifier:var; 362, identifier:dims; 363, identifier:variables; 364, identifier:name; 365, subscript; 366, string_content:When interpolating over a datetime-like; 367, string_content:coordinate, the coordinates to; 368, string_content:interpolate to must be either datetime; 369, string_content:strings or datetimes.; 370, string_content; 371, identifier:_validate_interp_indexer; 372, argument_list; 373, identifier:k; 374, identifier:v; 375, attribute; 376, argument_list; 377, identifier:k; 378, attribute; 379, identifier:kwargs; 380, attribute; 381, identifier:k; 382, escape_sequence:\n; 383, call; 384, identifier:v; 385, identifier:indexers; 386, identifier:items; 387, identifier:var; 388, identifier:dims; 389, identifier:obj; 390, identifier:dims; 391, identifier:maybe_variable; 392, argument_list; 393, identifier:obj; 394, identifier:k
code: def interp(self, coords=None, method='linear', assume_sorted=False,
                 kwargs={}, **coords_kwargs):
          """ Multidimensional interpolation of Dataset.
  
          Parameters
          ----------
          coords : dict, optional
              Mapping from dimension names to the new coordinates.
              New coordinate can be a scalar, array-like or DataArray.
              If DataArrays are passed as new coordates, their dimensions are
              used for the broadcasting.
          method: string, optional.
              {'linear', 'nearest'} for multidimensional array,
              {'linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic'}
              for 1-dimensional array. 'linear' is used by default.
          assume_sorted: boolean, optional
              If False, values of coordinates that are interpolated over can be
              in any order and they are sorted first. If True, interpolated
              coordinates are assumed to be an array of monotonically increasing
              values.
          kwargs: dictionary, optional
              Additional keyword passed to scipy's interpolator.
          **coords_kwarg : {dim: coordinate, ...}, optional
              The keyword arguments form of ``coords``.
              One of coords or coords_kwargs must be provided.
  
          Returns
          -------
          interpolated: xr.Dataset
              New dataset on the new coordinates.
  
          Notes
          -----
          scipy is required.
  
          See Also
          --------
          scipy.interpolate.interp1d
          scipy.interpolate.interpn
          """
          from . import missing
  
          coords = either_dict_or_kwargs(coords, coords_kwargs, 'interp')
          indexers = OrderedDict(self._validate_indexers(coords))
  
          obj = self if assume_sorted else self.sortby([k for k in coords])
  
          def maybe_variable(obj, k):
              # workaround to get variable for dimension without coordinate.
              try:
                  return obj._variables[k]
              except KeyError:
                  return as_variable((k, range(obj.dims[k])))
  
          def _validate_interp_indexer(x, new_x):
              # In the case of datetimes, the restrictions placed on indexers
              # used with interp are stronger than those which are placed on
              # isel, so we need an additional check after _validate_indexers.
              if (_contains_datetime_like_objects(x) and
                      not _contains_datetime_like_objects(new_x)):
                  raise TypeError('When interpolating over a datetime-like '
                                  'coordinate, the coordinates to '
                                  'interpolate to must be either datetime '
                                  'strings or datetimes. '
                                  'Instead got\n{}'.format(new_x))
              else:
                  return (x, new_x)
  
          variables = OrderedDict()
          for name, var in obj._variables.items():
              if name not in indexers:
                  if var.dtype.kind in 'uifc':
                      var_indexers = {
                          k: _validate_interp_indexer(maybe_variable(obj, k), v)
                          for k, v in indexers.items()
                          if k in var.dims
                      }
                      variables[name] = missing.interp(
                          var, var_indexers, method, **kwargs)
                  elif all(d not in indexers for d in var.dims):
                      # keep unrelated object array
                      variables[name] = var
  
          coord_names = set(variables).intersection(obj._coord_names)
          indexes = OrderedDict(
              (k, v) for k, v in obj.indexes.items() if k not in indexers)
          selected = self._replace_with_new_dims(
              variables.copy(), coord_names, indexes=indexes)
  
          # attach indexer as coordinate
          variables.update(indexers)
          indexes.update(
              (k, v.to_index()) for k, v in indexers.items() if v.dims == (k,)
          )
  
          # Extract coordinates from indexers
          coord_vars, new_indexes = (
              selected._get_indexers_coords_and_indexes(coords))
          variables.update(coord_vars)
          indexes.update(new_indexes)
  
          coord_names = (set(variables)
                         .intersection(obj._coord_names)
                         .union(coord_vars))
          return self._replace_with_new_dims(
              variables, coord_names, indexes=indexes)