nodes: 0, module; 1, function_definition; 2, function_name:interp; 3, parameters; 4, block; 5, identifier:var; 6, identifier:indexes_coords; 7, identifier:method; 8, dictionary_splat_pattern; 9, expression_statement; 10, if_statement; 11, comment:# simple speed up for the local interpolation; 12, if_statement; 13, comment:# default behavior; 14, expression_statement; 15, comment:# target dimensions; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, comment:# transpose to make the interpolated axis to the last position; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, comment:# dimension of the output array; 26, expression_statement; 27, for_statement; 28, return_statement; 29, identifier:kwargs; 30, comment:""" Make an interpolation of Variable
  
      Parameters
      ----------
      var: Variable
      index_coords:
          Mapping from dimension name to a pair of original and new coordinates.
          Original coordinates should be sorted in strictly ascending order.
          Note that all the coordinates should be Variable objects.
      method: string
          One of {'linear', 'nearest', 'zero', 'slinear', 'quadratic',
          'cubic'}. For multidimensional interpolation, only
          {'linear', 'nearest'} can be used.
      **kwargs:
          keyword arguments to be passed to scipy.interpolate
  
      Returns
      -------
      Interpolated Variable
  
      See Also
      --------
      DataArray.interp
      Dataset.interp
      """; 31, not_operator; 32, block; 33, comparison_operator:method in ['linear', 'nearest']; 34, block; 35, assignment; 36, assignment; 37, assignment; 38, assignment; 39, assignment; 40, assignment; 41, assignment; 42, assignment; 43, assignment; 44, assignment; 45, identifier:d; 46, attribute; 47, block; 48, call; 49, identifier:indexes_coords; 50, return_statement; 51, identifier:method; 52, list; 53, expression_statement; 54, subscript; 55, call; 56, identifier:dims; 57, call; 58, pattern_list; 59, call; 60, identifier:destination; 61, call; 62, identifier:broadcast_dims; 63, list_comprehension; 64, identifier:original_dims; 65, binary_operator:broadcast_dims + dims; 66, identifier:new_dims; 67, binary_operator:broadcast_dims + list(destination[0].dims); 68, identifier:interped; 69, call; 70, identifier:result; 71, call; 72, identifier:out_dims; 73, call; 74, identifier:var; 75, identifier:dims; 76, if_statement; 77, attribute; 78, argument_list; 79, call; 80, string; 81, string; 82, assignment; 83, identifier:kwargs; 84, string; 85, attribute; 86, argument_list; 87, identifier:list; 88, argument_list; 89, identifier:x; 90, identifier:new_x; 91, identifier:zip; 92, argument_list; 93, identifier:broadcast_variables; 94, argument_list; 95, identifier:d; 96, for_in_clause; 97, if_clause; 98, identifier:broadcast_dims; 99, identifier:dims; 100, identifier:broadcast_dims; 101, call; 102, identifier:interp_func; 103, argument_list; 104, identifier:Variable; 105, argument_list; 106, identifier:OrderedSet; 107, argument_list; 108, comparison_operator:d in dims; 109, block; 110, else_clause; 111, identifier:result; 112, identifier:transpose; 113, list_splat; 114, attribute; 115, argument_list; 116, string_content:linear; 117, string_content:nearest; 118, pattern_list; 119, call; 120, string_content:bounds_error; 121, identifier:kwargs; 122, identifier:get; 123, string; 124, False; 125, identifier:indexes_coords; 126, list_splat; 127, list_splat; 128, identifier:d; 129, attribute; 130, comparison_operator:d not in dims; 131, identifier:list; 132, argument_list; 133, attribute; 134, identifier:x; 135, identifier:destination; 136, identifier:method; 137, identifier:kwargs; 138, identifier:new_dims; 139, identifier:interped; 140, keyword_argument; 141, identifier:d; 142, identifier:dims; 143, expression_statement; 144, block; 145, call; 146, identifier:var; 147, identifier:copy; 148, identifier:var; 149, identifier:indexes_coords; 150, identifier:_localize; 151, argument_list; 152, string_content:bounds_error; 153, list_comprehension; 154, identifier:new_x; 155, identifier:var; 156, identifier:dims; 157, identifier:d; 158, identifier:dims; 159, attribute; 160, call; 161, identifier:data; 162, identifier:attrs; 163, attribute; 164, call; 165, expression_statement; 166, identifier:tuple; 167, argument_list; 168, identifier:var; 169, identifier:indexes_coords; 170, subscript; 171, for_in_clause; 172, subscript; 173, identifier:dims; 174, attribute; 175, argument_list; 176, identifier:var; 177, identifier:attrs; 178, attribute; 179, argument_list; 180, call; 181, identifier:out_dims; 182, identifier:indexes_coords; 183, identifier:d; 184, identifier:d; 185, identifier:dims; 186, identifier:destination; 187, integer:0; 188, identifier:var; 189, identifier:transpose; 190, list_splat; 191, identifier:out_dims; 192, identifier:update; 193, attribute; 194, attribute; 195, argument_list; 196, identifier:original_dims; 197, subscript; 198, identifier:dims; 199, identifier:out_dims; 200, identifier:add; 201, identifier:d; 202, subscript; 203, integer:1; 204, identifier:indexes_coords; 205, identifier:d
code: def interp(var, indexes_coords, method, **kwargs):
      """ Make an interpolation of Variable
  
      Parameters
      ----------
      var: Variable
      index_coords:
          Mapping from dimension name to a pair of original and new coordinates.
          Original coordinates should be sorted in strictly ascending order.
          Note that all the coordinates should be Variable objects.
      method: string
          One of {'linear', 'nearest', 'zero', 'slinear', 'quadratic',
          'cubic'}. For multidimensional interpolation, only
          {'linear', 'nearest'} can be used.
      **kwargs:
          keyword arguments to be passed to scipy.interpolate
  
      Returns
      -------
      Interpolated Variable
  
      See Also
      --------
      DataArray.interp
      Dataset.interp
      """
      if not indexes_coords:
          return var.copy()
  
      # simple speed up for the local interpolation
      if method in ['linear', 'nearest']:
          var, indexes_coords = _localize(var, indexes_coords)
  
      # default behavior
      kwargs['bounds_error'] = kwargs.get('bounds_error', False)
  
      # target dimensions
      dims = list(indexes_coords)
      x, new_x = zip(*[indexes_coords[d] for d in dims])
      destination = broadcast_variables(*new_x)
  
      # transpose to make the interpolated axis to the last position
      broadcast_dims = [d for d in var.dims if d not in dims]
      original_dims = broadcast_dims + dims
      new_dims = broadcast_dims + list(destination[0].dims)
      interped = interp_func(var.transpose(*original_dims).data,
                             x, destination, method, kwargs)
  
      result = Variable(new_dims, interped, attrs=var.attrs)
  
      # dimension of the output array
      out_dims = OrderedSet()
      for d in var.dims:
          if d in dims:
              out_dims.update(indexes_coords[d][1].dims)
          else:
              out_dims.add(d)
      return result.transpose(*tuple(out_dims))