class_docstr: Container for inference data storage using xarray.
  
  For a detailed introduction to ``InferenceData`` objects and their usage, see
  :ref:`xarray_for_arviz`. This page provides help and documentation
  on ``InferenceData`` methods and their low level implementation.
class_docstr_tok: ["Container","for","inference","data","storage","using","xarray",".","For","a","detailed","introduction","to","``","InferenceData","``","objects","and","their","usage",",","see",":","ref",":","`","xarray_for_arviz","`",".","This","page","provides","help","and","documentation","on","``","InferenceData","``","methods","and","their","low","level","implementation","."]
docstr: Extend InferenceData with groups from another InferenceData.
  
  Parameters
  ----------
  other : InferenceData
      InferenceData to be added
  join : {'left', 'right'}, default 'left'
      Defines how the two decide which group to keep when the same group is
      present in both objects. 'left' will discard the group in ``other`` whereas 'right'
      will keep the group in ``other`` and discard the one in ``self``.
  
  Examples
  --------
  Take two InferenceData objects, and extend the first with the groups it doesn't have
  but are present in the 2nd InferenceData object.
  
  First InferenceData:
  
  .. jupyter-execute::
  
      import arviz as az
      idata = az.load_arviz_data("rugby")
  
  Second InferenceData:
  
  .. jupyter-execute::
  
      other_idata = az.load_arviz_data("radon")
  
  Call the ``extend`` method:
  
  .. jupyter-execute::
  
      idata.extend(other_idata)
      idata
  
  See how now the first InferenceData has more groups, with the data from the
  second one, but the groups it originally had have not been modified,
  even if also present in the second InferenceData.
  
  See Also
  --------
  add_groups : Add new groups to InferenceData object.
  concat : Concatenate InferenceData objects.
docstr_tok: ["Extend","InferenceData","with","groups","from","another","InferenceData",".","Parameters","--","--","--","--","--","other",":","InferenceData","InferenceData","to","be","added","join",":","{","'left","'",",","'right","'","}",",","default","'left'","Defines","how","the","two","decide","which","group","to","keep","when","the","same","group","is","present","in","both","objects",".","'left","'","will","discard","the","group","in","``","other","``","whereas","'right'","will","keep","the","group","in","``","other","``","and","discard","the","one","in","``","self","``",".","Examples","--","--","--","--","Take","two","InferenceData","objects",",","and","extend","the","first","with","the","groups","it","does","n't","have","but","are","present","in","the","2nd","InferenceData","object",".","First","InferenceData",":","..","jupyter-execute",":",":","import","arviz","as","az","idata","=","az.load_arviz_data","(","``","rugby","''",")","Second","InferenceData",":","..","jupyter-execute",":",":","other_idata","=","az.load_arviz_data","(","``","radon","''",")","Call","the","``","extend","``","method",":","..","jupyter-execute",":",":","idata.extend","(","other_idata",")","idata","See","how","now","the","first","InferenceData","has","more","groups",",","with","the","data","from","the","second","one",",","but","the","groups","it","originally","had","have","not","been","modified",",","even","if","also","present","in","the","second","InferenceData",".","See","Also","--","--","--","--","add_groups",":","Add","new","groups","to","InferenceData","object",".","concat",":","Concatenate","InferenceData","objects","."]
code: def extend(self, other, join="left"):
      """Extend InferenceData with groups from another InferenceData.
  
      Parameters
      ----------
      other : InferenceData
          InferenceData to be added
      join : {'left', 'right'}, default 'left'
          Defines how the two decide which group to keep when the same group is
          present in both objects. 'left' will discard the group in ``other`` whereas 'right'
          will keep the group in ``other`` and discard the one in ``self``.
  
      Examples
      --------
      Take two InferenceData objects, and extend the first with the groups it doesn't have
      but are present in the 2nd InferenceData object.
  
      First InferenceData:
  
      .. jupyter-execute::
  
          import arviz as az
          idata = az.load_arviz_data("rugby")
  
      Second InferenceData:
  
      .. jupyter-execute::
  
          other_idata = az.load_arviz_data("radon")
  
      Call the ``extend`` method:
  
      .. jupyter-execute::
  
          idata.extend(other_idata)
          idata
  
      See how now the first InferenceData has more groups, with the data from the
      second one, but the groups it originally had have not been modified,
      even if also present in the second InferenceData.
  
      See Also
      --------
      add_groups : Add new groups to InferenceData object.
      concat : Concatenate InferenceData objects.
  
      """
      if not isinstance(other, InferenceData):
          raise ValueError(
              "Extending is possible between two InferenceData objects only."
          )
      if join not in ("left", "right"):
          raise ValueError(
              f"join must be either 'left' or 'right', found {join}"
          )
      for (
          group
      ) in other._groups_all:  # pylint: disable=protected-access
          if hasattr(self, group) and join == "left":
              continue
          if group not in SUPPORTED_GROUPS_ALL:
              warnings.warn(
                  f"{group} group is not defined in the InferenceData scheme",
                  UserWarning,
              )
          dataset = getattr(other, group)
          setattr(self, group, dataset)
          if group.startswith(WARMUP_TAG):
              if group not in self._groups_warmup:
                  supported_order = [
                      key
                      for key in SUPPORTED_GROUPS_ALL
                      if key in self._groups_warmup
                  ]
                  if (supported_order == self._groups_warmup) and (
                      group in SUPPORTED_GROUPS_ALL
                  ):
                      group_order = [
                          key
                          for key in SUPPORTED_GROUPS_ALL
                          if key in self._groups_warmup + [group]
                      ]
                      group_idx = group_order.index(group)
                      self._groups_warmup.insert(group_idx, group)
                  else:
                      self._groups_warmup.append(group)
          elif group not in self._groups:
              supported_order = [
                  key
                  for key in SUPPORTED_GROUPS_ALL
                  if key in self._groups
              ]
              if (supported_order == self._groups) and (
                  group in SUPPORTED_GROUPS_ALL
              ):
                  group_order = [
                      key
                      for key in SUPPORTED_GROUPS_ALL
                      if key in self._groups + [group]
                  ]
                  group_idx = group_order.index(group)
                  self._groups.insert(group_idx, group)
              else:
                  self._groups.append(group)
  
imports: import os
  import re
  import sys
  import uuid
  import warnings
  from collections import OrderedDict, defaultdict
  from collections.abc import MutableMapping, Sequence
  from copy import copy
  from copy import deepcopy
  from datetime import datetime
  from html import escape
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, overload
  import numpy
  import xarray
  from packaging import version
  from ..rcparams import rcParams
  from ..utils import HtmlTemplate, _subset_list, _var_names, either_dict_or_kwargs
  from .base import _extend_xr_method, _make_json_serializable, dict_to_dataset
label_desc: Use image node_id 34 for calling the InferenceData obj's underlying member method code with example usage: obj.extend(other, join) without return types