nodes: 0, module; 1, function_definition; 2, function_name:setup_coords; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, try_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, expression_statement; 15, if_statement; 16, for_statement; 17, return_statement; 18, identifier:arr_names; 19, None; 20, identifier:sort; 21, list; 22, identifier:dims; 23, dictionary; 24, identifier:kwargs; 25, comment:"""
      Sets up the arr_names dictionary for the plot
  
      Parameters
      ----------
      arr_names: string, list of strings or dictionary
          Set the unique array names of the resulting arrays and (optionally)
          dimensions.
  
          - if string: same as list of strings (see below). Strings may
            include {0} which will be replaced by a counter.
          - list of strings: those will be used for the array names. The final
            number of dictionaries in the return depend in this case on the
            `dims` and ``**furtherdims``
          - dictionary:
            Then nothing happens and an :class:`OrderedDict` version of
            `arr_names` is returned.
      sort: list of strings
          This parameter defines how the dictionaries are ordered. It has no
          effect if `arr_names` is a dictionary (use a
          :class:`~collections.OrderedDict` for that). It can be a list of
          dimension strings matching to the dimensions in `dims` for the
          variable.
      dims: dict
          Keys must be variable names of dimensions (e.g. time, level, lat or
          lon) or 'name' for the variable name you want to choose.
          Values must be values of that dimension or iterables of the values
          (e.g. lists). Note that strings will be put into a list.
          For example dims = {'name': 't2m', 'time': 0} will result in one plot
          for the first time step, whereas dims = {'name': 't2m', 'time': [0, 1]}
          will result in two plots, one for the first (time == 0) and one for the
          second (time == 1) time step.
      ``**kwargs``
          The same as `dims` (those will update what is specified in `dims`)
  
      Returns
      -------
      ~collections.OrderedDict
          A mapping from the keys in `arr_names` and to dictionaries. Each
          dictionary corresponds defines the coordinates of one data array to
          load"""; 26, block; 27, except_clause; 28, comparison_operator:arr_names is None; 29, block; 30, elif_clause; 31, assignment; 32, pattern_list; 33, call; 34, block; 35, assignment; 36, identifier:sort; 37, block; 38, else_clause; 39, pattern_list; 40, call; 41, block; 42, call; 43, return_statement; 44, tuple; 45, comment:# ValueError for cyordereddict, TypeError for collections.OrderedDict; 46, block; 47, identifier:arr_names; 48, None; 49, expression_statement; 50, call; 51, block; 52, identifier:dims; 53, call; 54, identifier:key; 55, identifier:val; 56, attribute; 57, argument_list; 58, expression_statement; 59, identifier:sorted_dims; 60, call; 61, for_statement; 62, for_statement; 63, comment:# make sure, it is first sorted for the variable names; 64, block; 65, identifier:key; 66, identifier:val; 67, attribute; 68, argument_list; 69, expression_statement; 70, identifier:OrderedDict; 71, argument_list; 72, call; 73, identifier:ValueError; 74, identifier:TypeError; 75, pass_statement; 76, assignment; 77, identifier:isstring; 78, argument_list; 79, expression_statement; 80, identifier:OrderedDict; 81, argument_list; 82, identifier:six; 83, identifier:iteritems; 84, identifier:kwargs; 85, call; 86, identifier:OrderedDict; 87, argument_list; 88, identifier:key; 89, identifier:sort; 90, block; 91, pattern_list; 92, call; 93, block; 94, if_statement; 95, for_statement; 96, for_statement; 97, identifier:six; 98, identifier:iteritems; 99, identifier:sorted_dims; 100, assignment; 101, list_comprehension; 102, identifier:OrderedDict; 103, argument_list; 104, identifier:arr_names; 105, call; 106, identifier:arr_names; 107, assignment; 108, identifier:dims; 109, attribute; 110, argument_list; 111, expression_statement; 112, identifier:key; 113, identifier:val; 114, attribute; 115, argument_list; 116, expression_statement; 117, comparison_operator:'name' in dims; 118, block; 119, pattern_list; 120, call; 121, block; 122, pattern_list; 123, call; 124, block; 125, subscript; 126, call; 127, tuple; 128, for_in_clause; 129, identifier:arr_names; 130, identifier:repeat; 131, argument_list; 132, identifier:arr_names; 133, call; 134, identifier:dims; 135, identifier:setdefault; 136, identifier:key; 137, identifier:val; 138, assignment; 139, identifier:six; 140, identifier:iteritems; 141, identifier:dims; 142, assignment; 143, string; 144, identifier:dims; 145, expression_statement; 146, identifier:key; 147, identifier:val; 148, identifier:sorted; 149, argument_list; 150, expression_statement; 151, identifier:key; 152, identifier:val; 153, attribute; 154, argument_list; 155, expression_statement; 156, identifier:sorted_dims; 157, identifier:key; 158, identifier:iter; 159, argument_list; 160, call; 161, call; 162, pattern_list; 163, call; 164, string; 165, identifier:repeat; 166, argument_list; 167, subscript; 168, call; 169, subscript; 170, identifier:val; 171, string_content:name; 172, assignment; 173, call; 174, assignment; 175, identifier:six; 176, identifier:iteritems; 177, identifier:kwargs; 178, call; 179, call; 180, attribute; 181, argument_list; 182, identifier:dict; 183, argument_list; 184, identifier:i; 185, tuple_pattern; 186, identifier:enumerate; 187, argument_list; 188, string_content:arr{0}; 189, identifier:arr_names; 190, identifier:sorted_dims; 191, identifier:key; 192, attribute; 193, argument_list; 194, identifier:sorted_dims; 195, identifier:key; 196, subscript; 197, None; 198, attribute; 199, argument_list; 200, subscript; 201, identifier:val; 202, attribute; 203, argument_list; 204, identifier:safe_list; 205, argument_list; 206, identifier:arr_name; 207, identifier:format; 208, identifier:i; 209, call; 210, identifier:arr_name; 211, identifier:dim_tuple; 212, call; 213, identifier:dims; 214, identifier:pop; 215, identifier:key; 216, identifier:sorted_dims; 217, string; 218, identifier:dims; 219, identifier:items; 220, identifier:sorted_dims; 221, identifier:key; 222, identifier:sorted_dims; 223, identifier:setdefault; 224, identifier:key; 225, identifier:val; 226, identifier:val; 227, identifier:zip; 228, argument_list; 229, identifier:zip; 230, argument_list; 231, string_content:name; 232, call; 233, identifier:dim_tuple; 234, identifier:arr_names; 235, call; 236, attribute; 237, argument_list; 238, identifier:product; 239, argument_list; 240, identifier:sorted_dims; 241, identifier:keys; 242, list_splat; 243, call; 244, identifier:map; 245, argument_list; 246, identifier:list; 247, call; 248, attribute; 249, argument_list; 250, identifier:sorted_dims; 251, identifier:values
