partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Dataset.load | Manually trigger loading of this dataset's data from disk or a
remote source into memory and return this dataset.
Normally, it should not be necessary to call this method in user code,
because all xarray functions should either work on deferred data or
load data automatically. However, ... | xarray/core/dataset.py | def load(self: T, **kwargs) -> T:
"""Manually trigger loading of this dataset's data from disk or a
remote source into memory and return this dataset.
Normally, it should not be necessary to call this method in user code,
because all xarray functions should either work on deferred data ... | def load(self: T, **kwargs) -> T:
"""Manually trigger loading of this dataset's data from disk or a
remote source into memory and return this dataset.
Normally, it should not be necessary to call this method in user code,
because all xarray functions should either work on deferred data ... | [
"Manually",
"trigger",
"loading",
"of",
"this",
"dataset",
"s",
"data",
"from",
"disk",
"or",
"a",
"remote",
"source",
"into",
"memory",
"and",
"return",
"this",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L485-L520 | [
"def",
"load",
"(",
"self",
":",
"T",
",",
"*",
"*",
"kwargs",
")",
"->",
"T",
":",
"# access .data to coerce everything to numpy or dask arrays",
"lazy_data",
"=",
"{",
"k",
":",
"v",
".",
"_data",
"for",
"k",
",",
"v",
"in",
"self",
".",
"variables",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.compute | Manually trigger loading of this dataset's data from disk or a
remote source into memory and return a new dataset. The original is
left unaltered.
Normally, it should not be necessary to call this method in user code,
because all xarray functions should either work on deferred data or
... | xarray/core/dataset.py | def compute(self: T, **kwargs) -> T:
"""Manually trigger loading of this dataset's data from disk or a
remote source into memory and return a new dataset. The original is
left unaltered.
Normally, it should not be necessary to call this method in user code,
because all xarray fu... | def compute(self: T, **kwargs) -> T:
"""Manually trigger loading of this dataset's data from disk or a
remote source into memory and return a new dataset. The original is
left unaltered.
Normally, it should not be necessary to call this method in user code,
because all xarray fu... | [
"Manually",
"trigger",
"loading",
"of",
"this",
"dataset",
"s",
"data",
"from",
"disk",
"or",
"a",
"remote",
"source",
"into",
"memory",
"and",
"return",
"a",
"new",
"dataset",
".",
"The",
"original",
"is",
"left",
"unaltered",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L616-L636 | [
"def",
"compute",
"(",
"self",
":",
"T",
",",
"*",
"*",
"kwargs",
")",
"->",
"T",
":",
"new",
"=",
"self",
".",
"copy",
"(",
"deep",
"=",
"False",
")",
"return",
"new",
".",
"load",
"(",
"*",
"*",
"kwargs",
")"
] | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._persist_inplace | Persist all Dask arrays in memory | xarray/core/dataset.py | def _persist_inplace(self, **kwargs):
""" Persist all Dask arrays in memory """
# access .data to coerce everything to numpy or dask arrays
lazy_data = {k: v._data for k, v in self.variables.items()
if isinstance(v._data, dask_array_type)}
if lazy_data:
i... | def _persist_inplace(self, **kwargs):
""" Persist all Dask arrays in memory """
# access .data to coerce everything to numpy or dask arrays
lazy_data = {k: v._data for k, v in self.variables.items()
if isinstance(v._data, dask_array_type)}
if lazy_data:
i... | [
"Persist",
"all",
"Dask",
"arrays",
"in",
"memory"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L638-L652 | [
"def",
"_persist_inplace",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# access .data to coerce everything to numpy or dask arrays",
"lazy_data",
"=",
"{",
"k",
":",
"v",
".",
"_data",
"for",
"k",
",",
"v",
"in",
"self",
".",
"variables",
".",
"items",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.persist | Trigger computation, keeping data as dask arrays
This operation can be used to trigger computation on underlying dask
arrays, similar to ``.compute()``. However this operation keeps the
data as dask arrays. This is particularly useful when using the
dask.distributed scheduler and you ... | xarray/core/dataset.py | def persist(self: T, **kwargs) -> T:
""" Trigger computation, keeping data as dask arrays
This operation can be used to trigger computation on underlying dask
arrays, similar to ``.compute()``. However this operation keeps the
data as dask arrays. This is particularly useful when usin... | def persist(self: T, **kwargs) -> T:
""" Trigger computation, keeping data as dask arrays
This operation can be used to trigger computation on underlying dask
arrays, similar to ``.compute()``. However this operation keeps the
data as dask arrays. This is particularly useful when usin... | [
"Trigger",
"computation",
"keeping",
"data",
"as",
"dask",
"arrays"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L654-L673 | [
"def",
"persist",
"(",
"self",
":",
"T",
",",
"*",
"*",
"kwargs",
")",
"->",
"T",
":",
"new",
"=",
"self",
".",
"copy",
"(",
"deep",
"=",
"False",
")",
"return",
"new",
".",
"_persist_inplace",
"(",
"*",
"*",
"kwargs",
")"
] | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._construct_direct | Shortcut around __init__ for internal use when we want to skip
costly validation | xarray/core/dataset.py | def _construct_direct(cls, variables, coord_names, dims, attrs=None,
indexes=None, encoding=None, file_obj=None):
"""Shortcut around __init__ for internal use when we want to skip
costly validation
"""
obj = object.__new__(cls)
obj._variables = variables... | def _construct_direct(cls, variables, coord_names, dims, attrs=None,
indexes=None, encoding=None, file_obj=None):
"""Shortcut around __init__ for internal use when we want to skip
costly validation
"""
obj = object.__new__(cls)
obj._variables = variables... | [
"Shortcut",
"around",
"__init__",
"for",
"internal",
"use",
"when",
"we",
"want",
"to",
"skip",
"costly",
"validation"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L676-L690 | [
"def",
"_construct_direct",
"(",
"cls",
",",
"variables",
",",
"coord_names",
",",
"dims",
",",
"attrs",
"=",
"None",
",",
"indexes",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"file_obj",
"=",
"None",
")",
":",
"obj",
"=",
"object",
".",
"__new__... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._replace | Fastpath constructor for internal use.
Returns an object with optionally with replaced attributes.
Explicitly passed arguments are *not* copied when placed on the new
dataset. It is up to the caller to ensure that they have the right type
and are not used elsewhere. | xarray/core/dataset.py | def _replace( # type: ignore
self: T,
variables: 'OrderedDict[Any, Variable]' = None,
coord_names: set = None,
dims: Dict[Any, int] = None,
attrs: 'Optional[OrderedDict]' = __default,
indexes: 'Optional[OrderedDict[Any, pd.Index]]' = __default,
encoding: Optional... | def _replace( # type: ignore
self: T,
variables: 'OrderedDict[Any, Variable]' = None,
coord_names: set = None,
dims: Dict[Any, int] = None,
attrs: 'Optional[OrderedDict]' = __default,
indexes: 'Optional[OrderedDict[Any, pd.Index]]' = __default,
encoding: Optional... | [
"Fastpath",
"constructor",
"for",
"internal",
"use",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L702-L749 | [
"def",
"_replace",
"(",
"# type: ignore",
"self",
":",
"T",
",",
"variables",
":",
"'OrderedDict[Any, Variable]'",
"=",
"None",
",",
"coord_names",
":",
"set",
"=",
"None",
",",
"dims",
":",
"Dict",
"[",
"Any",
",",
"int",
"]",
"=",
"None",
",",
"attrs",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._replace_with_new_dims | Replace variables with recalculated dimensions. | xarray/core/dataset.py | def _replace_with_new_dims( # type: ignore
self: T,
variables: 'OrderedDict[Any, Variable]' = None,
coord_names: set = None,
attrs: 'Optional[OrderedDict]' = __default,
indexes: 'Optional[OrderedDict[Any, pd.Index]]' = __default,
inplace: bool = False,
) -> T:
... | def _replace_with_new_dims( # type: ignore
self: T,
variables: 'OrderedDict[Any, Variable]' = None,
coord_names: set = None,
attrs: 'Optional[OrderedDict]' = __default,
indexes: 'Optional[OrderedDict[Any, pd.Index]]' = __default,
inplace: bool = False,
) -> T:
... | [
"Replace",
"variables",
"with",
"recalculated",
"dimensions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L751-L762 | [
"def",
"_replace_with_new_dims",
"(",
"# type: ignore",
"self",
":",
"T",
",",
"variables",
":",
"'OrderedDict[Any, Variable]'",
"=",
"None",
",",
"coord_names",
":",
"set",
"=",
"None",
",",
"attrs",
":",
"'Optional[OrderedDict]'",
"=",
"__default",
",",
"indexes... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.copy | Returns a copy of this dataset.
If `deep=True`, a deep copy is made of each of the component variables.
Otherwise, a shallow copy of each of the component variable is made, so
that the underlying memory region of the new dataset is the same as in
the original dataset.
Use `data... | xarray/core/dataset.py | def copy(self: T, deep: bool = False, data: Mapping = None) -> T:
"""Returns a copy of this dataset.
If `deep=True`, a deep copy is made of each of the component variables.
Otherwise, a shallow copy of each of the component variable is made, so
that the underlying memory region of the n... | def copy(self: T, deep: bool = False, data: Mapping = None) -> T:
"""Returns a copy of this dataset.
If `deep=True`, a deep copy is made of each of the component variables.
Otherwise, a shallow copy of each of the component variable is made, so
that the underlying memory region of the n... | [
"Returns",
"a",
"copy",
"of",
"this",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L802-L920 | [
"def",
"copy",
"(",
"self",
":",
"T",
",",
"deep",
":",
"bool",
"=",
"False",
",",
"data",
":",
"Mapping",
"=",
"None",
")",
"->",
"T",
":",
"# noqa",
"if",
"data",
"is",
"None",
":",
"variables",
"=",
"OrderedDict",
"(",
"(",
"k",
",",
"v",
".... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._level_coords | Return a mapping of all MultiIndex levels and their corresponding
coordinate name. | xarray/core/dataset.py | def _level_coords(self):
"""Return a mapping of all MultiIndex levels and their corresponding
coordinate name.
"""
level_coords = OrderedDict()
for name, index in self.indexes.items():
if isinstance(index, pd.MultiIndex):
level_names = index.names
... | def _level_coords(self):
"""Return a mapping of all MultiIndex levels and their corresponding
coordinate name.
"""
level_coords = OrderedDict()
for name, index in self.indexes.items():
if isinstance(index, pd.MultiIndex):
level_names = index.names
... | [
"Return",
"a",
"mapping",
"of",
"all",
"MultiIndex",
"levels",
"and",
"their",
"corresponding",
"coordinate",
"name",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L923-L933 | [
"def",
"_level_coords",
"(",
"self",
")",
":",
"level_coords",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
",",
"index",
"in",
"self",
".",
"indexes",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"index",
",",
"pd",
".",
"MultiIndex",
")",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._copy_listed | Create a new Dataset with the listed variables from this dataset and
the all relevant coordinates. Skips all validation. | xarray/core/dataset.py | def _copy_listed(self: T, names) -> T:
"""Create a new Dataset with the listed variables from this dataset and
the all relevant coordinates. Skips all validation.
"""
variables = OrderedDict() # type: OrderedDict[Any, Variable]
coord_names = set()
indexes = OrderedDict()... | def _copy_listed(self: T, names) -> T:
"""Create a new Dataset with the listed variables from this dataset and
the all relevant coordinates. Skips all validation.
"""
variables = OrderedDict() # type: OrderedDict[Any, Variable]
coord_names = set()
indexes = OrderedDict()... | [
"Create",
"a",
"new",
"Dataset",
"with",
"the",
"listed",
"variables",
"from",
"this",
"dataset",
"and",
"the",
"all",
"relevant",
"coordinates",
".",
"Skips",
"all",
"validation",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L935-L968 | [
"def",
"_copy_listed",
"(",
"self",
":",
"T",
",",
"names",
")",
"->",
"T",
":",
"variables",
"=",
"OrderedDict",
"(",
")",
"# type: OrderedDict[Any, Variable]",
"coord_names",
"=",
"set",
"(",
")",
"indexes",
"=",
"OrderedDict",
"(",
")",
"# type: OrderedDict... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._construct_dataarray | Construct a DataArray by indexing this dataset | xarray/core/dataset.py | def _construct_dataarray(self, name) -> 'DataArray':
"""Construct a DataArray by indexing this dataset
"""
from .dataarray import DataArray
try:
variable = self._variables[name]
except KeyError:
_, name, variable = _get_virtual_variable(
s... | def _construct_dataarray(self, name) -> 'DataArray':
"""Construct a DataArray by indexing this dataset
"""
from .dataarray import DataArray
try:
variable = self._variables[name]
except KeyError:
_, name, variable = _get_virtual_variable(
s... | [
"Construct",
"a",
"DataArray",
"by",
"indexing",
"this",
"dataset"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L970-L995 | [
"def",
"_construct_dataarray",
"(",
"self",
",",
"name",
")",
"->",
"'DataArray'",
":",
"from",
".",
"dataarray",
"import",
"DataArray",
"try",
":",
"variable",
"=",
"self",
".",
"_variables",
"[",
"name",
"]",
"except",
"KeyError",
":",
"_",
",",
"name",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._item_sources | List of places to look-up items for key-completion | xarray/core/dataset.py | def _item_sources(self):
"""List of places to look-up items for key-completion"""
return [self.data_vars, self.coords, {d: self[d] for d in self.dims},
LevelCoordinatesSource(self)] | def _item_sources(self):
"""List of places to look-up items for key-completion"""
return [self.data_vars, self.coords, {d: self[d] for d in self.dims},
LevelCoordinatesSource(self)] | [
"List",
"of",
"places",
"to",
"look",
"-",
"up",
"items",
"for",
"key",
"-",
"completion"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1011-L1014 | [
"def",
"_item_sources",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"data_vars",
",",
"self",
".",
"coords",
",",
"{",
"d",
":",
"self",
"[",
"d",
"]",
"for",
"d",
"in",
"self",
".",
"dims",
"}",
",",
"LevelCoordinatesSource",
"(",
"self",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._all_compat | Helper function for equals and identical | xarray/core/dataset.py | def _all_compat(self, other, compat_str):
"""Helper function for equals and identical"""
# some stores (e.g., scipy) do not seem to preserve order, so don't
# require matching order for equality
def compat(x, y):
return getattr(x, compat_str)(y)
return (self._coord_... | def _all_compat(self, other, compat_str):
"""Helper function for equals and identical"""
# some stores (e.g., scipy) do not seem to preserve order, so don't
# require matching order for equality
def compat(x, y):
return getattr(x, compat_str)(y)
return (self._coord_... | [
"Helper",
"function",
"for",
"equals",
"and",
"identical"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1089-L1099 | [
"def",
"_all_compat",
"(",
"self",
",",
"other",
",",
"compat_str",
")",
":",
"# some stores (e.g., scipy) do not seem to preserve order, so don't",
"# require matching order for equality",
"def",
"compat",
"(",
"x",
",",
"y",
")",
":",
"return",
"getattr",
"(",
"x",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.indexes | Mapping of pandas.Index objects used for label based indexing | xarray/core/dataset.py | def indexes(self) -> 'Mapping[Any, pd.Index]':
"""Mapping of pandas.Index objects used for label based indexing
"""
if self._indexes is None:
self._indexes = default_indexes(self._variables, self._dims)
return Indexes(self._indexes) | def indexes(self) -> 'Mapping[Any, pd.Index]':
"""Mapping of pandas.Index objects used for label based indexing
"""
if self._indexes is None:
self._indexes = default_indexes(self._variables, self._dims)
return Indexes(self._indexes) | [
"Mapping",
"of",
"pandas",
".",
"Index",
"objects",
"used",
"for",
"label",
"based",
"indexing"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1155-L1160 | [
"def",
"indexes",
"(",
"self",
")",
"->",
"'Mapping[Any, pd.Index]'",
":",
"if",
"self",
".",
"_indexes",
"is",
"None",
":",
"self",
".",
"_indexes",
"=",
"default_indexes",
"(",
"self",
".",
"_variables",
",",
"self",
".",
"_dims",
")",
"return",
"Indexes... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.set_coords | Given names of one or more variables, set them as coordinates
Parameters
----------
names : str or list of str
Name(s) of variables in this dataset to convert into coordinates.
inplace : bool, optional
If True, modify this dataset inplace. Otherwise, create a new... | xarray/core/dataset.py | def set_coords(self, names, inplace=None):
"""Given names of one or more variables, set them as coordinates
Parameters
----------
names : str or list of str
Name(s) of variables in this dataset to convert into coordinates.
inplace : bool, optional
If True... | def set_coords(self, names, inplace=None):
"""Given names of one or more variables, set them as coordinates
Parameters
----------
names : str or list of str
Name(s) of variables in this dataset to convert into coordinates.
inplace : bool, optional
If True... | [
"Given",
"names",
"of",
"one",
"or",
"more",
"variables",
"set",
"them",
"as",
"coordinates"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1175-L1204 | [
"def",
"set_coords",
"(",
"self",
",",
"names",
",",
"inplace",
"=",
"None",
")",
":",
"# TODO: allow inserting new coordinates with this method, like",
"# DataFrame.set_index?",
"# nb. check in self._variables, not self.data_vars to insure that the",
"# operation is idempotent",
"in... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.reset_coords | Given names of coordinates, reset them to become variables
Parameters
----------
names : str or list of str, optional
Name(s) of non-index coordinates in this dataset to reset into
variables. By default, all non-index coordinates are reset.
drop : bool, optional
... | xarray/core/dataset.py | def reset_coords(self, names=None, drop=False, inplace=None):
"""Given names of coordinates, reset them to become variables
Parameters
----------
names : str or list of str, optional
Name(s) of non-index coordinates in this dataset to reset into
variables. By def... | def reset_coords(self, names=None, drop=False, inplace=None):
"""Given names of coordinates, reset them to become variables
Parameters
----------
names : str or list of str, optional
Name(s) of non-index coordinates in this dataset to reset into
variables. By def... | [
"Given",
"names",
"of",
"coordinates",
"reset",
"them",
"to",
"become",
"variables"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1206-L1242 | [
"def",
"reset_coords",
"(",
"self",
",",
"names",
"=",
"None",
",",
"drop",
"=",
"False",
",",
"inplace",
"=",
"None",
")",
":",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",
"if",
"names",
"is",
"None",
":",
"names",
"=",
"self",
".",
"_coo... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.dump_to_store | Store dataset contents to a backends.*DataStore object. | xarray/core/dataset.py | def dump_to_store(self, store, **kwargs):
"""Store dataset contents to a backends.*DataStore object."""
from ..backends.api import dump_to_store
# TODO: rename and/or cleanup this method to make it more consistent
# with to_netcdf()
return dump_to_store(self, store, **kwargs) | def dump_to_store(self, store, **kwargs):
"""Store dataset contents to a backends.*DataStore object."""
from ..backends.api import dump_to_store
# TODO: rename and/or cleanup this method to make it more consistent
# with to_netcdf()
return dump_to_store(self, store, **kwargs) | [
"Store",
"dataset",
"contents",
"to",
"a",
"backends",
".",
"*",
"DataStore",
"object",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1244-L1249 | [
"def",
"dump_to_store",
"(",
"self",
",",
"store",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"backends",
".",
"api",
"import",
"dump_to_store",
"# TODO: rename and/or cleanup this method to make it more consistent",
"# with to_netcdf()",
"return",
"dump_to_st... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.to_netcdf | Write dataset contents to a netCDF file.
Parameters
----------
path : str, Path or file-like object, optional
Path to which to save this dataset. File-like objects are only
supported by the scipy engine. If no path is provided, this
function returns the resul... | xarray/core/dataset.py | def to_netcdf(self, path=None, mode='w', format=None, group=None,
engine=None, encoding=None, unlimited_dims=None,
compute=True):
"""Write dataset contents to a netCDF file.
Parameters
----------
path : str, Path or file-like object, optional
... | def to_netcdf(self, path=None, mode='w', format=None, group=None,
engine=None, encoding=None, unlimited_dims=None,
compute=True):
"""Write dataset contents to a netCDF file.
Parameters
----------
path : str, Path or file-like object, optional
... | [
"Write",
"dataset",
"contents",
"to",
"a",
"netCDF",
"file",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1251-L1323 | [
"def",
"to_netcdf",
"(",
"self",
",",
"path",
"=",
"None",
",",
"mode",
"=",
"'w'",
",",
"format",
"=",
"None",
",",
"group",
"=",
"None",
",",
"engine",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"unlimited_dims",
"=",
"None",
",",
"compute",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.to_zarr | Write dataset contents to a zarr group.
.. note:: Experimental
The Zarr backend is new and experimental. Please report any
unexpected behavior via github issues.
Parameters
----------
store : MutableMapping or str, optional
Store or path ... | xarray/core/dataset.py | def to_zarr(self, store=None, mode='w-', synchronizer=None, group=None,
encoding=None, compute=True, consolidated=False):
"""Write dataset contents to a zarr group.
.. note:: Experimental
The Zarr backend is new and experimental. Please report any
une... | def to_zarr(self, store=None, mode='w-', synchronizer=None, group=None,
encoding=None, compute=True, consolidated=False):
"""Write dataset contents to a zarr group.
.. note:: Experimental
The Zarr backend is new and experimental. Please report any
une... | [
"Write",
"dataset",
"contents",
"to",
"a",
"zarr",
"group",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1325-L1368 | [
"def",
"to_zarr",
"(",
"self",
",",
"store",
"=",
"None",
",",
"mode",
"=",
"'w-'",
",",
"synchronizer",
"=",
"None",
",",
"group",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"compute",
"=",
"True",
",",
"consolidated",
"=",
"False",
")",
":",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.info | Concise summary of a Dataset variables and attributes.
Parameters
----------
buf : writable buffer, defaults to sys.stdout
See Also
--------
pandas.DataFrame.assign
netCDF's ncdump | xarray/core/dataset.py | def info(self, buf=None):
"""
Concise summary of a Dataset variables and attributes.
Parameters
----------
buf : writable buffer, defaults to sys.stdout
See Also
--------
pandas.DataFrame.assign
netCDF's ncdump
"""
if buf is None... | def info(self, buf=None):
"""
Concise summary of a Dataset variables and attributes.
Parameters
----------
buf : writable buffer, defaults to sys.stdout
See Also
--------
pandas.DataFrame.assign
netCDF's ncdump
"""
if buf is None... | [
"Concise",
"summary",
"of",
"a",
"Dataset",
"variables",
"and",
"attributes",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1373-L1408 | [
"def",
"info",
"(",
"self",
",",
"buf",
"=",
"None",
")",
":",
"if",
"buf",
"is",
"None",
":",
"# pragma: no cover",
"buf",
"=",
"sys",
".",
"stdout",
"lines",
"=",
"[",
"]",
"lines",
".",
"append",
"(",
"'xarray.Dataset {'",
")",
"lines",
".",
"appe... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.chunks | Block dimensions for this dataset's data or None if it's not a dask
array. | xarray/core/dataset.py | def chunks(self):
"""Block dimensions for this dataset's data or None if it's not a dask
array.
"""
chunks = {}
for v in self.variables.values():
if v.chunks is not None:
for dim, c in zip(v.dims, v.chunks):
if dim in chunks and c !... | def chunks(self):
"""Block dimensions for this dataset's data or None if it's not a dask
array.
"""
chunks = {}
for v in self.variables.values():
if v.chunks is not None:
for dim, c in zip(v.dims, v.chunks):
if dim in chunks and c !... | [
"Block",
"dimensions",
"for",
"this",
"dataset",
"s",
"data",
"or",
"None",
"if",
"it",
"s",
"not",
"a",
"dask",
"array",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1411-L1422 | [
"def",
"chunks",
"(",
"self",
")",
":",
"chunks",
"=",
"{",
"}",
"for",
"v",
"in",
"self",
".",
"variables",
".",
"values",
"(",
")",
":",
"if",
"v",
".",
"chunks",
"is",
"not",
"None",
":",
"for",
"dim",
",",
"c",
"in",
"zip",
"(",
"v",
".",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.chunk | Coerce all arrays in this dataset into dask arrays with the given
chunks.
Non-dask arrays in this dataset will be converted to dask arrays. Dask
arrays will be rechunked to the given chunk sizes.
If neither chunks is not provided for one or more dimensions, chunk
sizes along th... | xarray/core/dataset.py | def chunk(self, chunks=None, name_prefix='xarray-', token=None,
lock=False):
"""Coerce all arrays in this dataset into dask arrays with the given
chunks.
Non-dask arrays in this dataset will be converted to dask arrays. Dask
arrays will be rechunked to the given chunk size... | def chunk(self, chunks=None, name_prefix='xarray-', token=None,
lock=False):
"""Coerce all arrays in this dataset into dask arrays with the given
chunks.
Non-dask arrays in this dataset will be converted to dask arrays. Dask
arrays will be rechunked to the given chunk size... | [
"Coerce",
"all",
"arrays",
"in",
"this",
"dataset",
"into",
"dask",
"arrays",
"with",
"the",
"given",
"chunks",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1424-L1487 | [
"def",
"chunk",
"(",
"self",
",",
"chunks",
"=",
"None",
",",
"name_prefix",
"=",
"'xarray-'",
",",
"token",
"=",
"None",
",",
"lock",
"=",
"False",
")",
":",
"try",
":",
"from",
"dask",
".",
"base",
"import",
"tokenize",
"except",
"ImportError",
":",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._validate_indexers | Here we make sure
+ indexer has a valid keys
+ indexer is in a valid data type
+ string indexers are cast to the appropriate date type if the
associated index is a DatetimeIndex or CFTimeIndex | xarray/core/dataset.py | def _validate_indexers(
self, indexers: Mapping,
) -> List[Tuple[Any, Union[slice, Variable]]]:
""" Here we make sure
+ indexer has a valid keys
+ indexer is in a valid data type
+ string indexers are cast to the appropriate date type if the
associated index is a Da... | def _validate_indexers(
self, indexers: Mapping,
) -> List[Tuple[Any, Union[slice, Variable]]]:
""" Here we make sure
+ indexer has a valid keys
+ indexer is in a valid data type
+ string indexers are cast to the appropriate date type if the
associated index is a Da... | [
"Here",
"we",
"make",
"sure",
"+",
"indexer",
"has",
"a",
"valid",
"keys",
"+",
"indexer",
"is",
"in",
"a",
"valid",
"data",
"type",
"+",
"string",
"indexers",
"are",
"cast",
"to",
"the",
"appropriate",
"date",
"type",
"if",
"the",
"associated",
"index",... | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1489-L1545 | [
"def",
"_validate_indexers",
"(",
"self",
",",
"indexers",
":",
"Mapping",
",",
")",
"->",
"List",
"[",
"Tuple",
"[",
"Any",
",",
"Union",
"[",
"slice",
",",
"Variable",
"]",
"]",
"]",
":",
"from",
".",
"dataarray",
"import",
"DataArray",
"invalid",
"=... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset._get_indexers_coords_and_indexes | Extract coordinates from indexers.
Returns an OrderedDict mapping from coordinate name to the
coordinate variable.
Only coordinate with a name different from any of self.variables will
be attached. | xarray/core/dataset.py | def _get_indexers_coords_and_indexes(self, indexers):
""" Extract coordinates from indexers.
Returns an OrderedDict mapping from coordinate name to the
coordinate variable.
Only coordinate with a name different from any of self.variables will
be attached.
"""
fr... | def _get_indexers_coords_and_indexes(self, indexers):
""" Extract coordinates from indexers.
Returns an OrderedDict mapping from coordinate name to the
coordinate variable.
Only coordinate with a name different from any of self.variables will
be attached.
"""
fr... | [
"Extract",
"coordinates",
"from",
"indexers",
".",
"Returns",
"an",
"OrderedDict",
"mapping",
"from",
"coordinate",
"name",
"to",
"the",
"coordinate",
"variable",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1547-L1588 | [
"def",
"_get_indexers_coords_and_indexes",
"(",
"self",
",",
"indexers",
")",
":",
"from",
".",
"dataarray",
"import",
"DataArray",
"coord_list",
"=",
"[",
"]",
"indexes",
"=",
"OrderedDict",
"(",
")",
"for",
"k",
",",
"v",
"in",
"indexers",
".",
"items",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.isel | Returns a new dataset with each array indexed along the specified
dimension(s).
This method selects values from each array using its `__getitem__`
method, except this method does not require knowing the order of
each array's dimensions.
Parameters
----------
ind... | xarray/core/dataset.py | def isel(self, indexers=None, drop=False, **indexers_kwargs):
"""Returns a new dataset with each array indexed along the specified
dimension(s).
This method selects values from each array using its `__getitem__`
method, except this method does not require knowing the order of
ea... | def isel(self, indexers=None, drop=False, **indexers_kwargs):
"""Returns a new dataset with each array indexed along the specified
dimension(s).
This method selects values from each array using its `__getitem__`
method, except this method does not require knowing the order of
ea... | [
"Returns",
"a",
"new",
"dataset",
"with",
"each",
"array",
"indexed",
"along",
"the",
"specified",
"dimension",
"(",
"s",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1590-L1665 | [
"def",
"isel",
"(",
"self",
",",
"indexers",
"=",
"None",
",",
"drop",
"=",
"False",
",",
"*",
"*",
"indexers_kwargs",
")",
":",
"indexers",
"=",
"either_dict_or_kwargs",
"(",
"indexers",
",",
"indexers_kwargs",
",",
"'isel'",
")",
"indexers_list",
"=",
"s... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.sel | Returns a new dataset with each array indexed by tick labels
along the specified dimension(s).
In contrast to `Dataset.isel`, indexers for this method should use
labels instead of integers.
Under the hood, this method is powered by using pandas's powerful Index
objects. This ma... | xarray/core/dataset.py | def sel(self, indexers=None, method=None, tolerance=None, drop=False,
**indexers_kwargs):
"""Returns a new dataset with each array indexed by tick labels
along the specified dimension(s).
In contrast to `Dataset.isel`, indexers for this method should use
labels instead of in... | def sel(self, indexers=None, method=None, tolerance=None, drop=False,
**indexers_kwargs):
"""Returns a new dataset with each array indexed by tick labels
along the specified dimension(s).
In contrast to `Dataset.isel`, indexers for this method should use
labels instead of in... | [
"Returns",
"a",
"new",
"dataset",
"with",
"each",
"array",
"indexed",
"by",
"tick",
"labels",
"along",
"the",
"specified",
"dimension",
"(",
"s",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1667-L1735 | [
"def",
"sel",
"(",
"self",
",",
"indexers",
"=",
"None",
",",
"method",
"=",
"None",
",",
"tolerance",
"=",
"None",
",",
"drop",
"=",
"False",
",",
"*",
"*",
"indexers_kwargs",
")",
":",
"indexers",
"=",
"either_dict_or_kwargs",
"(",
"indexers",
",",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.isel_points | Returns a new dataset with each array indexed pointwise along the
specified dimension(s).
This method selects pointwise values from each array and is akin to
the NumPy indexing behavior of `arr[[0, 1], [0, 1]]`, except this
method does not require knowing the order of each array's dimen... | xarray/core/dataset.py | def isel_points(self, dim='points', **indexers):
# type: (...) -> Dataset
"""Returns a new dataset with each array indexed pointwise along the
specified dimension(s).
This method selects pointwise values from each array and is akin to
the NumPy indexing behavior of `arr[[0, 1], ... | def isel_points(self, dim='points', **indexers):
# type: (...) -> Dataset
"""Returns a new dataset with each array indexed pointwise along the
specified dimension(s).
This method selects pointwise values from each array and is akin to
the NumPy indexing behavior of `arr[[0, 1], ... | [
"Returns",
"a",
"new",
"dataset",
"with",
"each",
"array",
"indexed",
"pointwise",
"along",
"the",
"specified",
"dimension",
"(",
"s",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1737-L1873 | [
"def",
"isel_points",
"(",
"self",
",",
"dim",
"=",
"'points'",
",",
"*",
"*",
"indexers",
")",
":",
"# type: (...) -> Dataset",
"# noqa",
"warnings",
".",
"warn",
"(",
"'Dataset.isel_points is deprecated: use Dataset.isel()'",
"'instead.'",
",",
"DeprecationWarning",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.sel_points | Returns a new dataset with each array indexed pointwise by tick
labels along the specified dimension(s).
In contrast to `Dataset.isel_points`, indexers for this method should
use labels instead of integers.
In contrast to `Dataset.sel`, this method selects points along the
diag... | xarray/core/dataset.py | def sel_points(self, dim='points', method=None, tolerance=None,
**indexers):
"""Returns a new dataset with each array indexed pointwise by tick
labels along the specified dimension(s).
In contrast to `Dataset.isel_points`, indexers for this method should
use labels in... | def sel_points(self, dim='points', method=None, tolerance=None,
**indexers):
"""Returns a new dataset with each array indexed pointwise by tick
labels along the specified dimension(s).
In contrast to `Dataset.isel_points`, indexers for this method should
use labels in... | [
"Returns",
"a",
"new",
"dataset",
"with",
"each",
"array",
"indexed",
"pointwise",
"by",
"tick",
"labels",
"along",
"the",
"specified",
"dimension",
"(",
"s",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1875-L1933 | [
"def",
"sel_points",
"(",
"self",
",",
"dim",
"=",
"'points'",
",",
"method",
"=",
"None",
",",
"tolerance",
"=",
"None",
",",
"*",
"*",
"indexers",
")",
":",
"# noqa",
"warnings",
".",
"warn",
"(",
"'Dataset.sel_points is deprecated: use Dataset.sel()'",
"'in... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.reindex_like | Conform this object onto the indexes of another object, filling
in missing values with NaN.
Parameters
----------
other : Dataset or DataArray
Object with an 'indexes' attribute giving a mapping from dimension
names to pandas.Index objects, which provides coordin... | xarray/core/dataset.py | def reindex_like(self, other, method=None, tolerance=None, copy=True):
"""Conform this object onto the indexes of another object, filling
in missing values with NaN.
Parameters
----------
other : Dataset or DataArray
Object with an 'indexes' attribute giving a mappin... | def reindex_like(self, other, method=None, tolerance=None, copy=True):
"""Conform this object onto the indexes of another object, filling
in missing values with NaN.
Parameters
----------
other : Dataset or DataArray
Object with an 'indexes' attribute giving a mappin... | [
"Conform",
"this",
"object",
"onto",
"the",
"indexes",
"of",
"another",
"object",
"filling",
"in",
"missing",
"values",
"with",
"NaN",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1935-L1980 | [
"def",
"reindex_like",
"(",
"self",
",",
"other",
",",
"method",
"=",
"None",
",",
"tolerance",
"=",
"None",
",",
"copy",
"=",
"True",
")",
":",
"indexers",
"=",
"alignment",
".",
"reindex_like_indexers",
"(",
"self",
",",
"other",
")",
"return",
"self",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.reindex | Conform this object onto a new set of indexes, filling in
missing values with NaN.
Parameters
----------
indexers : dict. optional
Dictionary with keys given by dimension names and values given by
arrays of coordinates tick labels. Any mis-matched coordinate
... | xarray/core/dataset.py | def reindex(self, indexers=None, method=None, tolerance=None, copy=True,
**indexers_kwargs):
"""Conform this object onto a new set of indexes, filling in
missing values with NaN.
Parameters
----------
indexers : dict. optional
Dictionary with keys giv... | def reindex(self, indexers=None, method=None, tolerance=None, copy=True,
**indexers_kwargs):
"""Conform this object onto a new set of indexes, filling in
missing values with NaN.
Parameters
----------
indexers : dict. optional
Dictionary with keys giv... | [
"Conform",
"this",
"object",
"onto",
"a",
"new",
"set",
"of",
"indexes",
"filling",
"in",
"missing",
"values",
"with",
"NaN",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1982-L2041 | [
"def",
"reindex",
"(",
"self",
",",
"indexers",
"=",
"None",
",",
"method",
"=",
"None",
",",
"tolerance",
"=",
"None",
",",
"copy",
"=",
"True",
",",
"*",
"*",
"indexers_kwargs",
")",
":",
"indexers",
"=",
"utils",
".",
"either_dict_or_kwargs",
"(",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.interp | 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 ... | xarray/core/dataset.py | 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 c... | 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 c... | [
"Multidimensional",
"interpolation",
"of",
"Dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2043-L2148 | [
"def",
"interp",
"(",
"self",
",",
"coords",
"=",
"None",
",",
"method",
"=",
"'linear'",
",",
"assume_sorted",
"=",
"False",
",",
"kwargs",
"=",
"{",
"}",
",",
"*",
"*",
"coords_kwargs",
")",
":",
"from",
".",
"import",
"missing",
"coords",
"=",
"ei... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.interp_like | Interpolate this object onto the coordinates of another object,
filling the out of range values with NaN.
Parameters
----------
other : Dataset or DataArray
Object with an 'indexes' attribute giving a mapping from dimension
names to an 1d array-like, which provid... | xarray/core/dataset.py | def interp_like(self, other, method='linear', assume_sorted=False,
kwargs={}):
"""Interpolate this object onto the coordinates of another object,
filling the out of range values with NaN.
Parameters
----------
other : Dataset or DataArray
Object w... | def interp_like(self, other, method='linear', assume_sorted=False,
kwargs={}):
"""Interpolate this object onto the coordinates of another object,
filling the out of range values with NaN.
Parameters
----------
other : Dataset or DataArray
Object w... | [
"Interpolate",
"this",
"object",
"onto",
"the",
"coordinates",
"of",
"another",
"object",
"filling",
"the",
"out",
"of",
"range",
"values",
"with",
"NaN",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2150-L2205 | [
"def",
"interp_like",
"(",
"self",
",",
"other",
",",
"method",
"=",
"'linear'",
",",
"assume_sorted",
"=",
"False",
",",
"kwargs",
"=",
"{",
"}",
")",
":",
"coords",
"=",
"alignment",
".",
"reindex_like_indexers",
"(",
"self",
",",
"other",
")",
"numeri... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.rename | Returns a new object with renamed variables and dimensions.
Parameters
----------
name_dict : dict-like, optional
Dictionary whose keys are current variable or dimension names and
whose values are the desired names.
inplace : bool, optional
If True, r... | xarray/core/dataset.py | def rename(self, name_dict=None, inplace=None, **names):
"""Returns a new object with renamed variables and dimensions.
Parameters
----------
name_dict : dict-like, optional
Dictionary whose keys are current variable or dimension names and
whose values are the de... | def rename(self, name_dict=None, inplace=None, **names):
"""Returns a new object with renamed variables and dimensions.
Parameters
----------
name_dict : dict-like, optional
Dictionary whose keys are current variable or dimension names and
whose values are the de... | [
"Returns",
"a",
"new",
"object",
"with",
"renamed",
"variables",
"and",
"dimensions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2247-L2283 | [
"def",
"rename",
"(",
"self",
",",
"name_dict",
"=",
"None",
",",
"inplace",
"=",
"None",
",",
"*",
"*",
"names",
")",
":",
"# TODO: add separate rename_vars and rename_dims methods.",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",
"name_dict",
"=",
"eit... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.swap_dims | Returns a new object with swapped dimensions.
Parameters
----------
dims_dict : dict-like
Dictionary whose keys are current dimension names and whose values
are new names. Each value must already be a variable in the
dataset.
inplace : bool, optional
... | xarray/core/dataset.py | def swap_dims(self, dims_dict, inplace=None):
"""Returns a new object with swapped dimensions.
Parameters
----------
dims_dict : dict-like
Dictionary whose keys are current dimension names and whose values
are new names. Each value must already be a variable in t... | def swap_dims(self, dims_dict, inplace=None):
"""Returns a new object with swapped dimensions.
Parameters
----------
dims_dict : dict-like
Dictionary whose keys are current dimension names and whose values
are new names. Each value must already be a variable in t... | [
"Returns",
"a",
"new",
"object",
"with",
"swapped",
"dimensions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2285-L2342 | [
"def",
"swap_dims",
"(",
"self",
",",
"dims_dict",
",",
"inplace",
"=",
"None",
")",
":",
"# TODO: deprecate this method in favor of a (less confusing)",
"# rename_dims() method that only renames dimensions.",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",
"for",
"k... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.expand_dims | Return a new object with an additional axis (or axes) inserted at
the corresponding position in the array shape.
If dim is already a scalar coordinate, it will be promoted to a 1D
coordinate consisting of a single value.
Parameters
----------
dim : str, sequence of str,... | xarray/core/dataset.py | def expand_dims(self, dim=None, axis=None, **dim_kwargs):
"""Return a new object with an additional axis (or axes) inserted at
the corresponding position in the array shape.
If dim is already a scalar coordinate, it will be promoted to a 1D
coordinate consisting of a single value.
... | def expand_dims(self, dim=None, axis=None, **dim_kwargs):
"""Return a new object with an additional axis (or axes) inserted at
the corresponding position in the array shape.
If dim is already a scalar coordinate, it will be promoted to a 1D
coordinate consisting of a single value.
... | [
"Return",
"a",
"new",
"object",
"with",
"an",
"additional",
"axis",
"(",
"or",
"axes",
")",
"inserted",
"at",
"the",
"corresponding",
"position",
"in",
"the",
"array",
"shape",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2344-L2474 | [
"def",
"expand_dims",
"(",
"self",
",",
"dim",
"=",
"None",
",",
"axis",
"=",
"None",
",",
"*",
"*",
"dim_kwargs",
")",
":",
"if",
"isinstance",
"(",
"dim",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"'dim should be str or sequence of strs or dict'",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.set_index | Set Dataset (multi-)indexes using one or more existing coordinates
or variables.
Parameters
----------
indexes : {dim: index, ...}
Mapping from names matching dimensions and values given
by (lists of) the names of existing coordinates or variables to set
... | xarray/core/dataset.py | def set_index(self, indexes=None, append=False, inplace=None,
**indexes_kwargs):
"""Set Dataset (multi-)indexes using one or more existing coordinates
or variables.
Parameters
----------
indexes : {dim: index, ...}
Mapping from names matching dimens... | def set_index(self, indexes=None, append=False, inplace=None,
**indexes_kwargs):
"""Set Dataset (multi-)indexes using one or more existing coordinates
or variables.
Parameters
----------
indexes : {dim: index, ...}
Mapping from names matching dimens... | [
"Set",
"Dataset",
"(",
"multi",
"-",
")",
"indexes",
"using",
"one",
"or",
"more",
"existing",
"coordinates",
"or",
"variables",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2476-L2513 | [
"def",
"set_index",
"(",
"self",
",",
"indexes",
"=",
"None",
",",
"append",
"=",
"False",
",",
"inplace",
"=",
"None",
",",
"*",
"*",
"indexes_kwargs",
")",
":",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",
"indexes",
"=",
"either_dict_or_kwargs... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.reset_index | Reset the specified index(es) or multi-index level(s).
Parameters
----------
dims_or_levels : str or list
Name(s) of the dimension(s) and/or multi-index level(s) that will
be reset.
drop : bool, optional
If True, remove the specified indexes and/or mu... | xarray/core/dataset.py | def reset_index(self, dims_or_levels, drop=False, inplace=None):
"""Reset the specified index(es) or multi-index level(s).
Parameters
----------
dims_or_levels : str or list
Name(s) of the dimension(s) and/or multi-index level(s) that will
be reset.
drop ... | def reset_index(self, dims_or_levels, drop=False, inplace=None):
"""Reset the specified index(es) or multi-index level(s).
Parameters
----------
dims_or_levels : str or list
Name(s) of the dimension(s) and/or multi-index level(s) that will
be reset.
drop ... | [
"Reset",
"the",
"specified",
"index",
"(",
"es",
")",
"or",
"multi",
"-",
"index",
"level",
"(",
"s",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2515-L2544 | [
"def",
"reset_index",
"(",
"self",
",",
"dims_or_levels",
",",
"drop",
"=",
"False",
",",
"inplace",
"=",
"None",
")",
":",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",
"variables",
",",
"coord_names",
"=",
"split_indexes",
"(",
"dims_or_levels",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.reorder_levels | Rearrange index levels using input order.
Parameters
----------
dim_order : optional
Mapping from names matching dimensions and values given
by lists representing new level orders. Every given dimension
must have a multi-index.
inplace : bool, optiona... | xarray/core/dataset.py | def reorder_levels(self, dim_order=None, inplace=None,
**dim_order_kwargs):
"""Rearrange index levels using input order.
Parameters
----------
dim_order : optional
Mapping from names matching dimensions and values given
by lists representin... | def reorder_levels(self, dim_order=None, inplace=None,
**dim_order_kwargs):
"""Rearrange index levels using input order.
Parameters
----------
dim_order : optional
Mapping from names matching dimensions and values given
by lists representin... | [
"Rearrange",
"index",
"levels",
"using",
"input",
"order",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2546-L2582 | [
"def",
"reorder_levels",
"(",
"self",
",",
"dim_order",
"=",
"None",
",",
"inplace",
"=",
"None",
",",
"*",
"*",
"dim_order_kwargs",
")",
":",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",
"dim_order",
"=",
"either_dict_or_kwargs",
"(",
"dim_order",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.unstack | Unstack existing dimensions corresponding to MultiIndexes into
multiple new dimensions.
New dimensions will be added at the end.
Parameters
----------
dim : str or sequence of str, optional
Dimension(s) over which to unstack. By default unstacks all
Mult... | xarray/core/dataset.py | def unstack(self, dim=None):
"""
Unstack existing dimensions corresponding to MultiIndexes into
multiple new dimensions.
New dimensions will be added at the end.
Parameters
----------
dim : str or sequence of str, optional
Dimension(s) over which to ... | def unstack(self, dim=None):
"""
Unstack existing dimensions corresponding to MultiIndexes into
multiple new dimensions.
New dimensions will be added at the end.
Parameters
----------
dim : str or sequence of str, optional
Dimension(s) over which to ... | [
"Unstack",
"existing",
"dimensions",
"corresponding",
"to",
"MultiIndexes",
"into",
"multiple",
"new",
"dimensions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2681-L2724 | [
"def",
"unstack",
"(",
"self",
",",
"dim",
"=",
"None",
")",
":",
"if",
"dim",
"is",
"None",
":",
"dims",
"=",
"[",
"d",
"for",
"d",
"in",
"self",
".",
"dims",
"if",
"isinstance",
"(",
"self",
".",
"get_index",
"(",
"d",
")",
",",
"pd",
".",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.update | Update this dataset's variables with those from another dataset.
Parameters
----------
other : Dataset or castable to Dataset
Dataset or variables with which to update this dataset.
inplace : bool, optional
If True, merge the other dataset into this dataset in-pl... | xarray/core/dataset.py | def update(self, other, inplace=None):
"""Update this dataset's variables with those from another dataset.
Parameters
----------
other : Dataset or castable to Dataset
Dataset or variables with which to update this dataset.
inplace : bool, optional
If Tru... | def update(self, other, inplace=None):
"""Update this dataset's variables with those from another dataset.
Parameters
----------
other : Dataset or castable to Dataset
Dataset or variables with which to update this dataset.
inplace : bool, optional
If Tru... | [
"Update",
"this",
"dataset",
"s",
"variables",
"with",
"those",
"from",
"another",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2726-L2752 | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"inplace",
"=",
"None",
")",
":",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
",",
"default",
"=",
"True",
")",
"variables",
",",
"coord_names",
",",
"dims",
"=",
"dataset_update_method",
"(",
"self",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.merge | Merge the arrays of two datasets into a single dataset.
This method generally not allow for overriding data, with the exception
of attributes, which are ignored on the second dataset. Variables with
the same name are checked for conflicts via the equals or identical
methods.
Pa... | xarray/core/dataset.py | def merge(self, other, inplace=None, overwrite_vars=frozenset(),
compat='no_conflicts', join='outer'):
"""Merge the arrays of two datasets into a single dataset.
This method generally not allow for overriding data, with the exception
of attributes, which are ignored on the second ... | def merge(self, other, inplace=None, overwrite_vars=frozenset(),
compat='no_conflicts', join='outer'):
"""Merge the arrays of two datasets into a single dataset.
This method generally not allow for overriding data, with the exception
of attributes, which are ignored on the second ... | [
"Merge",
"the",
"arrays",
"of",
"two",
"datasets",
"into",
"a",
"single",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2754-L2810 | [
"def",
"merge",
"(",
"self",
",",
"other",
",",
"inplace",
"=",
"None",
",",
"overwrite_vars",
"=",
"frozenset",
"(",
")",
",",
"compat",
"=",
"'no_conflicts'",
",",
"join",
"=",
"'outer'",
")",
":",
"inplace",
"=",
"_check_inplace",
"(",
"inplace",
")",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.drop | Drop variables or index labels from this dataset.
Parameters
----------
labels : scalar or list of scalars
Name(s) of variables or index labels to drop.
dim : None or str, optional
Dimension along which to drop index labels. By default (if
``dim is No... | xarray/core/dataset.py | def drop(self, labels, dim=None):
"""Drop variables or index labels from this dataset.
Parameters
----------
labels : scalar or list of scalars
Name(s) of variables or index labels to drop.
dim : None or str, optional
Dimension along which to drop index l... | def drop(self, labels, dim=None):
"""Drop variables or index labels from this dataset.
Parameters
----------
labels : scalar or list of scalars
Name(s) of variables or index labels to drop.
dim : None or str, optional
Dimension along which to drop index l... | [
"Drop",
"variables",
"or",
"index",
"labels",
"from",
"this",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2820-L2846 | [
"def",
"drop",
"(",
"self",
",",
"labels",
",",
"dim",
"=",
"None",
")",
":",
"if",
"utils",
".",
"is_scalar",
"(",
"labels",
")",
":",
"labels",
"=",
"[",
"labels",
"]",
"if",
"dim",
"is",
"None",
":",
"return",
"self",
".",
"_drop_vars",
"(",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.drop_dims | Drop dimensions and associated variables from this dataset.
Parameters
----------
drop_dims : str or list
Dimension or dimensions to drop.
Returns
-------
obj : Dataset
The dataset without the given dimensions (or any variables
contai... | xarray/core/dataset.py | def drop_dims(self, drop_dims):
"""Drop dimensions and associated variables from this dataset.
Parameters
----------
drop_dims : str or list
Dimension or dimensions to drop.
Returns
-------
obj : Dataset
The dataset without the given dime... | def drop_dims(self, drop_dims):
"""Drop dimensions and associated variables from this dataset.
Parameters
----------
drop_dims : str or list
Dimension or dimensions to drop.
Returns
-------
obj : Dataset
The dataset without the given dime... | [
"Drop",
"dimensions",
"and",
"associated",
"variables",
"from",
"this",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2856-L2885 | [
"def",
"drop_dims",
"(",
"self",
",",
"drop_dims",
")",
":",
"if",
"utils",
".",
"is_scalar",
"(",
"drop_dims",
")",
":",
"drop_dims",
"=",
"[",
"drop_dims",
"]",
"missing_dimensions",
"=",
"[",
"d",
"for",
"d",
"in",
"drop_dims",
"if",
"d",
"not",
"in... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.transpose | Return a new Dataset object with all array dimensions transposed.
Although the order of dimensions on each array will change, the dataset
dimensions themselves will remain in fixed (sorted) order.
Parameters
----------
*dims : str, optional
By default, reverse the d... | xarray/core/dataset.py | def transpose(self, *dims):
"""Return a new Dataset object with all array dimensions transposed.
Although the order of dimensions on each array will change, the dataset
dimensions themselves will remain in fixed (sorted) order.
Parameters
----------
*dims : str, optiona... | def transpose(self, *dims):
"""Return a new Dataset object with all array dimensions transposed.
Although the order of dimensions on each array will change, the dataset
dimensions themselves will remain in fixed (sorted) order.
Parameters
----------
*dims : str, optiona... | [
"Return",
"a",
"new",
"Dataset",
"object",
"with",
"all",
"array",
"dimensions",
"transposed",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2887-L2925 | [
"def",
"transpose",
"(",
"self",
",",
"*",
"dims",
")",
":",
"if",
"dims",
":",
"if",
"set",
"(",
"dims",
")",
"^",
"set",
"(",
"self",
".",
"dims",
")",
":",
"raise",
"ValueError",
"(",
"'arguments to transpose (%s) must be '",
"'permuted dataset dimensions... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.dropna | Returns a new dataset with dropped labels for missing values along
the provided dimension.
Parameters
----------
dim : str
Dimension along which to drop missing values. Dropping along
multiple dimensions simultaneously is not yet supported.
how : {'any', ... | xarray/core/dataset.py | def dropna(self, dim, how='any', thresh=None, subset=None):
"""Returns a new dataset with dropped labels for missing values along
the provided dimension.
Parameters
----------
dim : str
Dimension along which to drop missing values. Dropping along
multiple... | def dropna(self, dim, how='any', thresh=None, subset=None):
"""Returns a new dataset with dropped labels for missing values along
the provided dimension.
Parameters
----------
dim : str
Dimension along which to drop missing values. Dropping along
multiple... | [
"Returns",
"a",
"new",
"dataset",
"with",
"dropped",
"labels",
"for",
"missing",
"values",
"along",
"the",
"provided",
"dimension",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2927-L2980 | [
"def",
"dropna",
"(",
"self",
",",
"dim",
",",
"how",
"=",
"'any'",
",",
"thresh",
"=",
"None",
",",
"subset",
"=",
"None",
")",
":",
"# TODO: consider supporting multiple dimensions? Or not, given that",
"# there are some ugly edge cases, e.g., pandas's dropna differs",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.fillna | Fill missing values in this object.
This operation follows the normal broadcasting and alignment rules that
xarray uses for binary arithmetic, except the result is aligned to this
object (``join='left'``) instead of aligned to the intersection of
index coordinates (``join='inner'``).
... | xarray/core/dataset.py | def fillna(self, value):
"""Fill missing values in this object.
This operation follows the normal broadcasting and alignment rules that
xarray uses for binary arithmetic, except the result is aligned to this
object (``join='left'``) instead of aligned to the intersection of
inde... | def fillna(self, value):
"""Fill missing values in this object.
This operation follows the normal broadcasting and alignment rules that
xarray uses for binary arithmetic, except the result is aligned to this
object (``join='left'``) instead of aligned to the intersection of
inde... | [
"Fill",
"missing",
"values",
"in",
"this",
"object",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L2982-L3009 | [
"def",
"fillna",
"(",
"self",
",",
"value",
")",
":",
"if",
"utils",
".",
"is_dict_like",
"(",
"value",
")",
":",
"value_keys",
"=",
"getattr",
"(",
"value",
",",
"'data_vars'",
",",
"value",
")",
".",
"keys",
"(",
")",
"if",
"not",
"set",
"(",
"va... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.interpolate_na | Interpolate values according to different methods.
Parameters
----------
dim : str
Specifies the dimension along which to interpolate.
method : {'linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic',
'polynomial', 'barycentric', 'krog', 'pchip',
... | xarray/core/dataset.py | def interpolate_na(self, dim=None, method='linear', limit=None,
use_coordinate=True,
**kwargs):
"""Interpolate values according to different methods.
Parameters
----------
dim : str
Specifies the dimension along which to interpol... | def interpolate_na(self, dim=None, method='linear', limit=None,
use_coordinate=True,
**kwargs):
"""Interpolate values according to different methods.
Parameters
----------
dim : str
Specifies the dimension along which to interpol... | [
"Interpolate",
"values",
"according",
"to",
"different",
"methods",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3011-L3058 | [
"def",
"interpolate_na",
"(",
"self",
",",
"dim",
"=",
"None",
",",
"method",
"=",
"'linear'",
",",
"limit",
"=",
"None",
",",
"use_coordinate",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"missing",
"import",
"interp_na",
",",
"_apply... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.ffill | Fill NaN values by propogating values forward
*Requires bottleneck.*
Parameters
----------
dim : str
Specifies the dimension along which to propagate values when
filling.
limit : int, default None
The maximum number of consecutive NaN values ... | xarray/core/dataset.py | def ffill(self, dim, limit=None):
'''Fill NaN values by propogating values forward
*Requires bottleneck.*
Parameters
----------
dim : str
Specifies the dimension along which to propagate values when
filling.
limit : int, default None
... | def ffill(self, dim, limit=None):
'''Fill NaN values by propogating values forward
*Requires bottleneck.*
Parameters
----------
dim : str
Specifies the dimension along which to propagate values when
filling.
limit : int, default None
... | [
"Fill",
"NaN",
"values",
"by",
"propogating",
"values",
"forward"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3060-L3083 | [
"def",
"ffill",
"(",
"self",
",",
"dim",
",",
"limit",
"=",
"None",
")",
":",
"from",
".",
"missing",
"import",
"ffill",
",",
"_apply_over_vars_with_dim",
"new",
"=",
"_apply_over_vars_with_dim",
"(",
"ffill",
",",
"self",
",",
"dim",
"=",
"dim",
",",
"l... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.bfill | Fill NaN values by propogating values backward
*Requires bottleneck.*
Parameters
----------
dim : str
Specifies the dimension along which to propagate values when
filling.
limit : int, default None
The maximum number of consecutive NaN values... | xarray/core/dataset.py | def bfill(self, dim, limit=None):
'''Fill NaN values by propogating values backward
*Requires bottleneck.*
Parameters
----------
dim : str
Specifies the dimension along which to propagate values when
filling.
limit : int, default None
... | def bfill(self, dim, limit=None):
'''Fill NaN values by propogating values backward
*Requires bottleneck.*
Parameters
----------
dim : str
Specifies the dimension along which to propagate values when
filling.
limit : int, default None
... | [
"Fill",
"NaN",
"values",
"by",
"propogating",
"values",
"backward"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3085-L3108 | [
"def",
"bfill",
"(",
"self",
",",
"dim",
",",
"limit",
"=",
"None",
")",
":",
"from",
".",
"missing",
"import",
"bfill",
",",
"_apply_over_vars_with_dim",
"new",
"=",
"_apply_over_vars_with_dim",
"(",
"bfill",
",",
"self",
",",
"dim",
"=",
"dim",
",",
"l... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.combine_first | Combine two Datasets, default to data_vars of self.
The new coordinates follow the normal broadcasting and alignment rules
of ``join='outer'``. Vacant cells in the expanded coordinates are
filled with np.nan.
Parameters
----------
other : DataArray
Used to ... | xarray/core/dataset.py | def combine_first(self, other):
"""Combine two Datasets, default to data_vars of self.
The new coordinates follow the normal broadcasting and alignment rules
of ``join='outer'``. Vacant cells in the expanded coordinates are
filled with np.nan.
Parameters
----------
... | def combine_first(self, other):
"""Combine two Datasets, default to data_vars of self.
The new coordinates follow the normal broadcasting and alignment rules
of ``join='outer'``. Vacant cells in the expanded coordinates are
filled with np.nan.
Parameters
----------
... | [
"Combine",
"two",
"Datasets",
"default",
"to",
"data_vars",
"of",
"self",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3110-L3127 | [
"def",
"combine_first",
"(",
"self",
",",
"other",
")",
":",
"out",
"=",
"ops",
".",
"fillna",
"(",
"self",
",",
"other",
",",
"join",
"=",
"\"outer\"",
",",
"dataset_join",
"=",
"\"outer\"",
")",
"return",
"out"
] | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.reduce | Reduce this dataset by applying `func` along some dimension(s).
Parameters
----------
func : function
Function which can be called in the form
`f(x, axis=axis, **kwargs)` to return the result of reducing an
np.ndarray over an integer valued axis.
dim ... | xarray/core/dataset.py | def reduce(self, func, dim=None, keep_attrs=None, numeric_only=False,
allow_lazy=False, **kwargs):
"""Reduce this dataset by applying `func` along some dimension(s).
Parameters
----------
func : function
Function which can be called in the form
`f(... | def reduce(self, func, dim=None, keep_attrs=None, numeric_only=False,
allow_lazy=False, **kwargs):
"""Reduce this dataset by applying `func` along some dimension(s).
Parameters
----------
func : function
Function which can be called in the form
`f(... | [
"Reduce",
"this",
"dataset",
"by",
"applying",
"func",
"along",
"some",
"dimension",
"(",
"s",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3129-L3200 | [
"def",
"reduce",
"(",
"self",
",",
"func",
",",
"dim",
"=",
"None",
",",
"keep_attrs",
"=",
"None",
",",
"numeric_only",
"=",
"False",
",",
"allow_lazy",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dim",
"is",
"ALL_DIMS",
":",
"dim",
"=... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.apply | Apply a function over the data variables in this dataset.
Parameters
----------
func : function
Function which can be called in the form `func(x, *args, **kwargs)`
to transform each DataArray `x` in this dataset into another
DataArray.
keep_attrs : bo... | xarray/core/dataset.py | def apply(self, func, keep_attrs=None, args=(), **kwargs):
"""Apply a function over the data variables in this dataset.
Parameters
----------
func : function
Function which can be called in the form `func(x, *args, **kwargs)`
to transform each DataArray `x` in th... | def apply(self, func, keep_attrs=None, args=(), **kwargs):
"""Apply a function over the data variables in this dataset.
Parameters
----------
func : function
Function which can be called in the form `func(x, *args, **kwargs)`
to transform each DataArray `x` in th... | [
"Apply",
"a",
"function",
"over",
"the",
"data",
"variables",
"in",
"this",
"dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3202-L3250 | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"keep_attrs",
"=",
"None",
",",
"args",
"=",
"(",
")",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa",
"variables",
"=",
"OrderedDict",
"(",
"(",
"k",
",",
"maybe_wrap_array",
"(",
"v",
",",
"func",
"(",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.assign | Assign new data variables to a Dataset, returning a new object
with all the original variables in addition to the new ones.
Parameters
----------
variables : mapping, value pairs
Mapping from variables names to the new values. If the new values
are callable, they... | xarray/core/dataset.py | def assign(self, variables=None, **variables_kwargs):
"""Assign new data variables to a Dataset, returning a new object
with all the original variables in addition to the new ones.
Parameters
----------
variables : mapping, value pairs
Mapping from variables names to... | def assign(self, variables=None, **variables_kwargs):
"""Assign new data variables to a Dataset, returning a new object
with all the original variables in addition to the new ones.
Parameters
----------
variables : mapping, value pairs
Mapping from variables names to... | [
"Assign",
"new",
"data",
"variables",
"to",
"a",
"Dataset",
"returning",
"a",
"new",
"object",
"with",
"all",
"the",
"original",
"variables",
"in",
"addition",
"to",
"the",
"new",
"ones",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3252-L3292 | [
"def",
"assign",
"(",
"self",
",",
"variables",
"=",
"None",
",",
"*",
"*",
"variables_kwargs",
")",
":",
"variables",
"=",
"either_dict_or_kwargs",
"(",
"variables",
",",
"variables_kwargs",
",",
"'assign'",
")",
"data",
"=",
"self",
".",
"copy",
"(",
")"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.to_array | Convert this dataset into an xarray.DataArray
The data variables of this dataset will be broadcast against each other
and stacked along the first axis of the new array. All coordinates of
this dataset will remain coordinates.
Parameters
----------
dim : str, optional
... | xarray/core/dataset.py | def to_array(self, dim='variable', name=None):
"""Convert this dataset into an xarray.DataArray
The data variables of this dataset will be broadcast against each other
and stacked along the first axis of the new array. All coordinates of
this dataset will remain coordinates.
Pa... | def to_array(self, dim='variable', name=None):
"""Convert this dataset into an xarray.DataArray
The data variables of this dataset will be broadcast against each other
and stacked along the first axis of the new array. All coordinates of
this dataset will remain coordinates.
Pa... | [
"Convert",
"this",
"dataset",
"into",
"an",
"xarray",
".",
"DataArray"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3294-L3323 | [
"def",
"to_array",
"(",
"self",
",",
"dim",
"=",
"'variable'",
",",
"name",
"=",
"None",
")",
":",
"from",
".",
"dataarray",
"import",
"DataArray",
"data_vars",
"=",
"[",
"self",
".",
"variables",
"[",
"k",
"]",
"for",
"k",
"in",
"self",
".",
"data_v... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.from_dataframe | Convert a pandas.DataFrame into an xarray.Dataset
Each column will be converted into an independent variable in the
Dataset. If the dataframe's index is a MultiIndex, it will be expanded
into a tensor product of one-dimensional indices (filling in missing
values with NaN). This method w... | xarray/core/dataset.py | def from_dataframe(cls, dataframe):
"""Convert a pandas.DataFrame into an xarray.Dataset
Each column will be converted into an independent variable in the
Dataset. If the dataframe's index is a MultiIndex, it will be expanded
into a tensor product of one-dimensional indices (filling in ... | def from_dataframe(cls, dataframe):
"""Convert a pandas.DataFrame into an xarray.Dataset
Each column will be converted into an independent variable in the
Dataset. If the dataframe's index is a MultiIndex, it will be expanded
into a tensor product of one-dimensional indices (filling in ... | [
"Convert",
"a",
"pandas",
".",
"DataFrame",
"into",
"an",
"xarray",
".",
"Dataset"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3342-L3382 | [
"def",
"from_dataframe",
"(",
"cls",
",",
"dataframe",
")",
":",
"# TODO: Add an option to remove dimensions along which the variables",
"# are constant, to enable consistent serialization to/from a dataframe,",
"# even if some variables have different dimensionality.",
"if",
"not",
"dataf... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.to_dask_dataframe | Convert this dataset into a dask.dataframe.DataFrame.
The dimensions, coordinates and data variables in this dataset form
the columns of the DataFrame.
Parameters
----------
dim_order : list, optional
Hierarchical dimension order for the resulting dataframe. All
... | xarray/core/dataset.py | def to_dask_dataframe(self, dim_order=None, set_index=False):
"""
Convert this dataset into a dask.dataframe.DataFrame.
The dimensions, coordinates and data variables in this dataset form
the columns of the DataFrame.
Parameters
----------
dim_order : list, opti... | def to_dask_dataframe(self, dim_order=None, set_index=False):
"""
Convert this dataset into a dask.dataframe.DataFrame.
The dimensions, coordinates and data variables in this dataset form
the columns of the DataFrame.
Parameters
----------
dim_order : list, opti... | [
"Convert",
"this",
"dataset",
"into",
"a",
"dask",
".",
"dataframe",
".",
"DataFrame",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3384-L3458 | [
"def",
"to_dask_dataframe",
"(",
"self",
",",
"dim_order",
"=",
"None",
",",
"set_index",
"=",
"False",
")",
":",
"import",
"dask",
".",
"array",
"as",
"da",
"import",
"dask",
".",
"dataframe",
"as",
"dd",
"if",
"dim_order",
"is",
"None",
":",
"dim_order... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.to_dict | Convert this dataset to a dictionary following xarray naming
conventions.
Converts all variables and attributes to native Python objects
Useful for coverting to json. To avoid datetime incompatibility
use decode_times=False kwarg in xarrray.open_dataset.
Parameters
----... | xarray/core/dataset.py | def to_dict(self, data=True):
"""
Convert this dataset to a dictionary following xarray naming
conventions.
Converts all variables and attributes to native Python objects
Useful for coverting to json. To avoid datetime incompatibility
use decode_times=False kwarg in xarr... | def to_dict(self, data=True):
"""
Convert this dataset to a dictionary following xarray naming
conventions.
Converts all variables and attributes to native Python objects
Useful for coverting to json. To avoid datetime incompatibility
use decode_times=False kwarg in xarr... | [
"Convert",
"this",
"dataset",
"to",
"a",
"dictionary",
"following",
"xarray",
"naming",
"conventions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3460-L3485 | [
"def",
"to_dict",
"(",
"self",
",",
"data",
"=",
"True",
")",
":",
"d",
"=",
"{",
"'coords'",
":",
"{",
"}",
",",
"'attrs'",
":",
"decode_numpy_dict_values",
"(",
"self",
".",
"attrs",
")",
",",
"'dims'",
":",
"dict",
"(",
"self",
".",
"dims",
")",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.from_dict | Convert a dictionary into an xarray.Dataset.
Input dict can take several forms::
d = {'t': {'dims': ('t'), 'data': t},
'a': {'dims': ('t'), 'data': x},
'b': {'dims': ('t'), 'data': y}}
d = {'coords': {'t': {'dims': 't', 'data': t,
... | xarray/core/dataset.py | def from_dict(cls, d):
"""
Convert a dictionary into an xarray.Dataset.
Input dict can take several forms::
d = {'t': {'dims': ('t'), 'data': t},
'a': {'dims': ('t'), 'data': x},
'b': {'dims': ('t'), 'data': y}}
d = {'coords': {'t': {'... | def from_dict(cls, d):
"""
Convert a dictionary into an xarray.Dataset.
Input dict can take several forms::
d = {'t': {'dims': ('t'), 'data': t},
'a': {'dims': ('t'), 'data': x},
'b': {'dims': ('t'), 'data': y}}
d = {'coords': {'t': {'... | [
"Convert",
"a",
"dictionary",
"into",
"an",
"xarray",
".",
"Dataset",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3488-L3547 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"if",
"not",
"set",
"(",
"[",
"'coords'",
",",
"'data_vars'",
"]",
")",
".",
"issubset",
"(",
"set",
"(",
"d",
")",
")",
":",
"variables",
"=",
"d",
".",
"items",
"(",
")",
"else",
":",
"impor... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.diff | Calculate the n-th order discrete difference along given axis.
Parameters
----------
dim : str, optional
Dimension over which to calculate the finite difference.
n : int, optional
The number of times values are differenced.
label : str, optional
... | xarray/core/dataset.py | def diff(self, dim, n=1, label='upper'):
"""Calculate the n-th order discrete difference along given axis.
Parameters
----------
dim : str, optional
Dimension over which to calculate the finite difference.
n : int, optional
The number of times values are ... | def diff(self, dim, n=1, label='upper'):
"""Calculate the n-th order discrete difference along given axis.
Parameters
----------
dim : str, optional
Dimension over which to calculate the finite difference.
n : int, optional
The number of times values are ... | [
"Calculate",
"the",
"n",
"-",
"th",
"order",
"discrete",
"difference",
"along",
"given",
"axis",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3647-L3725 | [
"def",
"diff",
"(",
"self",
",",
"dim",
",",
"n",
"=",
"1",
",",
"label",
"=",
"'upper'",
")",
":",
"if",
"n",
"==",
"0",
":",
"return",
"self",
"if",
"n",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'order `n` must be non-negative but got {0}'",
"''",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.shift | Shift this dataset by an offset along one or more dimensions.
Only data variables are moved; coordinates stay in place. This is
consistent with the behavior of ``shift`` in pandas.
Parameters
----------
shifts : Mapping with the form of {dim: offset}
Integer offset ... | xarray/core/dataset.py | def shift(self, shifts=None, fill_value=dtypes.NA, **shifts_kwargs):
"""Shift this dataset by an offset along one or more dimensions.
Only data variables are moved; coordinates stay in place. This is
consistent with the behavior of ``shift`` in pandas.
Parameters
----------
... | def shift(self, shifts=None, fill_value=dtypes.NA, **shifts_kwargs):
"""Shift this dataset by an offset along one or more dimensions.
Only data variables are moved; coordinates stay in place. This is
consistent with the behavior of ``shift`` in pandas.
Parameters
----------
... | [
"Shift",
"this",
"dataset",
"by",
"an",
"offset",
"along",
"one",
"or",
"more",
"dimensions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3727-L3782 | [
"def",
"shift",
"(",
"self",
",",
"shifts",
"=",
"None",
",",
"fill_value",
"=",
"dtypes",
".",
"NA",
",",
"*",
"*",
"shifts_kwargs",
")",
":",
"shifts",
"=",
"either_dict_or_kwargs",
"(",
"shifts",
",",
"shifts_kwargs",
",",
"'shift'",
")",
"invalid",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.roll | Roll this dataset by an offset along one or more dimensions.
Unlike shift, roll may rotate all variables, including coordinates
if specified. The direction of rotation is consistent with
:py:func:`numpy.roll`.
Parameters
----------
shifts : dict, optional
A... | xarray/core/dataset.py | def roll(self, shifts=None, roll_coords=None, **shifts_kwargs):
"""Roll this dataset by an offset along one or more dimensions.
Unlike shift, roll may rotate all variables, including coordinates
if specified. The direction of rotation is consistent with
:py:func:`numpy.roll`.
P... | def roll(self, shifts=None, roll_coords=None, **shifts_kwargs):
"""Roll this dataset by an offset along one or more dimensions.
Unlike shift, roll may rotate all variables, including coordinates
if specified. The direction of rotation is consistent with
:py:func:`numpy.roll`.
P... | [
"Roll",
"this",
"dataset",
"by",
"an",
"offset",
"along",
"one",
"or",
"more",
"dimensions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3784-L3849 | [
"def",
"roll",
"(",
"self",
",",
"shifts",
"=",
"None",
",",
"roll_coords",
"=",
"None",
",",
"*",
"*",
"shifts_kwargs",
")",
":",
"shifts",
"=",
"either_dict_or_kwargs",
"(",
"shifts",
",",
"shifts_kwargs",
",",
"'roll'",
")",
"invalid",
"=",
"[",
"k",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.sortby | Sort object by labels or values (along an axis).
Sorts the dataset, either along specified dimensions,
or according to values of 1-D dataarrays that share dimension
with calling object.
If the input variables are dataarrays, then the dataarrays are aligned
(via left-join) to th... | xarray/core/dataset.py | def sortby(self, variables, ascending=True):
"""
Sort object by labels or values (along an axis).
Sorts the dataset, either along specified dimensions,
or according to values of 1-D dataarrays that share dimension
with calling object.
If the input variables are dataarra... | def sortby(self, variables, ascending=True):
"""
Sort object by labels or values (along an axis).
Sorts the dataset, either along specified dimensions,
or according to values of 1-D dataarrays that share dimension
with calling object.
If the input variables are dataarra... | [
"Sort",
"object",
"by",
"labels",
"or",
"values",
"(",
"along",
"an",
"axis",
")",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3851-L3910 | [
"def",
"sortby",
"(",
"self",
",",
"variables",
",",
"ascending",
"=",
"True",
")",
":",
"from",
".",
"dataarray",
"import",
"DataArray",
"if",
"not",
"isinstance",
"(",
"variables",
",",
"list",
")",
":",
"variables",
"=",
"[",
"variables",
"]",
"else",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.quantile | Compute the qth quantile of the data along the specified dimension.
Returns the qth quantiles(s) of the array elements for each variable
in the Dataset.
Parameters
----------
q : float in range of [0,1] (or sequence of floats)
Quantile to compute, which must be betw... | xarray/core/dataset.py | def quantile(self, q, dim=None, interpolation='linear',
numeric_only=False, keep_attrs=None):
"""Compute the qth quantile of the data along the specified dimension.
Returns the qth quantiles(s) of the array elements for each variable
in the Dataset.
Parameters
... | def quantile(self, q, dim=None, interpolation='linear',
numeric_only=False, keep_attrs=None):
"""Compute the qth quantile of the data along the specified dimension.
Returns the qth quantiles(s) of the array elements for each variable
in the Dataset.
Parameters
... | [
"Compute",
"the",
"qth",
"quantile",
"of",
"the",
"data",
"along",
"the",
"specified",
"dimension",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L3912-L3999 | [
"def",
"quantile",
"(",
"self",
",",
"q",
",",
"dim",
"=",
"None",
",",
"interpolation",
"=",
"'linear'",
",",
"numeric_only",
"=",
"False",
",",
"keep_attrs",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"dim",
",",
"str",
")",
":",
"dims",
"=",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.rank | Ranks the data.
Equal values are assigned a rank that is the average of the ranks that
would have been otherwise assigned to all of the values within
that set.
Ranks begin at 1, not 0. If pct is True, computes percentage ranks.
NaNs in the input array are returned as NaNs.
... | xarray/core/dataset.py | def rank(self, dim, pct=False, keep_attrs=None):
"""Ranks the data.
Equal values are assigned a rank that is the average of the ranks that
would have been otherwise assigned to all of the values within
that set.
Ranks begin at 1, not 0. If pct is True, computes percentage ranks.... | def rank(self, dim, pct=False, keep_attrs=None):
"""Ranks the data.
Equal values are assigned a rank that is the average of the ranks that
would have been otherwise assigned to all of the values within
that set.
Ranks begin at 1, not 0. If pct is True, computes percentage ranks.... | [
"Ranks",
"the",
"data",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L4001-L4045 | [
"def",
"rank",
"(",
"self",
",",
"dim",
",",
"pct",
"=",
"False",
",",
"keep_attrs",
"=",
"None",
")",
":",
"if",
"dim",
"not",
"in",
"self",
".",
"dims",
":",
"raise",
"ValueError",
"(",
"'Dataset does not contain the dimension: %s'",
"%",
"dim",
")",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.differentiate | Differentiate with the second order accurate central
differences.
.. note::
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.
Parameters
----------
coord: str
The coordinate to be used to compute the gr... | xarray/core/dataset.py | def differentiate(self, coord, edge_order=1, datetime_unit=None):
""" Differentiate with the second order accurate central
differences.
.. note::
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.
Parameters
-------... | def differentiate(self, coord, edge_order=1, datetime_unit=None):
""" Differentiate with the second order accurate central
differences.
.. note::
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.
Parameters
-------... | [
"Differentiate",
"with",
"the",
"second",
"order",
"accurate",
"central",
"differences",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L4047-L4103 | [
"def",
"differentiate",
"(",
"self",
",",
"coord",
",",
"edge_order",
"=",
"1",
",",
"datetime_unit",
"=",
"None",
")",
":",
"from",
".",
"variable",
"import",
"Variable",
"if",
"coord",
"not",
"in",
"self",
".",
"variables",
"and",
"coord",
"not",
"in",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.integrate | integrate the array with the trapezoidal rule.
.. note::
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.
Parameters
----------
dim: str, or a sequence of str
Coordinate(s) used for the integration.
da... | xarray/core/dataset.py | def integrate(self, coord, datetime_unit=None):
""" integrate the array with the trapezoidal rule.
.. note::
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.
Parameters
----------
dim: str, or a sequence of str
... | def integrate(self, coord, datetime_unit=None):
""" integrate the array with the trapezoidal rule.
.. note::
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.
Parameters
----------
dim: str, or a sequence of str
... | [
"integrate",
"the",
"array",
"with",
"the",
"trapezoidal",
"rule",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L4105-L4135 | [
"def",
"integrate",
"(",
"self",
",",
"coord",
",",
"datetime_unit",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"coord",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"coord",
"=",
"(",
"coord",
",",
")",
"result",
"=",
"self",
"for",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | Dataset.filter_by_attrs | Returns a ``Dataset`` with variables that match specific conditions.
Can pass in ``key=value`` or ``key=callable``. A Dataset is returned
containing only the variables for which all the filter tests pass.
These tests are either ``key=value`` for which the attribute ``key``
has the exac... | xarray/core/dataset.py | def filter_by_attrs(self, **kwargs):
"""Returns a ``Dataset`` with variables that match specific conditions.
Can pass in ``key=value`` or ``key=callable``. A Dataset is returned
containing only the variables for which all the filter tests pass.
These tests are either ``key=value`` for ... | def filter_by_attrs(self, **kwargs):
"""Returns a ``Dataset`` with variables that match specific conditions.
Can pass in ``key=value`` or ``key=callable``. A Dataset is returned
containing only the variables for which all the filter tests pass.
These tests are either ``key=value`` for ... | [
"Returns",
"a",
"Dataset",
"with",
"variables",
"that",
"match",
"specific",
"conditions",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L4187-L4278 | [
"def",
"filter_by_attrs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa",
"selection",
"=",
"[",
"]",
"for",
"var_name",
",",
"variable",
"in",
"self",
".",
"data_vars",
".",
"items",
"(",
")",
":",
"has_value_flag",
"=",
"False",
"for",
"att... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | lazy_elemwise_func | Lazily apply an element-wise function to an array.
Parameters
----------
array : any valid value of Variable._data
func : callable
Function to apply to indexed slices of an array. For use with dask,
this should be a pickle-able object.
dtype : coercible to np.dtype
Dtype for... | xarray/coding/variables.py | def lazy_elemwise_func(array, func, dtype):
"""Lazily apply an element-wise function to an array.
Parameters
----------
array : any valid value of Variable._data
func : callable
Function to apply to indexed slices of an array. For use with dask,
this should be a pickle-able object.
... | def lazy_elemwise_func(array, func, dtype):
"""Lazily apply an element-wise function to an array.
Parameters
----------
array : any valid value of Variable._data
func : callable
Function to apply to indexed slices of an array. For use with dask,
this should be a pickle-able object.
... | [
"Lazily",
"apply",
"an",
"element",
"-",
"wise",
"function",
"to",
"an",
"array",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/variables.py#L75-L94 | [
"def",
"lazy_elemwise_func",
"(",
"array",
",",
"func",
",",
"dtype",
")",
":",
"if",
"isinstance",
"(",
"array",
",",
"dask_array_type",
")",
":",
"return",
"array",
".",
"map_blocks",
"(",
"func",
",",
"dtype",
"=",
"dtype",
")",
"else",
":",
"return",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | pop_to | A convenience function which pops a key k from source to dest.
None values are not passed on. If k already exists in dest an
error is raised. | xarray/coding/variables.py | def pop_to(source, dest, key, name=None):
"""
A convenience function which pops a key k from source to dest.
None values are not passed on. If k already exists in dest an
error is raised.
"""
value = source.pop(key, None)
if value is not None:
safe_setitem(dest, key, value, name=nam... | def pop_to(source, dest, key, name=None):
"""
A convenience function which pops a key k from source to dest.
None values are not passed on. If k already exists in dest an
error is raised.
"""
value = source.pop(key, None)
if value is not None:
safe_setitem(dest, key, value, name=nam... | [
"A",
"convenience",
"function",
"which",
"pops",
"a",
"key",
"k",
"from",
"source",
"to",
"dest",
".",
"None",
"values",
"are",
"not",
"passed",
"on",
".",
"If",
"k",
"already",
"exists",
"in",
"dest",
"an",
"error",
"is",
"raised",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/variables.py#L116-L125 | [
"def",
"pop_to",
"(",
"source",
",",
"dest",
",",
"key",
",",
"name",
"=",
"None",
")",
":",
"value",
"=",
"source",
".",
"pop",
"(",
"key",
",",
"None",
")",
"if",
"value",
"is",
"not",
"None",
":",
"safe_setitem",
"(",
"dest",
",",
"key",
",",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _apply_mask | Mask all matching values in a NumPy arrays. | xarray/coding/variables.py | def _apply_mask(
data: np.ndarray,
encoded_fill_values: list,
decoded_fill_value: Any,
dtype: Any,
) -> np.ndarray:
"""Mask all matching values in a NumPy arrays."""
data = np.asarray(data, dtype=dtype)
condition = False
for fv in encoded_fill_values:
condition |= data == fv
... | def _apply_mask(
data: np.ndarray,
encoded_fill_values: list,
decoded_fill_value: Any,
dtype: Any,
) -> np.ndarray:
"""Mask all matching values in a NumPy arrays."""
data = np.asarray(data, dtype=dtype)
condition = False
for fv in encoded_fill_values:
condition |= data == fv
... | [
"Mask",
"all",
"matching",
"values",
"in",
"a",
"NumPy",
"arrays",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/variables.py#L128-L139 | [
"def",
"_apply_mask",
"(",
"data",
":",
"np",
".",
"ndarray",
",",
"encoded_fill_values",
":",
"list",
",",
"decoded_fill_value",
":",
"Any",
",",
"dtype",
":",
"Any",
",",
")",
"->",
"np",
".",
"ndarray",
":",
"data",
"=",
"np",
".",
"asarray",
"(",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _choose_float_dtype | Return a float dtype that can losslessly represent `dtype` values. | xarray/coding/variables.py | def _choose_float_dtype(dtype, has_offset):
"""Return a float dtype that can losslessly represent `dtype` values."""
# Keep float32 as-is. Upcast half-precision to single-precision,
# because float16 is "intended for storage but not computation"
if dtype.itemsize <= 4 and np.issubdtype(dtype, np.floati... | def _choose_float_dtype(dtype, has_offset):
"""Return a float dtype that can losslessly represent `dtype` values."""
# Keep float32 as-is. Upcast half-precision to single-precision,
# because float16 is "intended for storage but not computation"
if dtype.itemsize <= 4 and np.issubdtype(dtype, np.floati... | [
"Return",
"a",
"float",
"dtype",
"that",
"can",
"losslessly",
"represent",
"dtype",
"values",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/variables.py#L192-L208 | [
"def",
"_choose_float_dtype",
"(",
"dtype",
",",
"has_offset",
")",
":",
"# Keep float32 as-is. Upcast half-precision to single-precision,",
"# because float16 is \"intended for storage but not computation\"",
"if",
"dtype",
".",
"itemsize",
"<=",
"4",
"and",
"np",
".",
"issub... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _apply_over_vars_with_dim | wrapper for datasets | xarray/core/missing.py | def _apply_over_vars_with_dim(func, self, dim=None, **kwargs):
'''wrapper for datasets'''
ds = type(self)(coords=self.coords, attrs=self.attrs)
for name, var in self.data_vars.items():
if dim in var.dims:
ds[name] = func(var, dim=dim, **kwargs)
else:
ds[name] = var
... | def _apply_over_vars_with_dim(func, self, dim=None, **kwargs):
'''wrapper for datasets'''
ds = type(self)(coords=self.coords, attrs=self.attrs)
for name, var in self.data_vars.items():
if dim in var.dims:
ds[name] = func(var, dim=dim, **kwargs)
else:
ds[name] = var
... | [
"wrapper",
"for",
"datasets"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L142-L153 | [
"def",
"_apply_over_vars_with_dim",
"(",
"func",
",",
"self",
",",
"dim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ds",
"=",
"type",
"(",
"self",
")",
"(",
"coords",
"=",
"self",
".",
"coords",
",",
"attrs",
"=",
"self",
".",
"attrs",
")",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | get_clean_interp_index | get index to use for x values in interpolation.
If use_coordinate is True, the coordinate that shares the name of the
dimension along which interpolation is being performed will be used as the
x values.
If use_coordinate is False, the x values are set as an equally spaced
sequence. | xarray/core/missing.py | def get_clean_interp_index(arr, dim, use_coordinate=True, **kwargs):
'''get index to use for x values in interpolation.
If use_coordinate is True, the coordinate that shares the name of the
dimension along which interpolation is being performed will be used as the
x values.
If use_coordinate is Fa... | def get_clean_interp_index(arr, dim, use_coordinate=True, **kwargs):
'''get index to use for x values in interpolation.
If use_coordinate is True, the coordinate that shares the name of the
dimension along which interpolation is being performed will be used as the
x values.
If use_coordinate is Fa... | [
"get",
"index",
"to",
"use",
"for",
"x",
"values",
"in",
"interpolation",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L156-L191 | [
"def",
"get_clean_interp_index",
"(",
"arr",
",",
"dim",
",",
"use_coordinate",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"use_coordinate",
":",
"if",
"use_coordinate",
"is",
"True",
":",
"index",
"=",
"arr",
".",
"get_index",
"(",
"dim",
")"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | interp_na | Interpolate values according to different methods. | xarray/core/missing.py | def interp_na(self, dim=None, use_coordinate=True, method='linear', limit=None,
**kwargs):
'''Interpolate values according to different methods.'''
if dim is None:
raise NotImplementedError('dim is a required argument')
if limit is not None:
valids = _get_valid_fill_mask(self... | def interp_na(self, dim=None, use_coordinate=True, method='linear', limit=None,
**kwargs):
'''Interpolate values according to different methods.'''
if dim is None:
raise NotImplementedError('dim is a required argument')
if limit is not None:
valids = _get_valid_fill_mask(self... | [
"Interpolate",
"values",
"according",
"to",
"different",
"methods",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L194-L224 | [
"def",
"interp_na",
"(",
"self",
",",
"dim",
"=",
"None",
",",
"use_coordinate",
"=",
"True",
",",
"method",
"=",
"'linear'",
",",
"limit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dim",
"is",
"None",
":",
"raise",
"NotImplementedError",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | func_interpolate_na | helper function to apply interpolation along 1 dimension | xarray/core/missing.py | def func_interpolate_na(interpolator, x, y, **kwargs):
'''helper function to apply interpolation along 1 dimension'''
# it would be nice if this wasn't necessary, works around:
# "ValueError: assignment destination is read-only" in assignment below
out = y.copy()
nans = pd.isnull(y)
nonans = ~n... | def func_interpolate_na(interpolator, x, y, **kwargs):
'''helper function to apply interpolation along 1 dimension'''
# it would be nice if this wasn't necessary, works around:
# "ValueError: assignment destination is read-only" in assignment below
out = y.copy()
nans = pd.isnull(y)
nonans = ~n... | [
"helper",
"function",
"to",
"apply",
"interpolation",
"along",
"1",
"dimension"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L227-L243 | [
"def",
"func_interpolate_na",
"(",
"interpolator",
",",
"x",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"# it would be nice if this wasn't necessary, works around:",
"# \"ValueError: assignment destination is read-only\" in assignment below",
"out",
"=",
"y",
".",
"copy",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _bfill | inverse of ffill | xarray/core/missing.py | def _bfill(arr, n=None, axis=-1):
'''inverse of ffill'''
import bottleneck as bn
arr = np.flip(arr, axis=axis)
# fill
arr = bn.push(arr, axis=axis, n=n)
# reverse back to original
return np.flip(arr, axis=axis) | def _bfill(arr, n=None, axis=-1):
'''inverse of ffill'''
import bottleneck as bn
arr = np.flip(arr, axis=axis)
# fill
arr = bn.push(arr, axis=axis, n=n)
# reverse back to original
return np.flip(arr, axis=axis) | [
"inverse",
"of",
"ffill"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L246-L256 | [
"def",
"_bfill",
"(",
"arr",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
")",
":",
"import",
"bottleneck",
"as",
"bn",
"arr",
"=",
"np",
".",
"flip",
"(",
"arr",
",",
"axis",
"=",
"axis",
")",
"# fill",
"arr",
"=",
"bn",
".",
"push",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | ffill | forward fill missing values | xarray/core/missing.py | def ffill(arr, dim=None, limit=None):
'''forward fill missing values'''
import bottleneck as bn
axis = arr.get_axis_num(dim)
# work around for bottleneck 178
_limit = limit if limit is not None else arr.shape[axis]
return apply_ufunc(bn.push, arr,
dask='parallelized',
... | def ffill(arr, dim=None, limit=None):
'''forward fill missing values'''
import bottleneck as bn
axis = arr.get_axis_num(dim)
# work around for bottleneck 178
_limit = limit if limit is not None else arr.shape[axis]
return apply_ufunc(bn.push, arr,
dask='parallelized',
... | [
"forward",
"fill",
"missing",
"values"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L259-L272 | [
"def",
"ffill",
"(",
"arr",
",",
"dim",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"import",
"bottleneck",
"as",
"bn",
"axis",
"=",
"arr",
".",
"get_axis_num",
"(",
"dim",
")",
"# work around for bottleneck 178",
"_limit",
"=",
"limit",
"if",
"lim... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | bfill | backfill missing values | xarray/core/missing.py | def bfill(arr, dim=None, limit=None):
'''backfill missing values'''
axis = arr.get_axis_num(dim)
# work around for bottleneck 178
_limit = limit if limit is not None else arr.shape[axis]
return apply_ufunc(_bfill, arr,
dask='parallelized',
keep_attrs=T... | def bfill(arr, dim=None, limit=None):
'''backfill missing values'''
axis = arr.get_axis_num(dim)
# work around for bottleneck 178
_limit = limit if limit is not None else arr.shape[axis]
return apply_ufunc(_bfill, arr,
dask='parallelized',
keep_attrs=T... | [
"backfill",
"missing",
"values"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L275-L286 | [
"def",
"bfill",
"(",
"arr",
",",
"dim",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"axis",
"=",
"arr",
".",
"get_axis_num",
"(",
"dim",
")",
"# work around for bottleneck 178",
"_limit",
"=",
"limit",
"if",
"limit",
"is",
"not",
"None",
"else",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _get_interpolator | helper function to select the appropriate interpolator class
returns interpolator class and keyword arguments for the class | xarray/core/missing.py | def _get_interpolator(method, vectorizeable_only=False, **kwargs):
'''helper function to select the appropriate interpolator class
returns interpolator class and keyword arguments for the class
'''
interp1d_methods = ['linear', 'nearest', 'zero', 'slinear', 'quadratic',
'cubic',... | def _get_interpolator(method, vectorizeable_only=False, **kwargs):
'''helper function to select the appropriate interpolator class
returns interpolator class and keyword arguments for the class
'''
interp1d_methods = ['linear', 'nearest', 'zero', 'slinear', 'quadratic',
'cubic',... | [
"helper",
"function",
"to",
"select",
"the",
"appropriate",
"interpolator",
"class"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L289-L340 | [
"def",
"_get_interpolator",
"(",
"method",
",",
"vectorizeable_only",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"interp1d_methods",
"=",
"[",
"'linear'",
",",
"'nearest'",
",",
"'zero'",
",",
"'slinear'",
",",
"'quadratic'",
",",
"'cubic'",
",",
"'pol... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _get_interpolator_nd | helper function to select the appropriate interpolator class
returns interpolator class and keyword arguments for the class | xarray/core/missing.py | def _get_interpolator_nd(method, **kwargs):
'''helper function to select the appropriate interpolator class
returns interpolator class and keyword arguments for the class
'''
valid_methods = ['linear', 'nearest']
try:
from scipy import interpolate
except ImportError:
raise Impo... | def _get_interpolator_nd(method, **kwargs):
'''helper function to select the appropriate interpolator class
returns interpolator class and keyword arguments for the class
'''
valid_methods = ['linear', 'nearest']
try:
from scipy import interpolate
except ImportError:
raise Impo... | [
"helper",
"function",
"to",
"select",
"the",
"appropriate",
"interpolator",
"class"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L343-L363 | [
"def",
"_get_interpolator_nd",
"(",
"method",
",",
"*",
"*",
"kwargs",
")",
":",
"valid_methods",
"=",
"[",
"'linear'",
",",
"'nearest'",
"]",
"try",
":",
"from",
"scipy",
"import",
"interpolate",
"except",
"ImportError",
":",
"raise",
"ImportError",
"(",
"'... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _get_valid_fill_mask | helper function to determine values that can be filled when limit is not
None | xarray/core/missing.py | def _get_valid_fill_mask(arr, dim, limit):
'''helper function to determine values that can be filled when limit is not
None'''
kw = {dim: limit + 1}
# we explicitly use construct method to avoid copy.
new_dim = utils.get_temp_dimname(arr.dims, '_window')
return (arr.isnull().rolling(min_periods=... | def _get_valid_fill_mask(arr, dim, limit):
'''helper function to determine values that can be filled when limit is not
None'''
kw = {dim: limit + 1}
# we explicitly use construct method to avoid copy.
new_dim = utils.get_temp_dimname(arr.dims, '_window')
return (arr.isnull().rolling(min_periods=... | [
"helper",
"function",
"to",
"determine",
"values",
"that",
"can",
"be",
"filled",
"when",
"limit",
"is",
"not",
"None"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L366-L374 | [
"def",
"_get_valid_fill_mask",
"(",
"arr",
",",
"dim",
",",
"limit",
")",
":",
"kw",
"=",
"{",
"dim",
":",
"limit",
"+",
"1",
"}",
"# we explicitly use construct method to avoid copy.",
"new_dim",
"=",
"utils",
".",
"get_temp_dimname",
"(",
"arr",
".",
"dims",... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _localize | Speed up for linear and nearest neighbor method.
Only consider a subspace that is needed for the interpolation | xarray/core/missing.py | def _localize(var, indexes_coords):
""" Speed up for linear and nearest neighbor method.
Only consider a subspace that is needed for the interpolation
"""
indexes = {}
for dim, [x, new_x] in indexes_coords.items():
index = x.to_index()
imin = index.get_loc(np.min(new_x.values), metho... | def _localize(var, indexes_coords):
""" Speed up for linear and nearest neighbor method.
Only consider a subspace that is needed for the interpolation
"""
indexes = {}
for dim, [x, new_x] in indexes_coords.items():
index = x.to_index()
imin = index.get_loc(np.min(new_x.values), metho... | [
"Speed",
"up",
"for",
"linear",
"and",
"nearest",
"neighbor",
"method",
".",
"Only",
"consider",
"a",
"subspace",
"that",
"is",
"needed",
"for",
"the",
"interpolation"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L385-L397 | [
"def",
"_localize",
"(",
"var",
",",
"indexes_coords",
")",
":",
"indexes",
"=",
"{",
"}",
"for",
"dim",
",",
"[",
"x",
",",
"new_x",
"]",
"in",
"indexes_coords",
".",
"items",
"(",
")",
":",
"index",
"=",
"x",
".",
"to_index",
"(",
")",
"imin",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _floatize_x | Make x and new_x float.
This is particulary useful for datetime dtype.
x, new_x: tuple of np.ndarray | xarray/core/missing.py | def _floatize_x(x, new_x):
""" Make x and new_x float.
This is particulary useful for datetime dtype.
x, new_x: tuple of np.ndarray
"""
x = list(x)
new_x = list(new_x)
for i in range(len(x)):
if _contains_datetime_like_objects(x[i]):
# Scipy casts coordinates to np.float6... | def _floatize_x(x, new_x):
""" Make x and new_x float.
This is particulary useful for datetime dtype.
x, new_x: tuple of np.ndarray
"""
x = list(x)
new_x = list(new_x)
for i in range(len(x)):
if _contains_datetime_like_objects(x[i]):
# Scipy casts coordinates to np.float6... | [
"Make",
"x",
"and",
"new_x",
"float",
".",
"This",
"is",
"particulary",
"useful",
"for",
"datetime",
"dtype",
".",
"x",
"new_x",
":",
"tuple",
"of",
"np",
".",
"ndarray"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L400-L417 | [
"def",
"_floatize_x",
"(",
"x",
",",
"new_x",
")",
":",
"x",
"=",
"list",
"(",
"x",
")",
"new_x",
"=",
"list",
"(",
"new_x",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"x",
")",
")",
":",
"if",
"_contains_datetime_like_objects",
"(",
"x",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | interp | 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.... | xarray/core/missing.py | 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.
... | 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.
... | [
"Make",
"an",
"interpolation",
"of",
"Variable"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L420-L477 | [
"def",
"interp",
"(",
"var",
",",
"indexes_coords",
",",
"method",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"indexes_coords",
":",
"return",
"var",
".",
"copy",
"(",
")",
"# simple speed up for the local interpolation",
"if",
"method",
"in",
"[",
"'li... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | interp_func | multi-dimensional interpolation for array-like. Interpolated axes should be
located in the last position.
Parameters
----------
var: np.ndarray or dask.array.Array
Array to be interpolated. The final dimension is interpolated.
x: a list of 1d array.
Original coordinates. Should not ... | xarray/core/missing.py | def interp_func(var, x, new_x, method, kwargs):
"""
multi-dimensional interpolation for array-like. Interpolated axes should be
located in the last position.
Parameters
----------
var: np.ndarray or dask.array.Array
Array to be interpolated. The final dimension is interpolated.
x: a... | def interp_func(var, x, new_x, method, kwargs):
"""
multi-dimensional interpolation for array-like. Interpolated axes should be
located in the last position.
Parameters
----------
var: np.ndarray or dask.array.Array
Array to be interpolated. The final dimension is interpolated.
x: a... | [
"multi",
"-",
"dimensional",
"interpolation",
"for",
"array",
"-",
"like",
".",
"Interpolated",
"axes",
"should",
"be",
"located",
"in",
"the",
"last",
"position",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/missing.py#L480-L533 | [
"def",
"interp_func",
"(",
"var",
",",
"x",
",",
"new_x",
",",
"method",
",",
"kwargs",
")",
":",
"if",
"not",
"x",
":",
"return",
"var",
".",
"copy",
"(",
")",
"if",
"len",
"(",
"x",
")",
"==",
"1",
":",
"func",
",",
"kwargs",
"=",
"_get_inter... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _nicetitle | Put coord, value in template and truncate at maxchar | xarray/plot/facetgrid.py | def _nicetitle(coord, value, maxchar, template):
"""
Put coord, value in template and truncate at maxchar
"""
prettyvalue = format_item(value, quote_strings=False)
title = template.format(coord=coord, value=prettyvalue)
if len(title) > maxchar:
title = title[:(maxchar - 3)] + '...'
... | def _nicetitle(coord, value, maxchar, template):
"""
Put coord, value in template and truncate at maxchar
"""
prettyvalue = format_item(value, quote_strings=False)
title = template.format(coord=coord, value=prettyvalue)
if len(title) > maxchar:
title = title[:(maxchar - 3)] + '...'
... | [
"Put",
"coord",
"value",
"in",
"template",
"and",
"truncate",
"at",
"maxchar"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L20-L30 | [
"def",
"_nicetitle",
"(",
"coord",
",",
"value",
",",
"maxchar",
",",
"template",
")",
":",
"prettyvalue",
"=",
"format_item",
"(",
"value",
",",
"quote_strings",
"=",
"False",
")",
"title",
"=",
"template",
".",
"format",
"(",
"coord",
"=",
"coord",
","... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _easy_facetgrid | Convenience method to call xarray.plot.FacetGrid from 2d plotting methods
kwargs are the arguments to 2d plotting method | xarray/plot/facetgrid.py | def _easy_facetgrid(data, plotfunc, kind, x=None, y=None, row=None,
col=None, col_wrap=None, sharex=True, sharey=True,
aspect=None, size=None, subplot_kws=None, **kwargs):
"""
Convenience method to call xarray.plot.FacetGrid from 2d plotting methods
kwargs are the ar... | def _easy_facetgrid(data, plotfunc, kind, x=None, y=None, row=None,
col=None, col_wrap=None, sharex=True, sharey=True,
aspect=None, size=None, subplot_kws=None, **kwargs):
"""
Convenience method to call xarray.plot.FacetGrid from 2d plotting methods
kwargs are the ar... | [
"Convenience",
"method",
"to",
"call",
"xarray",
".",
"plot",
".",
"FacetGrid",
"from",
"2d",
"plotting",
"methods"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L494-L521 | [
"def",
"_easy_facetgrid",
"(",
"data",
",",
"plotfunc",
",",
"kind",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
",",
"col_wrap",
"=",
"None",
",",
"sharex",
"=",
"True",
",",
"sharey",
"=",
"Tr... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.map_dataarray | Apply a plotting function to a 2d facet's subset of the data.
This is more convenient and less general than ``FacetGrid.map``
Parameters
----------
func : callable
A plotting function with the same signature as a 2d xarray
plotting method such as `xarray.plot.im... | xarray/plot/facetgrid.py | def map_dataarray(self, func, x, y, **kwargs):
"""
Apply a plotting function to a 2d facet's subset of the data.
This is more convenient and less general than ``FacetGrid.map``
Parameters
----------
func : callable
A plotting function with the same signature... | def map_dataarray(self, func, x, y, **kwargs):
"""
Apply a plotting function to a 2d facet's subset of the data.
This is more convenient and less general than ``FacetGrid.map``
Parameters
----------
func : callable
A plotting function with the same signature... | [
"Apply",
"a",
"plotting",
"function",
"to",
"a",
"2d",
"facet",
"s",
"subset",
"of",
"the",
"data",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L200-L253 | [
"def",
"map_dataarray",
"(",
"self",
",",
"func",
",",
"x",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"'cbar_ax'",
",",
"None",
")",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"'cbar_ax not supported by Fa... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid._finalize_grid | Finalize the annotations and layout. | xarray/plot/facetgrid.py | def _finalize_grid(self, *axlabels):
"""Finalize the annotations and layout."""
if not self._finalized:
self.set_axis_labels(*axlabels)
self.set_titles()
self.fig.tight_layout()
for ax, namedict in zip(self.axes.flat, self.name_dicts.flat):
... | def _finalize_grid(self, *axlabels):
"""Finalize the annotations and layout."""
if not self._finalized:
self.set_axis_labels(*axlabels)
self.set_titles()
self.fig.tight_layout()
for ax, namedict in zip(self.axes.flat, self.name_dicts.flat):
... | [
"Finalize",
"the",
"annotations",
"and",
"layout",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L283-L294 | [
"def",
"_finalize_grid",
"(",
"self",
",",
"*",
"axlabels",
")",
":",
"if",
"not",
"self",
".",
"_finalized",
":",
"self",
".",
"set_axis_labels",
"(",
"*",
"axlabels",
")",
"self",
".",
"set_titles",
"(",
")",
"self",
".",
"fig",
".",
"tight_layout",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.add_colorbar | Draw a colorbar | xarray/plot/facetgrid.py | def add_colorbar(self, **kwargs):
"""Draw a colorbar
"""
kwargs = kwargs.copy()
if self._cmap_extend is not None:
kwargs.setdefault('extend', self._cmap_extend)
if 'label' not in kwargs:
kwargs.setdefault('label', label_from_attrs(self.data))
self.... | def add_colorbar(self, **kwargs):
"""Draw a colorbar
"""
kwargs = kwargs.copy()
if self._cmap_extend is not None:
kwargs.setdefault('extend', self._cmap_extend)
if 'label' not in kwargs:
kwargs.setdefault('label', label_from_attrs(self.data))
self.... | [
"Draw",
"a",
"colorbar"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L324-L335 | [
"def",
"add_colorbar",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"kwargs",
".",
"copy",
"(",
")",
"if",
"self",
".",
"_cmap_extend",
"is",
"not",
"None",
":",
"kwargs",
".",
"setdefault",
"(",
"'extend'",
",",
"self",
".",
"_cmap... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.set_axis_labels | Set axis labels on the left column and bottom row of the grid. | xarray/plot/facetgrid.py | def set_axis_labels(self, x_var=None, y_var=None):
"""Set axis labels on the left column and bottom row of the grid."""
if x_var is not None:
if x_var in self.data.coords:
self._x_var = x_var
self.set_xlabels(label_from_attrs(self.data[x_var]))
els... | def set_axis_labels(self, x_var=None, y_var=None):
"""Set axis labels on the left column and bottom row of the grid."""
if x_var is not None:
if x_var in self.data.coords:
self._x_var = x_var
self.set_xlabels(label_from_attrs(self.data[x_var]))
els... | [
"Set",
"axis",
"labels",
"on",
"the",
"left",
"column",
"and",
"bottom",
"row",
"of",
"the",
"grid",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L337-L353 | [
"def",
"set_axis_labels",
"(",
"self",
",",
"x_var",
"=",
"None",
",",
"y_var",
"=",
"None",
")",
":",
"if",
"x_var",
"is",
"not",
"None",
":",
"if",
"x_var",
"in",
"self",
".",
"data",
".",
"coords",
":",
"self",
".",
"_x_var",
"=",
"x_var",
"self... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.set_xlabels | Label the x axis on the bottom row of the grid. | xarray/plot/facetgrid.py | def set_xlabels(self, label=None, **kwargs):
"""Label the x axis on the bottom row of the grid."""
if label is None:
label = label_from_attrs(self.data[self._x_var])
for ax in self._bottom_axes:
ax.set_xlabel(label, **kwargs)
return self | def set_xlabels(self, label=None, **kwargs):
"""Label the x axis on the bottom row of the grid."""
if label is None:
label = label_from_attrs(self.data[self._x_var])
for ax in self._bottom_axes:
ax.set_xlabel(label, **kwargs)
return self | [
"Label",
"the",
"x",
"axis",
"on",
"the",
"bottom",
"row",
"of",
"the",
"grid",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L355-L361 | [
"def",
"set_xlabels",
"(",
"self",
",",
"label",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"label",
"is",
"None",
":",
"label",
"=",
"label_from_attrs",
"(",
"self",
".",
"data",
"[",
"self",
".",
"_x_var",
"]",
")",
"for",
"ax",
"in",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.set_ylabels | Label the y axis on the left column of the grid. | xarray/plot/facetgrid.py | def set_ylabels(self, label=None, **kwargs):
"""Label the y axis on the left column of the grid."""
if label is None:
label = label_from_attrs(self.data[self._y_var])
for ax in self._left_axes:
ax.set_ylabel(label, **kwargs)
return self | def set_ylabels(self, label=None, **kwargs):
"""Label the y axis on the left column of the grid."""
if label is None:
label = label_from_attrs(self.data[self._y_var])
for ax in self._left_axes:
ax.set_ylabel(label, **kwargs)
return self | [
"Label",
"the",
"y",
"axis",
"on",
"the",
"left",
"column",
"of",
"the",
"grid",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L363-L369 | [
"def",
"set_ylabels",
"(",
"self",
",",
"label",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"label",
"is",
"None",
":",
"label",
"=",
"label_from_attrs",
"(",
"self",
".",
"data",
"[",
"self",
".",
"_y_var",
"]",
")",
"for",
"ax",
"in",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.set_titles | Draw titles either above each facet or on the grid margins.
Parameters
----------
template : string
Template for plot titles containing {coord} and {value}
maxchar : int
Truncate titles at maxchar
kwargs : keyword args
additional arguments to ... | xarray/plot/facetgrid.py | def set_titles(self, template="{coord} = {value}", maxchar=30,
**kwargs):
"""
Draw titles either above each facet or on the grid margins.
Parameters
----------
template : string
Template for plot titles containing {coord} and {value}
maxcha... | def set_titles(self, template="{coord} = {value}", maxchar=30,
**kwargs):
"""
Draw titles either above each facet or on the grid margins.
Parameters
----------
template : string
Template for plot titles containing {coord} and {value}
maxcha... | [
"Draw",
"titles",
"either",
"above",
"each",
"facet",
"or",
"on",
"the",
"grid",
"margins",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L371-L418 | [
"def",
"set_titles",
"(",
"self",
",",
"template",
"=",
"\"{coord} = {value}\"",
",",
"maxchar",
"=",
"30",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
"as",
"mpl",
"kwargs",
"[",
"\"size\"",
"]",
"=",
"kwargs",
".",
"pop",
"(",
"\"size\""... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.set_ticks | Set and control tick behavior
Parameters
----------
max_xticks, max_yticks : int, optional
Maximum number of labeled ticks to plot on x, y axes
fontsize : string or int
Font size as used by matplotlib text
Returns
-------
self : FacetGrid... | xarray/plot/facetgrid.py | def set_ticks(self, max_xticks=_NTICKS, max_yticks=_NTICKS,
fontsize=_FONTSIZE):
"""
Set and control tick behavior
Parameters
----------
max_xticks, max_yticks : int, optional
Maximum number of labeled ticks to plot on x, y axes
fontsize : s... | def set_ticks(self, max_xticks=_NTICKS, max_yticks=_NTICKS,
fontsize=_FONTSIZE):
"""
Set and control tick behavior
Parameters
----------
max_xticks, max_yticks : int, optional
Maximum number of labeled ticks to plot on x, y axes
fontsize : s... | [
"Set",
"and",
"control",
"tick",
"behavior"
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L420-L450 | [
"def",
"set_ticks",
"(",
"self",
",",
"max_xticks",
"=",
"_NTICKS",
",",
"max_yticks",
"=",
"_NTICKS",
",",
"fontsize",
"=",
"_FONTSIZE",
")",
":",
"from",
"matplotlib",
".",
"ticker",
"import",
"MaxNLocator",
"# Both are necessary",
"x_major_locator",
"=",
"Max... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | FacetGrid.map | Apply a plotting function to each facet's subset of the data.
Parameters
----------
func : callable
A plotting function that takes data and keyword arguments. It
must plot to the currently active matplotlib Axes and take a
`color` keyword argument. If facetin... | xarray/plot/facetgrid.py | def map(self, func, *args, **kwargs):
"""
Apply a plotting function to each facet's subset of the data.
Parameters
----------
func : callable
A plotting function that takes data and keyword arguments. It
must plot to the currently active matplotlib Axes a... | def map(self, func, *args, **kwargs):
"""
Apply a plotting function to each facet's subset of the data.
Parameters
----------
func : callable
A plotting function that takes data and keyword arguments. It
must plot to the currently active matplotlib Axes a... | [
"Apply",
"a",
"plotting",
"function",
"to",
"each",
"facet",
"s",
"subset",
"of",
"the",
"data",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/plot/facetgrid.py#L452-L491 | [
"def",
"map",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
"=",
"import_matplotlib_pyplot",
"(",
")",
"for",
"ax",
",",
"namedict",
"in",
"zip",
"(",
"self",
".",
"axes",
".",
"flat",
",",
"self",
".",
"na... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _get_time_bins | Obtain the bins and their respective labels for resampling operations.
Parameters
----------
index : CFTimeIndex
Index object to be resampled (e.g., CFTimeIndex named 'time').
freq : xarray.coding.cftime_offsets.BaseCFTimeOffset
The offset object representing target conversion a.k.a. re... | xarray/core/resample_cftime.py | def _get_time_bins(index, freq, closed, label, base):
"""Obtain the bins and their respective labels for resampling operations.
Parameters
----------
index : CFTimeIndex
Index object to be resampled (e.g., CFTimeIndex named 'time').
freq : xarray.coding.cftime_offsets.BaseCFTimeOffset
... | def _get_time_bins(index, freq, closed, label, base):
"""Obtain the bins and their respective labels for resampling operations.
Parameters
----------
index : CFTimeIndex
Index object to be resampled (e.g., CFTimeIndex named 'time').
freq : xarray.coding.cftime_offsets.BaseCFTimeOffset
... | [
"Obtain",
"the",
"bins",
"and",
"their",
"respective",
"labels",
"for",
"resampling",
"operations",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/resample_cftime.py#L104-L164 | [
"def",
"_get_time_bins",
"(",
"index",
",",
"freq",
",",
"closed",
",",
"label",
",",
"base",
")",
":",
"if",
"not",
"isinstance",
"(",
"index",
",",
"CFTimeIndex",
")",
":",
"raise",
"TypeError",
"(",
"'index must be a CFTimeIndex, but got '",
"'an instance of ... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _adjust_bin_edges | This is required for determining the bin edges resampling with
daily frequencies greater than one day, month end, and year end
frequencies.
Consider the following example. Let's say you want to downsample the
time series with the following coordinates to month end frequency:
CFTimeIndex([2000-01-... | xarray/core/resample_cftime.py | def _adjust_bin_edges(datetime_bins, offset, closed, index, labels):
"""This is required for determining the bin edges resampling with
daily frequencies greater than one day, month end, and year end
frequencies.
Consider the following example. Let's say you want to downsample the
time series with ... | def _adjust_bin_edges(datetime_bins, offset, closed, index, labels):
"""This is required for determining the bin edges resampling with
daily frequencies greater than one day, month end, and year end
frequencies.
Consider the following example. Let's say you want to downsample the
time series with ... | [
"This",
"is",
"required",
"for",
"determining",
"the",
"bin",
"edges",
"resampling",
"with",
"daily",
"frequencies",
"greater",
"than",
"one",
"day",
"month",
"end",
"and",
"year",
"end",
"frequencies",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/resample_cftime.py#L167-L212 | [
"def",
"_adjust_bin_edges",
"(",
"datetime_bins",
",",
"offset",
",",
"closed",
",",
"index",
",",
"labels",
")",
":",
"is_super_daily",
"=",
"(",
"isinstance",
"(",
"offset",
",",
"(",
"MonthEnd",
",",
"QuarterEnd",
",",
"YearEnd",
")",
")",
"or",
"(",
... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _get_range_edges | Get the correct starting and ending datetimes for the resampled
CFTimeIndex range.
Parameters
----------
first : cftime.datetime
Uncorrected starting datetime object for resampled CFTimeIndex range.
Usually the min of the original CFTimeIndex.
last : cftime.datetime
Uncorrec... | xarray/core/resample_cftime.py | def _get_range_edges(first, last, offset, closed='left', base=0):
""" Get the correct starting and ending datetimes for the resampled
CFTimeIndex range.
Parameters
----------
first : cftime.datetime
Uncorrected starting datetime object for resampled CFTimeIndex range.
Usually the mi... | def _get_range_edges(first, last, offset, closed='left', base=0):
""" Get the correct starting and ending datetimes for the resampled
CFTimeIndex range.
Parameters
----------
first : cftime.datetime
Uncorrected starting datetime object for resampled CFTimeIndex range.
Usually the mi... | [
"Get",
"the",
"correct",
"starting",
"and",
"ending",
"datetimes",
"for",
"the",
"resampled",
"CFTimeIndex",
"range",
"."
] | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/resample_cftime.py#L215-L259 | [
"def",
"_get_range_edges",
"(",
"first",
",",
"last",
",",
"offset",
",",
"closed",
"=",
"'left'",
",",
"base",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"offset",
",",
"CFTIME_TICKS",
")",
":",
"first",
",",
"last",
"=",
"_adjust_dates_anchored",
"("... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
train | _adjust_dates_anchored | First and last offsets should be calculated from the start day to fix
an error cause by resampling across multiple days when a one day period is
not a multiple of the frequency.
See https://github.com/pandas-dev/pandas/issues/8683
Parameters
----------
first : cftime.datetime
A datetime... | xarray/core/resample_cftime.py | def _adjust_dates_anchored(first, last, offset, closed='right', base=0):
""" First and last offsets should be calculated from the start day to fix
an error cause by resampling across multiple days when a one day period is
not a multiple of the frequency.
See https://github.com/pandas-dev/pandas/issues/8... | def _adjust_dates_anchored(first, last, offset, closed='right', base=0):
""" First and last offsets should be calculated from the start day to fix
an error cause by resampling across multiple days when a one day period is
not a multiple of the frequency.
See https://github.com/pandas-dev/pandas/issues/8... | [
"First",
"and",
"last",
"offsets",
"should",
"be",
"calculated",
"from",
"the",
"start",
"day",
"to",
"fix",
"an",
"error",
"cause",
"by",
"resampling",
"across",
"multiple",
"days",
"when",
"a",
"one",
"day",
"period",
"is",
"not",
"a",
"multiple",
"of",
... | pydata/xarray | python | https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/resample_cftime.py#L262-L323 | [
"def",
"_adjust_dates_anchored",
"(",
"first",
",",
"last",
",",
"offset",
",",
"closed",
"=",
"'right'",
",",
"base",
"=",
"0",
")",
":",
"base",
"=",
"base",
"%",
"offset",
".",
"n",
"start_day",
"=",
"normalize_date",
"(",
"first",
")",
"base_td",
"... | 6d93a95d05bdbfc33fff24064f67d29dd891ab58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.