xarray.set_options¶
-
class
xarray.set_options(**kwargs)¶ Set options for xarray in a controlled context.
Currently supported options:
display_width: maximum display width forrepron xarray objects. Default:80.arithmetic_join: DataArray/Dataset alignment in binary operations. Default:'inner'.file_cache_maxsize: maximum number of open files to hold in xarray’s global least-recently-usage cached. This should be smaller than your system’s per-process file descriptor limit, e.g.,ulimit -non Linux. Default: 128.warn_for_unclosed_files: whether or not to issue a warning when unclosed files are deallocated (default False). This is mostly useful for debugging.cmap_sequential: colormap to use for nondivergent data plots. Default:viridis. If string, must be matplotlib built-in colormap. Can also be a Colormap object (e.g. mpl.cm.magma)cmap_divergent: colormap to use for divergent data plots. Default:RdBu_r. If string, must be matplotlib built-in colormap. Can also be a Colormap object (e.g. mpl.cm.magma)keep_attrs: rule for whether to keep attributes on xarray Datasets/dataarrays after operations. EitherTrueto always keep attrs,Falseto always discard them, or'default'to use original logic that attrs should only be kept in unambiguous circumstances. Default:'default'.
You can use
set_optionseither as a context manager:>>> ds = xr.Dataset({'x': np.arange(1000)}) >>> with xr.set_options(display_width=40): ... print(ds) <xarray.Dataset> Dimensions: (x: 1000) Coordinates: * x (x) int64 0 1 2 3 4 5 6 ... Data variables: *empty*
Or to set global options:
>>> xr.set_options(display_width=80)
-
__init__(**kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(**kwargs)Initialize self.