code: def setup_coords(arr_names=None, sort=[], dims={}, **kwargs):
      """
      Sets up the arr_names dictionary for the plot
  
      Parameters
      ----------
      arr_names: string, list of strings or dictionary
          Set the unique array names of the resulting arrays and (optionally)
          dimensions.
  
          - if string: same as list of strings (see below). Strings may
            include {0} which will be replaced by a counter.
          - list of strings: those will be used for the array names. The final
            number of dictionaries in the return depend in this case on the
            `dims` and ``**furtherdims``
          - dictionary:
            Then nothing happens and an :class:`OrderedDict` version of
            `arr_names` is returned.
      sort: list of strings
          This parameter defines how the dictionaries are ordered. It has no
          effect if `arr_names` is a dictionary (use a
          :class:`~collections.OrderedDict` for that). It can be a list of
          dimension strings matching to the dimensions in `dims` for the
          variable.
      dims: dict
          Keys must be variable names of dimensions (e.g. time, level, lat or
          lon) or 'name' for the variable name you want to choose.
          Values must be values of that dimension or iterables of the values
          (e.g. lists). Note that strings will be put into a list.
          For example dims = {'name': 't2m', 'time': 0} will result in one plot
          for the first time step, whereas dims = {'name': 't2m', 'time': [0, 1]}
          will result in two plots, one for the first (time == 0) and one for the
          second (time == 1) time step.
      ``**kwargs``
          The same as `dims` (those will update what is specified in `dims`)
  
      Returns
      -------
      ~collections.OrderedDict
          A mapping from the keys in `arr_names` and to dictionaries. Each
          dictionary corresponds defines the coordinates of one data array to
          load"""
      try:
          return OrderedDict(arr_names)
      except (ValueError, TypeError):
          # ValueError for cyordereddict, TypeError for collections.OrderedDict
          pass
      if arr_names is None:
          arr_names = repeat('arr{0}')
      elif isstring(arr_names):
          arr_names = repeat(arr_names)
      dims = OrderedDict(dims)
      for key, val in six.iteritems(kwargs):
          dims.setdefault(key, val)
      sorted_dims = OrderedDict()
      if sort:
          for key in sort:
              sorted_dims[key] = dims.pop(key)
          for key, val in six.iteritems(dims):
              sorted_dims[key] = val
      else:
          # make sure, it is first sorted for the variable names
          if 'name' in dims:
              sorted_dims['name'] = None
          for key, val in sorted(dims.items()):
              sorted_dims[key] = val
          for key, val in six.iteritems(kwargs):
              sorted_dims.setdefault(key, val)
      for key, val in six.iteritems(sorted_dims):
          sorted_dims[key] = iter(safe_list(val))
      return OrderedDict([
          (arr_name.format(i), dict(zip(sorted_dims.keys(), dim_tuple)))
          for i, (arr_name, dim_tuple) in enumerate(zip(
              arr_names, product(
                  *map(list, sorted_dims.values()))))])