repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
pydata/xarray
xarray/core/utils.py
update_safety_check
def update_safety_check(first_dict: MutableMapping[K, V], second_dict: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent) -> None: """Check the safety of updating one dictionary with another. Raises ValueError if dictionaries have non-compatible values f...
python
def update_safety_check(first_dict: MutableMapping[K, V], second_dict: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent) -> None: """Check the safety of updating one dictionary with another. Raises ValueError if dictionaries have non-compatible values f...
[ "def", "update_safety_check", "(", "first_dict", ":", "MutableMapping", "[", "K", ",", "V", "]", ",", "second_dict", ":", "Mapping", "[", "K", ",", "V", "]", ",", "compat", ":", "Callable", "[", "[", "V", ",", "V", "]", ",", "bool", "]", "=", "equi...
Check the safety of updating one dictionary with another. Raises ValueError if dictionaries have non-compatible values for any key, where compatibility is determined by identity (they are the same item) or the `compat` function. Parameters ---------- first_dict, second_dict : dict-like ...
[ "Check", "the", "safety", "of", "updating", "one", "dictionary", "with", "another", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L158-L179
train
Check the safety of updating one dictionary with another.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
remove_incompatible_items
def remove_incompatible_items(first_dict: MutableMapping[K, V], second_dict: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent ) -> None: """Remove incompatible items from the first dictionary in-place. Items are...
python
def remove_incompatible_items(first_dict: MutableMapping[K, V], second_dict: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent ) -> None: """Remove incompatible items from the first dictionary in-place. Items are...
[ "def", "remove_incompatible_items", "(", "first_dict", ":", "MutableMapping", "[", "K", ",", "V", "]", ",", "second_dict", ":", "Mapping", "[", "K", ",", "V", "]", ",", "compat", ":", "Callable", "[", "[", "V", ",", "V", "]", ",", "bool", "]", "=", ...
Remove incompatible items from the first dictionary in-place. Items are retained if their keys are found in both dictionaries and the values are compatible. Parameters ---------- first_dict, second_dict : dict-like Mappings to merge. compat : function, optional Binary operator ...
[ "Remove", "incompatible", "items", "from", "the", "first", "dictionary", "in", "-", "place", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L182-L201
train
Removes incompatible items from the first dictionary in - place.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
is_scalar
def is_scalar(value: Any) -> bool: """Whether to treat a value as a scalar. Any non-iterable, string, or 0-D array """ return ( getattr(value, 'ndim', None) == 0 or isinstance(value, (str, bytes)) or not isinstance(value, (Iterable, ) + dask_array_type))
python
def is_scalar(value: Any) -> bool: """Whether to treat a value as a scalar. Any non-iterable, string, or 0-D array """ return ( getattr(value, 'ndim', None) == 0 or isinstance(value, (str, bytes)) or not isinstance(value, (Iterable, ) + dask_array_type))
[ "def", "is_scalar", "(", "value", ":", "Any", ")", "->", "bool", ":", "return", "(", "getattr", "(", "value", ",", "'ndim'", ",", "None", ")", "==", "0", "or", "isinstance", "(", "value", ",", "(", "str", ",", "bytes", ")", ")", "or", "not", "isi...
Whether to treat a value as a scalar. Any non-iterable, string, or 0-D array
[ "Whether", "to", "treat", "a", "value", "as", "a", "scalar", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L230-L238
train
Whether a value is a scalar.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
to_0d_object_array
def to_0d_object_array(value: Any) -> np.ndarray: """Given a value, wrap it in a 0-D numpy.ndarray with dtype=object. """ result = np.empty((), dtype=object) result[()] = value return result
python
def to_0d_object_array(value: Any) -> np.ndarray: """Given a value, wrap it in a 0-D numpy.ndarray with dtype=object. """ result = np.empty((), dtype=object) result[()] = value return result
[ "def", "to_0d_object_array", "(", "value", ":", "Any", ")", "->", "np", ".", "ndarray", ":", "result", "=", "np", ".", "empty", "(", "(", ")", ",", "dtype", "=", "object", ")", "result", "[", "(", ")", "]", "=", "value", "return", "result" ]
Given a value, wrap it in a 0-D numpy.ndarray with dtype=object.
[ "Given", "a", "value", "wrap", "it", "in", "a", "0", "-", "D", "numpy", ".", "ndarray", "with", "dtype", "=", "object", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L250-L255
train
Given a value wrap it in a 0 - D numpy. ndarray with dtype = object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
to_0d_array
def to_0d_array(value: Any) -> np.ndarray: """Given a value, wrap it in a 0-D numpy.ndarray. """ if np.isscalar(value) or (isinstance(value, np.ndarray) and value.ndim == 0): return np.array(value) else: return to_0d_object_array(value)
python
def to_0d_array(value: Any) -> np.ndarray: """Given a value, wrap it in a 0-D numpy.ndarray. """ if np.isscalar(value) or (isinstance(value, np.ndarray) and value.ndim == 0): return np.array(value) else: return to_0d_object_array(value)
[ "def", "to_0d_array", "(", "value", ":", "Any", ")", "->", "np", ".", "ndarray", ":", "if", "np", ".", "isscalar", "(", "value", ")", "or", "(", "isinstance", "(", "value", ",", "np", ".", "ndarray", ")", "and", "value", ".", "ndim", "==", "0", "...
Given a value, wrap it in a 0-D numpy.ndarray.
[ "Given", "a", "value", "wrap", "it", "in", "a", "0", "-", "D", "numpy", ".", "ndarray", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L258-L265
train
Given a value wrap it in a 0 - D numpy. ndarray.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
dict_equiv
def dict_equiv(first: Mapping[K, V], second: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent) -> bool: """Test equivalence of two dict-like objects. If any of the values are numpy arrays, compare them correctly. Parameters ---------- first, second : dict-like Dicti...
python
def dict_equiv(first: Mapping[K, V], second: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent) -> bool: """Test equivalence of two dict-like objects. If any of the values are numpy arrays, compare them correctly. Parameters ---------- first, second : dict-like Dicti...
[ "def", "dict_equiv", "(", "first", ":", "Mapping", "[", "K", ",", "V", "]", ",", "second", ":", "Mapping", "[", "K", ",", "V", "]", ",", "compat", ":", "Callable", "[", "[", "V", ",", "V", "]", ",", "bool", "]", "=", "equivalent", ")", "->", ...
Test equivalence of two dict-like objects. If any of the values are numpy arrays, compare them correctly. Parameters ---------- first, second : dict-like Dictionaries to compare for equality compat : function, optional Binary operator to determine if two values are compatible. By de...
[ "Test", "equivalence", "of", "two", "dict", "-", "like", "objects", ".", "If", "any", "of", "the", "values", "are", "numpy", "arrays", "compare", "them", "correctly", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L268-L292
train
Test equivalence of two dict - like objects.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
ordered_dict_intersection
def ordered_dict_intersection(first_dict: Mapping[K, V], second_dict: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent ) -> MutableMapping[K, V]: """Return the intersection of two dictionaries as a new OrderedDict. ...
python
def ordered_dict_intersection(first_dict: Mapping[K, V], second_dict: Mapping[K, V], compat: Callable[[V, V], bool] = equivalent ) -> MutableMapping[K, V]: """Return the intersection of two dictionaries as a new OrderedDict. ...
[ "def", "ordered_dict_intersection", "(", "first_dict", ":", "Mapping", "[", "K", ",", "V", "]", ",", "second_dict", ":", "Mapping", "[", "K", ",", "V", "]", ",", "compat", ":", "Callable", "[", "[", "V", ",", "V", "]", ",", "bool", "]", "=", "equiv...
Return the intersection of two dictionaries as a new OrderedDict. Items are retained if their keys are found in both dictionaries and the values are compatible. Parameters ---------- first_dict, second_dict : dict-like Mappings to merge. compat : function, optional Binary opera...
[ "Return", "the", "intersection", "of", "two", "dictionaries", "as", "a", "new", "OrderedDict", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L295-L319
train
Returns the intersection of two dictionaries.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
is_uniform_spaced
def is_uniform_spaced(arr, **kwargs) -> bool: """Return True if values of an array are uniformly spaced and sorted. >>> is_uniform_spaced(range(5)) True >>> is_uniform_spaced([-4, 0, 100]) False kwargs are additional arguments to ``np.isclose`` """ arr = np.array(arr, dtype=float) ...
python
def is_uniform_spaced(arr, **kwargs) -> bool: """Return True if values of an array are uniformly spaced and sorted. >>> is_uniform_spaced(range(5)) True >>> is_uniform_spaced([-4, 0, 100]) False kwargs are additional arguments to ``np.isclose`` """ arr = np.array(arr, dtype=float) ...
[ "def", "is_uniform_spaced", "(", "arr", ",", "*", "*", "kwargs", ")", "->", "bool", ":", "arr", "=", "np", ".", "array", "(", "arr", ",", "dtype", "=", "float", ")", "diffs", "=", "np", ".", "diff", "(", "arr", ")", "return", "bool", "(", "np", ...
Return True if values of an array are uniformly spaced and sorted. >>> is_uniform_spaced(range(5)) True >>> is_uniform_spaced([-4, 0, 100]) False kwargs are additional arguments to ``np.isclose``
[ "Return", "True", "if", "values", "of", "an", "array", "are", "uniformly", "spaced", "and", "sorted", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L509-L521
train
Return True if values of an array are uniformly spaced and sorted.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
decode_numpy_dict_values
def decode_numpy_dict_values(attrs: Mapping[K, V]) -> Dict[K, V]: """Convert attribute values from numpy objects to native Python objects, for use in to_dict """ attrs = dict(attrs) for k, v in attrs.items(): if isinstance(v, np.ndarray): attrs[k] = v.tolist() elif isinst...
python
def decode_numpy_dict_values(attrs: Mapping[K, V]) -> Dict[K, V]: """Convert attribute values from numpy objects to native Python objects, for use in to_dict """ attrs = dict(attrs) for k, v in attrs.items(): if isinstance(v, np.ndarray): attrs[k] = v.tolist() elif isinst...
[ "def", "decode_numpy_dict_values", "(", "attrs", ":", "Mapping", "[", "K", ",", "V", "]", ")", "->", "Dict", "[", "K", ",", "V", "]", ":", "attrs", "=", "dict", "(", "attrs", ")", "for", "k", ",", "v", "in", "attrs", ".", "items", "(", ")", ":"...
Convert attribute values from numpy objects to native Python objects, for use in to_dict
[ "Convert", "attribute", "values", "from", "numpy", "objects", "to", "native", "Python", "objects", "for", "use", "in", "to_dict" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L538-L548
train
Convert numpy objects to native Python objects
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
ensure_us_time_resolution
def ensure_us_time_resolution(val): """Convert val out of numpy time, for use in to_dict. Needed because of numpy bug GH#7619""" if np.issubdtype(val.dtype, np.datetime64): val = val.astype('datetime64[us]') elif np.issubdtype(val.dtype, np.timedelta64): val = val.astype('timedelta64[us]...
python
def ensure_us_time_resolution(val): """Convert val out of numpy time, for use in to_dict. Needed because of numpy bug GH#7619""" if np.issubdtype(val.dtype, np.datetime64): val = val.astype('datetime64[us]') elif np.issubdtype(val.dtype, np.timedelta64): val = val.astype('timedelta64[us]...
[ "def", "ensure_us_time_resolution", "(", "val", ")", ":", "if", "np", ".", "issubdtype", "(", "val", ".", "dtype", ",", "np", ".", "datetime64", ")", ":", "val", "=", "val", ".", "astype", "(", "'datetime64[us]'", ")", "elif", "np", ".", "issubdtype", ...
Convert val out of numpy time, for use in to_dict. Needed because of numpy bug GH#7619
[ "Convert", "val", "out", "of", "numpy", "time", "for", "use", "in", "to_dict", ".", "Needed", "because", "of", "numpy", "bug", "GH#7619" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L551-L558
train
Convert val out of numpy time for use in to_dict. Needed because of numpy bug GH#7619
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/utils.py
get_temp_dimname
def get_temp_dimname(dims: Container[Hashable], new_dim: Hashable) -> Hashable: """ Get an new dimension name based on new_dim, that is not used in dims. If the same name exists, we add an underscore(s) in the head. Example1: dims: ['a', 'b', 'c'] new_dim: ['_rolling'] -> ['_rolling...
python
def get_temp_dimname(dims: Container[Hashable], new_dim: Hashable) -> Hashable: """ Get an new dimension name based on new_dim, that is not used in dims. If the same name exists, we add an underscore(s) in the head. Example1: dims: ['a', 'b', 'c'] new_dim: ['_rolling'] -> ['_rolling...
[ "def", "get_temp_dimname", "(", "dims", ":", "Container", "[", "Hashable", "]", ",", "new_dim", ":", "Hashable", ")", "->", "Hashable", ":", "while", "new_dim", "in", "dims", ":", "new_dim", "=", "'_'", "+", "str", "(", "new_dim", ")", "return", "new_dim...
Get an new dimension name based on new_dim, that is not used in dims. If the same name exists, we add an underscore(s) in the head. Example1: dims: ['a', 'b', 'c'] new_dim: ['_rolling'] -> ['_rolling'] Example2: dims: ['a', 'b', 'c', '_rolling'] new_dim: ['_rolling']...
[ "Get", "an", "new", "dimension", "name", "based", "on", "new_dim", "that", "is", "not", "used", "in", "dims", ".", "If", "the", "same", "name", "exists", "we", "add", "an", "underscore", "(", "s", ")", "in", "the", "head", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L597-L612
train
Get a new dimension name based on new_dim.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
_infer_dtype
def _infer_dtype(array, name=None): """Given an object array with no missing values, infer its dtype from its first element """ if array.dtype.kind != 'O': raise TypeError('infer_type must be called on a dtype=object array') if array.size == 0: return np.dtype(float) element = ...
python
def _infer_dtype(array, name=None): """Given an object array with no missing values, infer its dtype from its first element """ if array.dtype.kind != 'O': raise TypeError('infer_type must be called on a dtype=object array') if array.size == 0: return np.dtype(float) element = ...
[ "def", "_infer_dtype", "(", "array", ",", "name", "=", "None", ")", ":", "if", "array", ".", "dtype", ".", "kind", "!=", "'O'", ":", "raise", "TypeError", "(", "'infer_type must be called on a dtype=object array'", ")", "if", "array", ".", "size", "==", "0",...
Given an object array with no missing values, infer its dtype from its first element
[ "Given", "an", "object", "array", "with", "no", "missing", "values", "infer", "its", "dtype", "from", "its", "first", "element" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L115-L135
train
Given an object array with no missing values infer its dtype from its first element
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
_copy_with_dtype
def _copy_with_dtype(data, dtype): """Create a copy of an array with the given dtype. We use this instead of np.array() to ensure that custom object dtypes end up on the resulting array. """ result = np.empty(data.shape, dtype) result[...] = data return result
python
def _copy_with_dtype(data, dtype): """Create a copy of an array with the given dtype. We use this instead of np.array() to ensure that custom object dtypes end up on the resulting array. """ result = np.empty(data.shape, dtype) result[...] = data return result
[ "def", "_copy_with_dtype", "(", "data", ",", "dtype", ")", ":", "result", "=", "np", ".", "empty", "(", "data", ".", "shape", ",", "dtype", ")", "result", "[", "...", "]", "=", "data", "return", "result" ]
Create a copy of an array with the given dtype. We use this instead of np.array() to ensure that custom object dtypes end up on the resulting array.
[ "Create", "a", "copy", "of", "an", "array", "with", "the", "given", "dtype", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L149-L157
train
Create a copy of an array with the given dtype.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
encode_cf_variable
def encode_cf_variable(var, needs_copy=True, name=None): """ Converts an Variable into an Variable which follows some of the CF conventions: - Nans are masked using _FillValue (or the deprecated missing_value) - Rescaling via: scale_factor and add_offset - datetimes are converted to...
python
def encode_cf_variable(var, needs_copy=True, name=None): """ Converts an Variable into an Variable which follows some of the CF conventions: - Nans are masked using _FillValue (or the deprecated missing_value) - Rescaling via: scale_factor and add_offset - datetimes are converted to...
[ "def", "encode_cf_variable", "(", "var", ",", "needs_copy", "=", "True", ",", "name", "=", "None", ")", ":", "ensure_not_multiindex", "(", "var", ",", "name", "=", "name", ")", "for", "coder", "in", "[", "times", ".", "CFDatetimeCoder", "(", ")", ",", ...
Converts an Variable into an Variable which follows some of the CF conventions: - Nans are masked using _FillValue (or the deprecated missing_value) - Rescaling via: scale_factor and add_offset - datetimes are converted to the CF 'units since time' format - dtype encodings are enfor...
[ "Converts", "an", "Variable", "into", "an", "Variable", "which", "follows", "some", "of", "the", "CF", "conventions", ":" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L204-L238
train
Encodes a variable into a CF - encoded version of the variable.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
decode_cf_variable
def decode_cf_variable(name, var, concat_characters=True, mask_and_scale=True, decode_times=True, decode_endianness=True, stack_char_dim=True, use_cftime=None): """ Decodes a variable which may hold CF encoded information. This includes variables that have been...
python
def decode_cf_variable(name, var, concat_characters=True, mask_and_scale=True, decode_times=True, decode_endianness=True, stack_char_dim=True, use_cftime=None): """ Decodes a variable which may hold CF encoded information. This includes variables that have been...
[ "def", "decode_cf_variable", "(", "name", ",", "var", ",", "concat_characters", "=", "True", ",", "mask_and_scale", "=", "True", ",", "decode_times", "=", "True", ",", "decode_endianness", "=", "True", ",", "stack_char_dim", "=", "True", ",", "use_cftime", "="...
Decodes a variable which may hold CF encoded information. This includes variables that have been masked and scaled, which hold CF style time variables (this is almost always the case if the dataset has been serialized) and which have strings encoded as character arrays. Parameters ---------- ...
[ "Decodes", "a", "variable", "which", "may", "hold", "CF", "encoded", "information", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L241-L326
train
Decodes a variable in CF - encoded form into a new variable in the CF - encoded form.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
_update_bounds_attributes
def _update_bounds_attributes(variables): """Adds time attributes to time bounds variables. Variables handling time bounds ("Cell boundaries" in the CF conventions) do not necessarily carry the necessary attributes to be decoded. This copies the attributes from the time variable to the associated b...
python
def _update_bounds_attributes(variables): """Adds time attributes to time bounds variables. Variables handling time bounds ("Cell boundaries" in the CF conventions) do not necessarily carry the necessary attributes to be decoded. This copies the attributes from the time variable to the associated b...
[ "def", "_update_bounds_attributes", "(", "variables", ")", ":", "# For all time variables with bounds", "for", "v", "in", "variables", ".", "values", "(", ")", ":", "attrs", "=", "v", ".", "attrs", "has_date_units", "=", "'units'", "in", "attrs", "and", "'since'...
Adds time attributes to time bounds variables. Variables handling time bounds ("Cell boundaries" in the CF conventions) do not necessarily carry the necessary attributes to be decoded. This copies the attributes from the time variable to the associated boundaries. See Also: http://cfconventio...
[ "Adds", "time", "attributes", "to", "time", "bounds", "variables", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L329-L354
train
Updates the time attributes of the time variables that are in the time bounds variable.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
decode_cf_variables
def decode_cf_variables(variables, attributes, concat_characters=True, mask_and_scale=True, decode_times=True, decode_coords=True, drop_variables=None, use_cftime=None): """ Decode several CF encoded variables. See: decode_cf_variable ...
python
def decode_cf_variables(variables, attributes, concat_characters=True, mask_and_scale=True, decode_times=True, decode_coords=True, drop_variables=None, use_cftime=None): """ Decode several CF encoded variables. See: decode_cf_variable ...
[ "def", "decode_cf_variables", "(", "variables", ",", "attributes", ",", "concat_characters", "=", "True", ",", "mask_and_scale", "=", "True", ",", "decode_times", "=", "True", ",", "decode_coords", "=", "True", ",", "drop_variables", "=", "None", ",", "use_cftim...
Decode several CF encoded variables. See: decode_cf_variable
[ "Decode", "several", "CF", "encoded", "variables", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L357-L416
train
Decode several CF encoded variables.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
decode_cf
def decode_cf(obj, concat_characters=True, mask_and_scale=True, decode_times=True, decode_coords=True, drop_variables=None, use_cftime=None): """Decode the given Dataset or Datastore according to CF conventions into a new Dataset. Parameters ---------- obj : Dataset or D...
python
def decode_cf(obj, concat_characters=True, mask_and_scale=True, decode_times=True, decode_coords=True, drop_variables=None, use_cftime=None): """Decode the given Dataset or Datastore according to CF conventions into a new Dataset. Parameters ---------- obj : Dataset or D...
[ "def", "decode_cf", "(", "obj", ",", "concat_characters", "=", "True", ",", "mask_and_scale", "=", "True", ",", "decode_times", "=", "True", ",", "decode_coords", "=", "True", ",", "drop_variables", "=", "None", ",", "use_cftime", "=", "None", ")", ":", "f...
Decode the given Dataset or Datastore according to CF conventions into a new Dataset. Parameters ---------- obj : Dataset or DataStore Object to decode. concat_characters : bool, optional Should character arrays be concatenated to strings, for example: ['h', 'e', 'l', 'l', '...
[ "Decode", "the", "given", "Dataset", "or", "Datastore", "according", "to", "CF", "conventions", "into", "a", "new", "Dataset", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L419-L485
train
Decodes the given Dataset or DataStore into a new Dataset.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
cf_decoder
def cf_decoder(variables, attributes, concat_characters=True, mask_and_scale=True, decode_times=True): """ Decode a set of CF encoded variables and attributes. See Also, decode_cf_variable Parameters ---------- variables : dict A dictionary mapping from va...
python
def cf_decoder(variables, attributes, concat_characters=True, mask_and_scale=True, decode_times=True): """ Decode a set of CF encoded variables and attributes. See Also, decode_cf_variable Parameters ---------- variables : dict A dictionary mapping from va...
[ "def", "cf_decoder", "(", "variables", ",", "attributes", ",", "concat_characters", "=", "True", ",", "mask_and_scale", "=", "True", ",", "decode_times", "=", "True", ")", ":", "variables", ",", "attributes", ",", "_", "=", "decode_cf_variables", "(", "variabl...
Decode a set of CF encoded variables and attributes. See Also, decode_cf_variable Parameters ---------- variables : dict A dictionary mapping from variable name to xarray.Variable attributes : dict A dictionary mapping from attribute name to value concat_characters : bool ...
[ "Decode", "a", "set", "of", "CF", "encoded", "variables", "and", "attributes", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L488-L520
train
Decode a set of CF encoded variables and attributes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
encode_dataset_coordinates
def encode_dataset_coordinates(dataset): """Encode coordinates on the given dataset object into variable specific and global attributes. When possible, this is done according to CF conventions. Parameters ---------- dataset : Dataset Object to encode. Returns ------- varia...
python
def encode_dataset_coordinates(dataset): """Encode coordinates on the given dataset object into variable specific and global attributes. When possible, this is done according to CF conventions. Parameters ---------- dataset : Dataset Object to encode. Returns ------- varia...
[ "def", "encode_dataset_coordinates", "(", "dataset", ")", ":", "non_dim_coord_names", "=", "set", "(", "dataset", ".", "coords", ")", "-", "set", "(", "dataset", ".", "dims", ")", "return", "_encode_coordinates", "(", "dataset", ".", "_variables", ",", "datase...
Encode coordinates on the given dataset object into variable specific and global attributes. When possible, this is done according to CF conventions. Parameters ---------- dataset : Dataset Object to encode. Returns ------- variables : dict attrs : dict
[ "Encode", "coordinates", "on", "the", "given", "dataset", "object", "into", "variable", "specific", "and", "global", "attributes", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L574-L592
train
Encode coordinates on the given dataset object into variable specific and global attributes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/conventions.py
cf_encoder
def cf_encoder(variables, attributes): """ A function which takes a dicts of variables and attributes and encodes them to conform to CF conventions as much as possible. This includes masking, scaling, character array handling, and CF-time encoding. Decode a set of CF encoded variables and attr...
python
def cf_encoder(variables, attributes): """ A function which takes a dicts of variables and attributes and encodes them to conform to CF conventions as much as possible. This includes masking, scaling, character array handling, and CF-time encoding. Decode a set of CF encoded variables and attr...
[ "def", "cf_encoder", "(", "variables", ",", "attributes", ")", ":", "new_vars", "=", "OrderedDict", "(", "(", "k", ",", "encode_cf_variable", "(", "v", ",", "name", "=", "k", ")", ")", "for", "k", ",", "v", "in", "variables", ".", "items", "(", ")", ...
A function which takes a dicts of variables and attributes and encodes them to conform to CF conventions as much as possible. This includes masking, scaling, character array handling, and CF-time encoding. Decode a set of CF encoded variables and attributes. See Also, decode_cf_variable Para...
[ "A", "function", "which", "takes", "a", "dicts", "of", "variables", "and", "attributes", "and", "encodes", "them", "to", "conform", "to", "CF", "conventions", "as", "much", "as", "possible", ".", "This", "includes", "masking", "scaling", "character", "array", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/conventions.py#L595-L624
train
A function which takes a dict of variables and attributes and encodes them to conform to CF conventions as much as possible.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/backends/netcdf3.py
coerce_nc3_dtype
def coerce_nc3_dtype(arr): """Coerce an array to a data type that can be stored in a netCDF-3 file This function performs the following dtype conversions: int64 -> int32 bool -> int8 Data is checked for equality, or equivalence (non-NaN values) with `np.allclose` with the default keywo...
python
def coerce_nc3_dtype(arr): """Coerce an array to a data type that can be stored in a netCDF-3 file This function performs the following dtype conversions: int64 -> int32 bool -> int8 Data is checked for equality, or equivalence (non-NaN values) with `np.allclose` with the default keywo...
[ "def", "coerce_nc3_dtype", "(", "arr", ")", ":", "dtype", "=", "str", "(", "arr", ".", "dtype", ")", "if", "dtype", "in", "_nc3_dtype_coercions", ":", "new_dtype", "=", "_nc3_dtype_coercions", "[", "dtype", "]", "# TODO: raise a warning whenever casting the data-typ...
Coerce an array to a data type that can be stored in a netCDF-3 file This function performs the following dtype conversions: int64 -> int32 bool -> int8 Data is checked for equality, or equivalence (non-NaN values) with `np.allclose` with the default keyword arguments.
[ "Coerce", "an", "array", "to", "a", "data", "type", "that", "can", "be", "stored", "in", "a", "netCDF", "-", "3", "file" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/backends/netcdf3.py#L26-L45
train
Coerce an array to a data type that can be stored in a netCDF - 3 file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/backends/netcdf3.py
is_valid_nc3_name
def is_valid_nc3_name(s): """Test whether an object can be validly converted to a netCDF-3 dimension, variable or attribute name Earlier versions of the netCDF C-library reference implementation enforced a more restricted set of characters in creating new names, but permitted reading names containi...
python
def is_valid_nc3_name(s): """Test whether an object can be validly converted to a netCDF-3 dimension, variable or attribute name Earlier versions of the netCDF C-library reference implementation enforced a more restricted set of characters in creating new names, but permitted reading names containi...
[ "def", "is_valid_nc3_name", "(", "s", ")", ":", "if", "not", "isinstance", "(", "s", ",", "str", ")", ":", "return", "False", "if", "not", "isinstance", "(", "s", ",", "str", ")", ":", "s", "=", "s", ".", "decode", "(", "'utf-8'", ")", "num_bytes",...
Test whether an object can be validly converted to a netCDF-3 dimension, variable or attribute name Earlier versions of the netCDF C-library reference implementation enforced a more restricted set of characters in creating new names, but permitted reading names containing arbitrary bytes. This spec...
[ "Test", "whether", "an", "object", "can", "be", "validly", "converted", "to", "a", "netCDF", "-", "3", "dimension", "variable", "or", "attribute", "name" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/backends/netcdf3.py#L83-L111
train
Test whether an object can be converted to a netCDF - 3 name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
as_variable
def as_variable(obj, name=None) -> 'Union[Variable, IndexVariable]': """Convert an object into a Variable. Parameters ---------- obj : object Object to convert into a Variable. - If the object is already a Variable, return a shallow copy. - Otherwise, if the object has 'dims' a...
python
def as_variable(obj, name=None) -> 'Union[Variable, IndexVariable]': """Convert an object into a Variable. Parameters ---------- obj : object Object to convert into a Variable. - If the object is already a Variable, return a shallow copy. - Otherwise, if the object has 'dims' a...
[ "def", "as_variable", "(", "obj", ",", "name", "=", "None", ")", "->", "'Union[Variable, IndexVariable]'", ":", "from", ".", "dataarray", "import", "DataArray", "# TODO: consider extending this method to automatically handle Iris and", "if", "isinstance", "(", "obj", ",",...
Convert an object into a Variable. Parameters ---------- obj : object Object to convert into a Variable. - If the object is already a Variable, return a shallow copy. - Otherwise, if the object has 'dims' and 'data' attributes, convert it into a new Variable. - If...
[ "Convert", "an", "object", "into", "a", "Variable", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L46-L119
train
Convert an object into a Variable.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
_possibly_convert_objects
def _possibly_convert_objects(values): """Convert arrays of datetime.datetime and datetime.timedelta objects into datetime64 and timedelta64, according to the pandas convention. """ return np.asarray(pd.Series(values.ravel())).reshape(values.shape)
python
def _possibly_convert_objects(values): """Convert arrays of datetime.datetime and datetime.timedelta objects into datetime64 and timedelta64, according to the pandas convention. """ return np.asarray(pd.Series(values.ravel())).reshape(values.shape)
[ "def", "_possibly_convert_objects", "(", "values", ")", ":", "return", "np", ".", "asarray", "(", "pd", ".", "Series", "(", "values", ".", "ravel", "(", ")", ")", ")", ".", "reshape", "(", "values", ".", "shape", ")" ]
Convert arrays of datetime.datetime and datetime.timedelta objects into datetime64 and timedelta64, according to the pandas convention.
[ "Convert", "arrays", "of", "datetime", ".", "datetime", "and", "datetime", ".", "timedelta", "objects", "into", "datetime64", "and", "timedelta64", "according", "to", "the", "pandas", "convention", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L135-L139
train
Convert arrays of datetime. datetime and datetime. timedelta objects into datetime64 and timedelta64 according to the pandas convention.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
as_compatible_data
def as_compatible_data(data, fastpath=False): """Prepare and wrap data to put in a Variable. - If data does not have the necessary attributes, convert it to ndarray. - If data has dtype=datetime64, ensure that it has ns precision. If it's a pandas.Timestamp, convert it to datetime64. - If data is...
python
def as_compatible_data(data, fastpath=False): """Prepare and wrap data to put in a Variable. - If data does not have the necessary attributes, convert it to ndarray. - If data has dtype=datetime64, ensure that it has ns precision. If it's a pandas.Timestamp, convert it to datetime64. - If data is...
[ "def", "as_compatible_data", "(", "data", ",", "fastpath", "=", "False", ")", ":", "if", "fastpath", "and", "getattr", "(", "data", ",", "'ndim'", ",", "0", ")", ">", "0", ":", "# can't use fastpath (yet) for scalars", "return", "_maybe_wrap_data", "(", "data"...
Prepare and wrap data to put in a Variable. - If data does not have the necessary attributes, convert it to ndarray. - If data has dtype=datetime64, ensure that it has ns precision. If it's a pandas.Timestamp, convert it to datetime64. - If data is already a pandas or xarray object (other than an Ind...
[ "Prepare", "and", "wrap", "data", "to", "put", "in", "a", "Variable", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L142-L196
train
Prepare and wrap data to put in a Variable.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
_as_array_or_item
def _as_array_or_item(data): """Return the given values as a numpy array, or as an individual item if it's a 0d datetime64 or timedelta64 array. Importantly, this function does not copy data if it is already an ndarray - otherwise, it will not be possible to update Variable values in place. This f...
python
def _as_array_or_item(data): """Return the given values as a numpy array, or as an individual item if it's a 0d datetime64 or timedelta64 array. Importantly, this function does not copy data if it is already an ndarray - otherwise, it will not be possible to update Variable values in place. This f...
[ "def", "_as_array_or_item", "(", "data", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "if", "data", ".", "ndim", "==", "0", ":", "if", "data", ".", "dtype", ".", "kind", "==", "'M'", ":", "data", "=", "np", ".", "datetime64", "(...
Return the given values as a numpy array, or as an individual item if it's a 0d datetime64 or timedelta64 array. Importantly, this function does not copy data if it is already an ndarray - otherwise, it will not be possible to update Variable values in place. This function mostly exists because 0-dime...
[ "Return", "the", "given", "values", "as", "a", "numpy", "array", "or", "as", "an", "individual", "item", "if", "it", "s", "a", "0d", "datetime64", "or", "timedelta64", "array", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L199-L219
train
Return the given values as a numpy array or as an individual item if the given values are 0d datetime64 or timedelta64 array.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
_broadcast_compat_variables
def _broadcast_compat_variables(*variables): """Create broadcast compatible variables, with the same dimensions. Unlike the result of broadcast_variables(), some variables may have dimensions of size 1 instead of the the size of the broadcast dimension. """ dims = tuple(_unified_dims(variables)) ...
python
def _broadcast_compat_variables(*variables): """Create broadcast compatible variables, with the same dimensions. Unlike the result of broadcast_variables(), some variables may have dimensions of size 1 instead of the the size of the broadcast dimension. """ dims = tuple(_unified_dims(variables)) ...
[ "def", "_broadcast_compat_variables", "(", "*", "variables", ")", ":", "dims", "=", "tuple", "(", "_unified_dims", "(", "variables", ")", ")", "return", "tuple", "(", "var", ".", "set_dims", "(", "dims", ")", "if", "var", ".", "dims", "!=", "dims", "else...
Create broadcast compatible variables, with the same dimensions. Unlike the result of broadcast_variables(), some variables may have dimensions of size 1 instead of the the size of the broadcast dimension.
[ "Create", "broadcast", "compatible", "variables", "with", "the", "same", "dimensions", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L2016-L2024
train
Create broadcast compatible variables with the same dimensions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
broadcast_variables
def broadcast_variables(*variables): """Given any number of variables, return variables with matching dimensions and broadcast data. The data on the returned variables will be a view of the data on the corresponding original arrays, but dimensions will be reordered and inserted so that both broadca...
python
def broadcast_variables(*variables): """Given any number of variables, return variables with matching dimensions and broadcast data. The data on the returned variables will be a view of the data on the corresponding original arrays, but dimensions will be reordered and inserted so that both broadca...
[ "def", "broadcast_variables", "(", "*", "variables", ")", ":", "dims_map", "=", "_unified_dims", "(", "variables", ")", "dims_tuple", "=", "tuple", "(", "dims_map", ")", "return", "tuple", "(", "var", ".", "set_dims", "(", "dims_map", ")", "if", "var", "."...
Given any number of variables, return variables with matching dimensions and broadcast data. The data on the returned variables will be a view of the data on the corresponding original arrays, but dimensions will be reordered and inserted so that both broadcast arrays have the same dimensions. The new ...
[ "Given", "any", "number", "of", "variables", "return", "variables", "with", "matching", "dimensions", "and", "broadcast", "data", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L2027-L2040
train
Given any number of variables return variables with matching dimensions and broadcast data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
concat
def concat(variables, dim='concat_dim', positions=None, shortcut=False): """Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have matching dimensions and shape except for a...
python
def concat(variables, dim='concat_dim', positions=None, shortcut=False): """Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have matching dimensions and shape except for a...
[ "def", "concat", "(", "variables", ",", "dim", "=", "'concat_dim'", ",", "positions", "=", "None", ",", "shortcut", "=", "False", ")", ":", "variables", "=", "list", "(", "variables", ")", "if", "all", "(", "isinstance", "(", "v", ",", "IndexVariable", ...
Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have matching dimensions and shape except for along the stacked dimension. dim : str or DataArray, optional ...
[ "Concatenate", "variables", "along", "a", "new", "or", "existing", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L2059-L2093
train
Concatenate a list of Variable objects along a new or existing dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
assert_unique_multiindex_level_names
def assert_unique_multiindex_level_names(variables): """Check for uniqueness of MultiIndex level names in all given variables. Not public API. Used for checking consistency of DataArray and Dataset objects. """ level_names = defaultdict(list) all_level_names = set() for var_name, var in...
python
def assert_unique_multiindex_level_names(variables): """Check for uniqueness of MultiIndex level names in all given variables. Not public API. Used for checking consistency of DataArray and Dataset objects. """ level_names = defaultdict(list) all_level_names = set() for var_name, var in...
[ "def", "assert_unique_multiindex_level_names", "(", "variables", ")", ":", "level_names", "=", "defaultdict", "(", "list", ")", "all_level_names", "=", "set", "(", ")", "for", "var_name", ",", "var", "in", "variables", ".", "items", "(", ")", ":", "if", "isi...
Check for uniqueness of MultiIndex level names in all given variables. Not public API. Used for checking consistency of DataArray and Dataset objects.
[ "Check", "for", "uniqueness", "of", "MultiIndex", "level", "names", "in", "all", "given", "variables", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L2096-L2128
train
Check for uniqueness of MultiIndex level names in all given variables.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.load
def load(self, **kwargs): """Manually trigger loading of this variable's data from disk or a remote source into memory and return this variable. Normally, it should not be necessary to call this method in user code, because all xarray functions should either work on deferred data or ...
python
def load(self, **kwargs): """Manually trigger loading of this variable's data from disk or a remote source into memory and return this variable. Normally, it should not be necessary to call this method in user code, because all xarray functions should either work on deferred data or ...
[ "def", "load", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "self", ".", "_data", ",", "dask_array_type", ")", ":", "self", ".", "_data", "=", "as_compatible_data", "(", "self", ".", "_data", ".", "compute", "(", "*", "*",...
Manually trigger loading of this variable's data from disk or a remote source into memory and return this variable. 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. ...
[ "Manually", "trigger", "loading", "of", "this", "variable", "s", "data", "from", "disk", "or", "a", "remote", "source", "into", "memory", "and", "return", "this", "variable", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L307-L328
train
Manually trigger loading of this variable s data from disk or local source into memory and return this variable.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.to_base_variable
def to_base_variable(self): """Return this variable as a base xarray.Variable""" return Variable(self.dims, self._data, self._attrs, encoding=self._encoding, fastpath=True)
python
def to_base_variable(self): """Return this variable as a base xarray.Variable""" return Variable(self.dims, self._data, self._attrs, encoding=self._encoding, fastpath=True)
[ "def", "to_base_variable", "(", "self", ")", ":", "return", "Variable", "(", "self", ".", "dims", ",", "self", ".", "_data", ",", "self", ".", "_attrs", ",", "encoding", "=", "self", ".", "_encoding", ",", "fastpath", "=", "True", ")" ]
Return this variable as a base xarray.Variable
[ "Return", "this", "variable", "as", "a", "base", "xarray", ".", "Variable" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L398-L401
train
Return this variable as a base xarray. Variable
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.to_index_variable
def to_index_variable(self): """Return this variable as an xarray.IndexVariable""" return IndexVariable(self.dims, self._data, self._attrs, encoding=self._encoding, fastpath=True)
python
def to_index_variable(self): """Return this variable as an xarray.IndexVariable""" return IndexVariable(self.dims, self._data, self._attrs, encoding=self._encoding, fastpath=True)
[ "def", "to_index_variable", "(", "self", ")", ":", "return", "IndexVariable", "(", "self", ".", "dims", ",", "self", ".", "_data", ",", "self", ".", "_attrs", ",", "encoding", "=", "self", ".", "_encoding", ",", "fastpath", "=", "True", ")" ]
Return this variable as an xarray.IndexVariable
[ "Return", "this", "variable", "as", "an", "xarray", ".", "IndexVariable" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L405-L408
train
Return this variable as an xarray. IndexVariable
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.to_dict
def to_dict(self, data=True): """Dictionary representation of variable.""" item = {'dims': self.dims, 'attrs': decode_numpy_dict_values(self.attrs)} if data: item['data'] = ensure_us_time_resolution(self.values).tolist() else: item.update({'dtype':...
python
def to_dict(self, data=True): """Dictionary representation of variable.""" item = {'dims': self.dims, 'attrs': decode_numpy_dict_values(self.attrs)} if data: item['data'] = ensure_us_time_resolution(self.values).tolist() else: item.update({'dtype':...
[ "def", "to_dict", "(", "self", ",", "data", "=", "True", ")", ":", "item", "=", "{", "'dims'", ":", "self", ".", "dims", ",", "'attrs'", ":", "decode_numpy_dict_values", "(", "self", ".", "attrs", ")", "}", "if", "data", ":", "item", "[", "'data'", ...
Dictionary representation of variable.
[ "Dictionary", "representation", "of", "variable", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L416-L424
train
Returns a dictionary representation of the object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._broadcast_indexes
def _broadcast_indexes(self, key): """Prepare an indexing key for an indexing operation. Parameters ----------- key: int, slice, array, dict or tuple of integer, slices and arrays Any valid input for indexing. Returns ------- dims: tuple ...
python
def _broadcast_indexes(self, key): """Prepare an indexing key for an indexing operation. Parameters ----------- key: int, slice, array, dict or tuple of integer, slices and arrays Any valid input for indexing. Returns ------- dims: tuple ...
[ "def", "_broadcast_indexes", "(", "self", ",", "key", ")", ":", "key", "=", "self", ".", "_item_key_to_tuple", "(", "key", ")", "# key is a tuple", "# key is a tuple of full size", "key", "=", "indexing", ".", "expanded_indexer", "(", "key", ",", "self", ".", ...
Prepare an indexing key for an indexing operation. Parameters ----------- key: int, slice, array, dict or tuple of integer, slices and arrays Any valid input for indexing. Returns ------- dims: tuple Dimension of the resultant variable. i...
[ "Prepare", "an", "indexing", "key", "for", "an", "indexing", "operation", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L452-L508
train
This method is used to broadcast the indexes of the items in the item.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._validate_indexers
def _validate_indexers(self, key): """ Make sanity checks """ for dim, k in zip(self.dims, key): if isinstance(k, BASIC_INDEXING_TYPES): pass else: if not isinstance(k, Variable): k = np.asarray(k) if k.ndim ...
python
def _validate_indexers(self, key): """ Make sanity checks """ for dim, k in zip(self.dims, key): if isinstance(k, BASIC_INDEXING_TYPES): pass else: if not isinstance(k, Variable): k = np.asarray(k) if k.ndim ...
[ "def", "_validate_indexers", "(", "self", ",", "key", ")", ":", "for", "dim", ",", "k", "in", "zip", "(", "self", ".", "dims", ",", "key", ")", ":", "if", "isinstance", "(", "k", ",", "BASIC_INDEXING_TYPES", ")", ":", "pass", "else", ":", "if", "no...
Make sanity checks
[ "Make", "sanity", "checks" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L515-L541
train
Make sanity checks for the indexes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._nonzero
def _nonzero(self): """ Equivalent numpy's nonzero but returns a tuple of Varibles. """ # TODO we should replace dask's native nonzero # after https://github.com/dask/dask/issues/1076 is implemented. nonzeros = np.nonzero(self.data) return tuple(Variable((dim), nz) for nz, dim ...
python
def _nonzero(self): """ Equivalent numpy's nonzero but returns a tuple of Varibles. """ # TODO we should replace dask's native nonzero # after https://github.com/dask/dask/issues/1076 is implemented. nonzeros = np.nonzero(self.data) return tuple(Variable((dim), nz) for nz, dim ...
[ "def", "_nonzero", "(", "self", ")", ":", "# TODO we should replace dask's native nonzero", "# after https://github.com/dask/dask/issues/1076 is implemented.", "nonzeros", "=", "np", ".", "nonzero", "(", "self", ".", "data", ")", "return", "tuple", "(", "Variable", "(", ...
Equivalent numpy's nonzero but returns a tuple of Varibles.
[ "Equivalent", "numpy", "s", "nonzero", "but", "returns", "a", "tuple", "of", "Varibles", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L560-L566
train
Equivalent numpy s nonzero but returns a tuple of Varibles.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._finalize_indexing_result
def _finalize_indexing_result(self, dims, data): """Used by IndexVariable to return IndexVariable objects when possible. """ return type(self)(dims, data, self._attrs, self._encoding, fastpath=True)
python
def _finalize_indexing_result(self, dims, data): """Used by IndexVariable to return IndexVariable objects when possible. """ return type(self)(dims, data, self._attrs, self._encoding, fastpath=True)
[ "def", "_finalize_indexing_result", "(", "self", ",", "dims", ",", "data", ")", ":", "return", "type", "(", "self", ")", "(", "dims", ",", "data", ",", "self", ".", "_attrs", ",", "self", ".", "_encoding", ",", "fastpath", "=", "True", ")" ]
Used by IndexVariable to return IndexVariable objects when possible.
[ "Used", "by", "IndexVariable", "to", "return", "IndexVariable", "objects", "when", "possible", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L641-L645
train
Used by IndexVariable to return IndexVariable objects when possible.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._getitem_with_mask
def _getitem_with_mask(self, key, fill_value=dtypes.NA): """Index this Variable with -1 remapped to fill_value.""" # TODO(shoyer): expose this method in public API somewhere (isel?) and # use it for reindex. # TODO(shoyer): add a sanity check that all other integers are # non-neg...
python
def _getitem_with_mask(self, key, fill_value=dtypes.NA): """Index this Variable with -1 remapped to fill_value.""" # TODO(shoyer): expose this method in public API somewhere (isel?) and # use it for reindex. # TODO(shoyer): add a sanity check that all other integers are # non-neg...
[ "def", "_getitem_with_mask", "(", "self", ",", "key", ",", "fill_value", "=", "dtypes", ".", "NA", ")", ":", "# TODO(shoyer): expose this method in public API somewhere (isel?) and", "# use it for reindex.", "# TODO(shoyer): add a sanity check that all other integers are", "# non-n...
Index this Variable with -1 remapped to fill_value.
[ "Index", "this", "Variable", "with", "-", "1", "remapped", "to", "fill_value", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L647-L683
train
Index this Variable with - 1 remapped to fill_value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.copy
def copy(self, deep=True, data=None): """Returns a copy of this object. If `deep=True`, the data array is loaded into memory and copied onto the new object. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same structure as orig...
python
def copy(self, deep=True, data=None): """Returns a copy of this object. If `deep=True`, the data array is loaded into memory and copied onto the new object. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same structure as orig...
[ "def", "copy", "(", "self", ",", "deep", "=", "True", ",", "data", "=", "None", ")", ":", "if", "data", "is", "None", ":", "data", "=", "self", ".", "_data", "if", "isinstance", "(", "data", ",", "indexing", ".", "MemoryCachedArray", ")", ":", "# d...
Returns a copy of this object. If `deep=True`, the data array is loaded into memory and copied onto the new object. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same structure as original but entirely new data. Parameters ...
[ "Returns", "a", "copy", "of", "this", "object", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L743-L823
train
Returns a copy of this object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.chunk
def chunk(self, chunks=None, name=None, lock=False): """Coerce this array's data into a dask arrays with the given chunks. If this variable is a non-dask array, it will be converted to dask array. If it's a dask array, it will be rechunked to the given chunk sizes. If neither c...
python
def chunk(self, chunks=None, name=None, lock=False): """Coerce this array's data into a dask arrays with the given chunks. If this variable is a non-dask array, it will be converted to dask array. If it's a dask array, it will be rechunked to the given chunk sizes. If neither c...
[ "def", "chunk", "(", "self", ",", "chunks", "=", "None", ",", "name", "=", "None", ",", "lock", "=", "False", ")", ":", "import", "dask", ".", "array", "as", "da", "if", "utils", ".", "is_dict_like", "(", "chunks", ")", ":", "chunks", "=", "dict", ...
Coerce this array's data into a dask arrays with the given chunks. If this variable is a non-dask array, it will be converted to dask array. If it's a dask array, it will be rechunked to the given chunk sizes. If neither chunks is not provided for one or more dimensions, chunk ...
[ "Coerce", "this", "array", "s", "data", "into", "a", "dask", "arrays", "with", "the", "given", "chunks", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L846-L898
train
Coerce this array s data into a dask array with the given chunks.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.isel
def isel(self, indexers=None, drop=False, **indexers_kwargs): """Return a new array indexed along the specified dimension(s). Parameters ---------- **indexers : {dim: indexer, ...} Keyword arguments with names matching dimensions and values given by integers, sli...
python
def isel(self, indexers=None, drop=False, **indexers_kwargs): """Return a new array indexed along the specified dimension(s). Parameters ---------- **indexers : {dim: indexer, ...} Keyword arguments with names matching dimensions and values given by integers, sli...
[ "def", "isel", "(", "self", ",", "indexers", "=", "None", ",", "drop", "=", "False", ",", "*", "*", "indexers_kwargs", ")", ":", "indexers", "=", "either_dict_or_kwargs", "(", "indexers", ",", "indexers_kwargs", ",", "'isel'", ")", "invalid", "=", "[", "...
Return a new array indexed along the specified dimension(s). Parameters ---------- **indexers : {dim: indexer, ...} Keyword arguments with names matching dimensions and values given by integers, slice objects or arrays. Returns ------- obj : Arra...
[ "Return", "a", "new", "array", "indexed", "along", "the", "specified", "dimension", "(", "s", ")", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L900-L927
train
Return a new array indexed along the specified dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.squeeze
def squeeze(self, dim=None): """Return a new object with squeezed data. Parameters ---------- dim : None or str or tuple of str, optional Selects a subset of the length one dimensions. If a dimension is selected with length greater than one, an error is raised. I...
python
def squeeze(self, dim=None): """Return a new object with squeezed data. Parameters ---------- dim : None or str or tuple of str, optional Selects a subset of the length one dimensions. If a dimension is selected with length greater than one, an error is raised. I...
[ "def", "squeeze", "(", "self", ",", "dim", "=", "None", ")", ":", "dims", "=", "common", ".", "get_squeeze_dims", "(", "self", ",", "dim", ")", "return", "self", ".", "isel", "(", "{", "d", ":", "0", "for", "d", "in", "dims", "}", ")" ]
Return a new object with squeezed data. Parameters ---------- dim : None or str or tuple of str, optional Selects a subset of the length one dimensions. If a dimension is selected with length greater than one, an error is raised. If None, all length one dimen...
[ "Return", "a", "new", "object", "with", "squeezed", "data", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L929-L950
train
Return a new object with squeezed data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.shift
def shift(self, shifts=None, fill_value=dtypes.NA, **shifts_kwargs): """ Return a new Variable with shifted data. Parameters ---------- shifts : mapping of the form {dim: offset} Integer offset to shift along each of the given dimensions. Positive offsets...
python
def shift(self, shifts=None, fill_value=dtypes.NA, **shifts_kwargs): """ Return a new Variable with shifted data. Parameters ---------- shifts : mapping of the form {dim: offset} Integer offset to shift along each of the given dimensions. Positive offsets...
[ "def", "shift", "(", "self", ",", "shifts", "=", "None", ",", "fill_value", "=", "dtypes", ".", "NA", ",", "*", "*", "shifts_kwargs", ")", ":", "shifts", "=", "either_dict_or_kwargs", "(", "shifts", ",", "shifts_kwargs", ",", "'shift'", ")", "result", "=...
Return a new Variable with shifted data. Parameters ---------- shifts : mapping of the form {dim: offset} Integer offset to shift along each of the given dimensions. Positive offsets shift to the right; negative offsets shift to the left. fill_value: ...
[ "Return", "a", "new", "Variable", "with", "shifted", "data", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L996-L1021
train
Return a new Variable with shifted data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.pad_with_fill_value
def pad_with_fill_value(self, pad_widths=None, fill_value=dtypes.NA, **pad_widths_kwargs): """ Return a new Variable with paddings. Parameters ---------- pad_width: Mapping of the form {dim: (before, after)} Number of values padded to the ...
python
def pad_with_fill_value(self, pad_widths=None, fill_value=dtypes.NA, **pad_widths_kwargs): """ Return a new Variable with paddings. Parameters ---------- pad_width: Mapping of the form {dim: (before, after)} Number of values padded to the ...
[ "def", "pad_with_fill_value", "(", "self", ",", "pad_widths", "=", "None", ",", "fill_value", "=", "dtypes", ".", "NA", ",", "*", "*", "pad_widths_kwargs", ")", ":", "pad_widths", "=", "either_dict_or_kwargs", "(", "pad_widths", ",", "pad_widths_kwargs", ",", ...
Return a new Variable with paddings. Parameters ---------- pad_width: Mapping of the form {dim: (before, after)} Number of values padded to the edges of each dimension. **pad_widths_kwargs: Keyword argument for pad_widths
[ "Return", "a", "new", "Variable", "with", "paddings", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1023-L1074
train
Returns a new Variable with paddings padded to the edges of each dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.roll
def roll(self, shifts=None, **shifts_kwargs): """ Return a new Variable with rolld data. Parameters ---------- shifts : mapping of the form {dim: offset} Integer offset to roll along each of the given dimensions. Positive offsets roll to the right; negati...
python
def roll(self, shifts=None, **shifts_kwargs): """ Return a new Variable with rolld data. Parameters ---------- shifts : mapping of the form {dim: offset} Integer offset to roll along each of the given dimensions. Positive offsets roll to the right; negati...
[ "def", "roll", "(", "self", ",", "shifts", "=", "None", ",", "*", "*", "shifts_kwargs", ")", ":", "shifts", "=", "either_dict_or_kwargs", "(", "shifts", ",", "shifts_kwargs", ",", "'roll'", ")", "result", "=", "self", "for", "dim", ",", "count", "in", ...
Return a new Variable with rolld data. Parameters ---------- shifts : mapping of the form {dim: offset} Integer offset to roll along each of the given dimensions. Positive offsets roll to the right; negative offsets roll to the left. **shifts_kwargs: ...
[ "Return", "a", "new", "Variable", "with", "rolld", "data", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1098-L1122
train
Return a new Variable with rolld data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.transpose
def transpose(self, *dims) -> 'Variable': """Return a new Variable object with transposed dimensions. Parameters ---------- *dims : str, optional By default, reverse the dimensions. Otherwise, reorder the dimensions to this order. Returns -------...
python
def transpose(self, *dims) -> 'Variable': """Return a new Variable object with transposed dimensions. Parameters ---------- *dims : str, optional By default, reverse the dimensions. Otherwise, reorder the dimensions to this order. Returns -------...
[ "def", "transpose", "(", "self", ",", "*", "dims", ")", "->", "'Variable'", ":", "if", "len", "(", "dims", ")", "==", "0", ":", "dims", "=", "self", ".", "dims", "[", ":", ":", "-", "1", "]", "axes", "=", "self", ".", "get_axis_num", "(", "dims...
Return a new Variable object with transposed dimensions. Parameters ---------- *dims : str, optional By default, reverse the dimensions. Otherwise, reorder the dimensions to this order. Returns ------- transposed : Variable The return...
[ "Return", "a", "new", "Variable", "object", "with", "transposed", "dimensions", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1124-L1156
train
Return a new Variable object with transposed dimensions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.set_dims
def set_dims(self, dims, shape=None): """Return a new variable with given set of dimensions. This method might be used to attach new dimension(s) to variable. When possible, this operation does not copy this variable's data. Parameters ---------- dims : str or sequence ...
python
def set_dims(self, dims, shape=None): """Return a new variable with given set of dimensions. This method might be used to attach new dimension(s) to variable. When possible, this operation does not copy this variable's data. Parameters ---------- dims : str or sequence ...
[ "def", "set_dims", "(", "self", ",", "dims", ",", "shape", "=", "None", ")", ":", "if", "isinstance", "(", "dims", ",", "str", ")", ":", "dims", "=", "[", "dims", "]", "if", "shape", "is", "None", "and", "utils", ".", "is_dict_like", "(", "dims", ...
Return a new variable with given set of dimensions. This method might be used to attach new dimension(s) to variable. When possible, this operation does not copy this variable's data. Parameters ---------- dims : str or sequence of str or dict Dimensions to include ...
[ "Return", "a", "new", "variable", "with", "given", "set", "of", "dimensions", ".", "This", "method", "might", "be", "used", "to", "attach", "new", "dimension", "(", "s", ")", "to", "variable", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1169-L1215
train
Return a new Variable with given set of dimensions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.stack
def stack(self, dimensions=None, **dimensions_kwargs): """ Stack any number of existing dimensions into a single new dimension. New dimensions will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order. Parameters ------...
python
def stack(self, dimensions=None, **dimensions_kwargs): """ Stack any number of existing dimensions into a single new dimension. New dimensions will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order. Parameters ------...
[ "def", "stack", "(", "self", ",", "dimensions", "=", "None", ",", "*", "*", "dimensions_kwargs", ")", ":", "dimensions", "=", "either_dict_or_kwargs", "(", "dimensions", ",", "dimensions_kwargs", ",", "'stack'", ")", "result", "=", "self", "for", "new_dim", ...
Stack any number of existing dimensions into a single new dimension. New dimensions will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order. Parameters ---------- dimensions : Mapping of form new_name=(dim1, dim2, ...) ...
[ "Stack", "any", "number", "of", "existing", "dimensions", "into", "a", "single", "new", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1240-L1270
train
Stack any number of existing dimensions into a single new dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.unstack
def unstack(self, dimensions=None, **dimensions_kwargs): """ Unstack an existing dimension into multiple new dimensions. New dimensions will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order. Parameters ---------- ...
python
def unstack(self, dimensions=None, **dimensions_kwargs): """ Unstack an existing dimension into multiple new dimensions. New dimensions will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order. Parameters ---------- ...
[ "def", "unstack", "(", "self", ",", "dimensions", "=", "None", ",", "*", "*", "dimensions_kwargs", ")", ":", "dimensions", "=", "either_dict_or_kwargs", "(", "dimensions", ",", "dimensions_kwargs", ",", "'unstack'", ")", "result", "=", "self", "for", "old_dim"...
Unstack an existing dimension into multiple new dimensions. New dimensions will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order. Parameters ---------- dimensions : mapping of the form old_dim={dim1: size1, ...} ...
[ "Unstack", "an", "existing", "dimension", "into", "multiple", "new", "dimensions", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1298-L1328
train
Unstack an existing dimension into multiple new dimensions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.reduce
def reduce(self, func, dim=None, axis=None, keep_attrs=None, allow_lazy=False, **kwargs): """Reduce this array by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `func(x, axis=...
python
def reduce(self, func, dim=None, axis=None, keep_attrs=None, allow_lazy=False, **kwargs): """Reduce this array by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `func(x, axis=...
[ "def", "reduce", "(", "self", ",", "func", ",", "dim", "=", "None", ",", "axis", "=", "None", ",", "keep_attrs", "=", "None", ",", "allow_lazy", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "dim", "is", "common", ".", "ALL_DIMS", ":", "...
Reduce this array by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `func(x, axis=axis, **kwargs)` to return the result of reducing an np.ndarray over an integer valued axis. dim...
[ "Reduce", "this", "array", "by", "applying", "func", "along", "some", "dimension", "(", "s", ")", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1336-L1391
train
Reduce this array by applying func along some dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.concat
def concat(cls, variables, dim='concat_dim', positions=None, shortcut=False): """Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have ...
python
def concat(cls, variables, dim='concat_dim', positions=None, shortcut=False): """Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have ...
[ "def", "concat", "(", "cls", ",", "variables", ",", "dim", "=", "'concat_dim'", ",", "positions", "=", "None", ",", "shortcut", "=", "False", ")", ":", "if", "not", "isinstance", "(", "dim", ",", "str", ")", ":", "dim", ",", "=", "dim", ".", "dims"...
Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have matching dimensions and shape except for along the stacked dimension. dim : str or...
[ "Concatenate", "variables", "along", "a", "new", "or", "existing", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1394-L1458
train
Concatenate a list of ArrayLogEntry objects along a new or existing dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.equals
def equals(self, other, equiv=duck_array_ops.array_equiv): """True if two Variables have the same dimensions and values; otherwise False. Variables can still be equal (like pandas objects) if they have NaN values in the same locations. This method is necessary because `v1 == v2...
python
def equals(self, other, equiv=duck_array_ops.array_equiv): """True if two Variables have the same dimensions and values; otherwise False. Variables can still be equal (like pandas objects) if they have NaN values in the same locations. This method is necessary because `v1 == v2...
[ "def", "equals", "(", "self", ",", "other", ",", "equiv", "=", "duck_array_ops", ".", "array_equiv", ")", ":", "other", "=", "getattr", "(", "other", ",", "'variable'", ",", "other", ")", "try", ":", "return", "(", "self", ".", "dims", "==", "other", ...
True if two Variables have the same dimensions and values; otherwise False. Variables can still be equal (like pandas objects) if they have NaN values in the same locations. This method is necessary because `v1 == v2` for Variables does element-wise comparisons (like numpy.ndar...
[ "True", "if", "two", "Variables", "have", "the", "same", "dimensions", "and", "values", ";", "otherwise", "False", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1460-L1476
train
True if two Variables have the same dimensions and values ; otherwise False.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.broadcast_equals
def broadcast_equals(self, other, equiv=duck_array_ops.array_equiv): """True if two Variables have the values after being broadcast against each other; otherwise False. Variables can still be equal (like pandas objects) if they have NaN values in the same locations. """ ...
python
def broadcast_equals(self, other, equiv=duck_array_ops.array_equiv): """True if two Variables have the values after being broadcast against each other; otherwise False. Variables can still be equal (like pandas objects) if they have NaN values in the same locations. """ ...
[ "def", "broadcast_equals", "(", "self", ",", "other", ",", "equiv", "=", "duck_array_ops", ".", "array_equiv", ")", ":", "try", ":", "self", ",", "other", "=", "broadcast_variables", "(", "self", ",", "other", ")", "except", "(", "ValueError", ",", "Attrib...
True if two Variables have the values after being broadcast against each other; otherwise False. Variables can still be equal (like pandas objects) if they have NaN values in the same locations.
[ "True", "if", "two", "Variables", "have", "the", "values", "after", "being", "broadcast", "against", "each", "other", ";", "otherwise", "False", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1478-L1489
train
True if two Variables have the values after being broadcast against each other.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.identical
def identical(self, other): """Like equals, but also checks attributes. """ try: return (utils.dict_equiv(self.attrs, other.attrs) and self.equals(other)) except (TypeError, AttributeError): return False
python
def identical(self, other): """Like equals, but also checks attributes. """ try: return (utils.dict_equiv(self.attrs, other.attrs) and self.equals(other)) except (TypeError, AttributeError): return False
[ "def", "identical", "(", "self", ",", "other", ")", ":", "try", ":", "return", "(", "utils", ".", "dict_equiv", "(", "self", ".", "attrs", ",", "other", ".", "attrs", ")", "and", "self", ".", "equals", "(", "other", ")", ")", "except", "(", "TypeEr...
Like equals, but also checks attributes.
[ "Like", "equals", "but", "also", "checks", "attributes", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1491-L1498
train
Like equals but also checks attributes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.quantile
def quantile(self, q, dim=None, interpolation='linear'): """Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float in range of [0,1] (or sequence of floats) Quantile to ...
python
def quantile(self, q, dim=None, interpolation='linear'): """Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float in range of [0,1] (or sequence of floats) Quantile to ...
[ "def", "quantile", "(", "self", ",", "q", ",", "dim", "=", "None", ",", "interpolation", "=", "'linear'", ")", ":", "if", "isinstance", "(", "self", ".", "data", ",", "dask_array_type", ")", ":", "raise", "TypeError", "(", "\"quantile does not work for array...
Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float in range of [0,1] (or sequence of floats) Quantile to compute, which must be between 0 and 1 inclusive. ...
[ "Compute", "the", "qth", "quantile", "of", "the", "data", "along", "the", "specified", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1510-L1573
train
Compute the qth quantile of the data along the specified dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.rank
def rank(self, dim, pct=False): """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`, computes percentage ranks. NaNs in the input ar...
python
def rank(self, dim, pct=False): """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`, computes percentage ranks. NaNs in the input ar...
[ "def", "rank", "(", "self", ",", "dim", ",", "pct", "=", "False", ")", ":", "import", "bottleneck", "as", "bn", "if", "isinstance", "(", "self", ".", "data", ",", "dask_array_type", ")", ":", "raise", "TypeError", "(", "\"rank does not work for arrays stored...
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`, computes percentage ranks. NaNs in the input array are returned as NaNs. The `bot...
[ "Ranks", "the", "data", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1575-L1614
train
Ranks the data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.rolling_window
def rolling_window(self, dim, window, window_dim, center=False, fill_value=dtypes.NA): """ Make a rolling_window along dim and add a new_dim to the last place. Parameters ---------- dim: str Dimension over which to compute rolling_window ...
python
def rolling_window(self, dim, window, window_dim, center=False, fill_value=dtypes.NA): """ Make a rolling_window along dim and add a new_dim to the last place. Parameters ---------- dim: str Dimension over which to compute rolling_window ...
[ "def", "rolling_window", "(", "self", ",", "dim", ",", "window", ",", "window_dim", ",", "center", "=", "False", ",", "fill_value", "=", "dtypes", ".", "NA", ")", ":", "if", "fill_value", "is", "dtypes", ".", "NA", ":", "# np.nan is passed", "dtype", ","...
Make a rolling_window along dim and add a new_dim to the last place. Parameters ---------- dim: str Dimension over which to compute rolling_window window: int Window size of the rolling window_dim: str New name of the window dimension. ...
[ "Make", "a", "rolling_window", "along", "dim", "and", "add", "a", "new_dim", "to", "the", "last", "place", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1616-L1665
train
This function creates a rolling_window of the array along dim and adds a new_dim to the last place.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable.coarsen
def coarsen(self, windows, func, boundary='exact', side='left'): """ Apply """ windows = {k: v for k, v in windows.items() if k in self.dims} if not windows: return self.copy() reshaped, axes = self._coarsen_reshape(windows, boundary, side) if isinsta...
python
def coarsen(self, windows, func, boundary='exact', side='left'): """ Apply """ windows = {k: v for k, v in windows.items() if k in self.dims} if not windows: return self.copy() reshaped, axes = self._coarsen_reshape(windows, boundary, side) if isinsta...
[ "def", "coarsen", "(", "self", ",", "windows", ",", "func", ",", "boundary", "=", "'exact'", ",", "side", "=", "'left'", ")", ":", "windows", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "windows", ".", "items", "(", ")", "if", "k", "in...
Apply
[ "Apply" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1667-L1681
train
Return a new array with coarsened data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._coarsen_reshape
def _coarsen_reshape(self, windows, boundary, side): """ Construct a reshaped-array for corsen """ if not utils.is_dict_like(boundary): boundary = {d: boundary for d in windows.keys()} if not utils.is_dict_like(side): side = {d: side for d in windows.keys...
python
def _coarsen_reshape(self, windows, boundary, side): """ Construct a reshaped-array for corsen """ if not utils.is_dict_like(boundary): boundary = {d: boundary for d in windows.keys()} if not utils.is_dict_like(side): side = {d: side for d in windows.keys...
[ "def", "_coarsen_reshape", "(", "self", ",", "windows", ",", "boundary", ",", "side", ")", ":", "if", "not", "utils", ".", "is_dict_like", "(", "boundary", ")", ":", "boundary", "=", "{", "d", ":", "boundary", "for", "d", "in", "windows", ".", "keys", ...
Construct a reshaped-array for corsen
[ "Construct", "a", "reshaped", "-", "array", "for", "corsen" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1683-L1744
train
Construct a reshaped array for corsen .
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
Variable._to_numeric
def _to_numeric(self, offset=None, datetime_unit=None, dtype=float): """ A (private) method to convert datetime array to numeric dtype See duck_array_ops.datetime_to_numeric """ numeric_array = duck_array_ops.datetime_to_numeric( self.data, offset, datetime_unit, dtype) ...
python
def _to_numeric(self, offset=None, datetime_unit=None, dtype=float): """ A (private) method to convert datetime array to numeric dtype See duck_array_ops.datetime_to_numeric """ numeric_array = duck_array_ops.datetime_to_numeric( self.data, offset, datetime_unit, dtype) ...
[ "def", "_to_numeric", "(", "self", ",", "offset", "=", "None", ",", "datetime_unit", "=", "None", ",", "dtype", "=", "float", ")", ":", "numeric_array", "=", "duck_array_ops", ".", "datetime_to_numeric", "(", "self", ".", "data", ",", "offset", ",", "datet...
A (private) method to convert datetime array to numeric dtype See duck_array_ops.datetime_to_numeric
[ "A", "(", "private", ")", "method", "to", "convert", "datetime", "array", "to", "numeric", "dtype", "See", "duck_array_ops", ".", "datetime_to_numeric" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1797-L1803
train
Convert the object to numeric.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
IndexVariable.concat
def concat(cls, variables, dim='concat_dim', positions=None, shortcut=False): """Specialized version of Variable.concat for IndexVariable objects. This exists because we want to avoid converting Index objects to NumPy arrays, if possible. """ if not isinstance(dim...
python
def concat(cls, variables, dim='concat_dim', positions=None, shortcut=False): """Specialized version of Variable.concat for IndexVariable objects. This exists because we want to avoid converting Index objects to NumPy arrays, if possible. """ if not isinstance(dim...
[ "def", "concat", "(", "cls", ",", "variables", ",", "dim", "=", "'concat_dim'", ",", "positions", "=", "None", ",", "shortcut", "=", "False", ")", ":", "if", "not", "isinstance", "(", "dim", ",", "str", ")", ":", "dim", ",", "=", "dim", ".", "dims"...
Specialized version of Variable.concat for IndexVariable objects. This exists because we want to avoid converting Index objects to NumPy arrays, if possible.
[ "Specialized", "version", "of", "Variable", ".", "concat", "for", "IndexVariable", "objects", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1858-L1894
train
Specialized version of Variable. concat for IndexVariable objects.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
IndexVariable.copy
def copy(self, deep=True, data=None): """Returns a copy of this object. `deep` is ignored since data is stored in the form of pandas.Index, which is already immutable. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same struct...
python
def copy(self, deep=True, data=None): """Returns a copy of this object. `deep` is ignored since data is stored in the form of pandas.Index, which is already immutable. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same struct...
[ "def", "copy", "(", "self", ",", "deep", "=", "True", ",", "data", "=", "None", ")", ":", "if", "data", "is", "None", ":", "data", "=", "self", ".", "_data", "else", ":", "data", "=", "as_compatible_data", "(", "data", ")", "if", "self", ".", "sh...
Returns a copy of this object. `deep` is ignored since data is stored in the form of pandas.Index, which is already immutable. Dimensions, attributes and encodings are always copied. Use `data` to create a new object with the same structure as original but entirely new data. ...
[ "Returns", "a", "copy", "of", "this", "object", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1896-L1927
train
Returns a copy of this VariableReservedEntry object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
IndexVariable.to_index
def to_index(self): """Convert this variable to a pandas.Index""" # n.b. creating a new pandas.Index from an old pandas.Index is # basically free as pandas.Index objects are immutable assert self.ndim == 1 index = self._data.array if isinstance(index, pd.MultiIndex): ...
python
def to_index(self): """Convert this variable to a pandas.Index""" # n.b. creating a new pandas.Index from an old pandas.Index is # basically free as pandas.Index objects are immutable assert self.ndim == 1 index = self._data.array if isinstance(index, pd.MultiIndex): ...
[ "def", "to_index", "(", "self", ")", ":", "# n.b. creating a new pandas.Index from an old pandas.Index is", "# basically free as pandas.Index objects are immutable", "assert", "self", ".", "ndim", "==", "1", "index", "=", "self", ".", "_data", ".", "array", "if", "isinsta...
Convert this variable to a pandas.Index
[ "Convert", "this", "variable", "to", "a", "pandas", ".", "Index" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1951-L1965
train
Convert this variable to a pandas. Index.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
IndexVariable.level_names
def level_names(self): """Return MultiIndex level names or None if this IndexVariable has no MultiIndex. """ index = self.to_index() if isinstance(index, pd.MultiIndex): return index.names else: return None
python
def level_names(self): """Return MultiIndex level names or None if this IndexVariable has no MultiIndex. """ index = self.to_index() if isinstance(index, pd.MultiIndex): return index.names else: return None
[ "def", "level_names", "(", "self", ")", ":", "index", "=", "self", ".", "to_index", "(", ")", "if", "isinstance", "(", "index", ",", "pd", ".", "MultiIndex", ")", ":", "return", "index", ".", "names", "else", ":", "return", "None" ]
Return MultiIndex level names or None if this IndexVariable has no MultiIndex.
[ "Return", "MultiIndex", "level", "names", "or", "None", "if", "this", "IndexVariable", "has", "no", "MultiIndex", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1968-L1976
train
Return the level names of this IndexVariable or None if this IndexVariable has no MultiIndex.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/variable.py
IndexVariable.get_level_variable
def get_level_variable(self, level): """Return a new IndexVariable from a given MultiIndex level.""" if self.level_names is None: raise ValueError("IndexVariable %r has no MultiIndex" % self.name) index = self.to_index() return type(self)(self.dims, index.get_level_values(lev...
python
def get_level_variable(self, level): """Return a new IndexVariable from a given MultiIndex level.""" if self.level_names is None: raise ValueError("IndexVariable %r has no MultiIndex" % self.name) index = self.to_index() return type(self)(self.dims, index.get_level_values(lev...
[ "def", "get_level_variable", "(", "self", ",", "level", ")", ":", "if", "self", ".", "level_names", "is", "None", ":", "raise", "ValueError", "(", "\"IndexVariable %r has no MultiIndex\"", "%", "self", ".", "name", ")", "index", "=", "self", ".", "to_index", ...
Return a new IndexVariable from a given MultiIndex level.
[ "Return", "a", "new", "IndexVariable", "from", "a", "given", "MultiIndex", "level", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1978-L1983
train
Return a new IndexVariable from a given MultiIndex level.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
_parsed_string_to_bounds
def _parsed_string_to_bounds(date_type, resolution, parsed): """Generalization of pandas.tseries.index.DatetimeIndex._parsed_string_to_bounds for use with non-standard calendars and cftime.datetime objects. """ if resolution == 'year': return (date_type(parsed.year, 1, 1), ...
python
def _parsed_string_to_bounds(date_type, resolution, parsed): """Generalization of pandas.tseries.index.DatetimeIndex._parsed_string_to_bounds for use with non-standard calendars and cftime.datetime objects. """ if resolution == 'year': return (date_type(parsed.year, 1, 1), ...
[ "def", "_parsed_string_to_bounds", "(", "date_type", ",", "resolution", ",", "parsed", ")", ":", "if", "resolution", "==", "'year'", ":", "return", "(", "date_type", "(", "parsed", ".", "year", ",", "1", ",", "1", ")", ",", "date_type", "(", "parsed", "....
Generalization of pandas.tseries.index.DatetimeIndex._parsed_string_to_bounds for use with non-standard calendars and cftime.datetime objects.
[ "Generalization", "of", "pandas", ".", "tseries", ".", "index", ".", "DatetimeIndex", ".", "_parsed_string_to_bounds", "for", "use", "with", "non", "-", "standard", "calendars", "and", "cftime", ".", "datetime", "objects", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L117-L148
train
Generalization of pandas. tseries. index. DatetimeIndex. _parsed_string_to_bounds for use with non - standard calendars and cftime. datetime objects.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
get_date_field
def get_date_field(datetimes, field): """Adapted from pandas.tslib.get_date_field""" return np.array([getattr(date, field) for date in datetimes])
python
def get_date_field(datetimes, field): """Adapted from pandas.tslib.get_date_field""" return np.array([getattr(date, field) for date in datetimes])
[ "def", "get_date_field", "(", "datetimes", ",", "field", ")", ":", "return", "np", ".", "array", "(", "[", "getattr", "(", "date", ",", "field", ")", "for", "date", "in", "datetimes", "]", ")" ]
Adapted from pandas.tslib.get_date_field
[ "Adapted", "from", "pandas", ".", "tslib", ".", "get_date_field" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L151-L153
train
Adapted from pandas. tslib. get_date_field
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
_field_accessor
def _field_accessor(name, docstring=None, min_cftime_version='0.0'): """Adapted from pandas.tseries.index._field_accessor""" def f(self, min_cftime_version=min_cftime_version): import cftime version = cftime.__version__ if LooseVersion(version) >= LooseVersion(min_cftime_version): ...
python
def _field_accessor(name, docstring=None, min_cftime_version='0.0'): """Adapted from pandas.tseries.index._field_accessor""" def f(self, min_cftime_version=min_cftime_version): import cftime version = cftime.__version__ if LooseVersion(version) >= LooseVersion(min_cftime_version): ...
[ "def", "_field_accessor", "(", "name", ",", "docstring", "=", "None", ",", "min_cftime_version", "=", "'0.0'", ")", ":", "def", "f", "(", "self", ",", "min_cftime_version", "=", "min_cftime_version", ")", ":", "import", "cftime", "version", "=", "cftime", "....
Adapted from pandas.tseries.index._field_accessor
[ "Adapted", "from", "pandas", ".", "tseries", ".", "index", ".", "_field_accessor" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L156-L174
train
Returns a property that can be used to access the given field.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
_parse_array_of_cftime_strings
def _parse_array_of_cftime_strings(strings, date_type): """Create a numpy array from an array of strings. For use in generating dates from strings for use with interp. Assumes the array is either 0-dimensional or 1-dimensional. Parameters ---------- strings : array of strings Strings ...
python
def _parse_array_of_cftime_strings(strings, date_type): """Create a numpy array from an array of strings. For use in generating dates from strings for use with interp. Assumes the array is either 0-dimensional or 1-dimensional. Parameters ---------- strings : array of strings Strings ...
[ "def", "_parse_array_of_cftime_strings", "(", "strings", ",", "date_type", ")", ":", "return", "np", ".", "array", "(", "[", "_parse_iso8601_without_reso", "(", "date_type", ",", "s", ")", "for", "s", "in", "strings", ".", "ravel", "(", ")", "]", ")", ".",...
Create a numpy array from an array of strings. For use in generating dates from strings for use with interp. Assumes the array is either 0-dimensional or 1-dimensional. Parameters ---------- strings : array of strings Strings to convert to dates date_type : cftime.datetime type ...
[ "Create", "a", "numpy", "array", "from", "an", "array", "of", "strings", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L485-L503
train
Create a numpy array from an array of strings.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex._partial_date_slice
def _partial_date_slice(self, resolution, parsed): """Adapted from pandas.tseries.index.DatetimeIndex._partial_date_slice Note that when using a CFTimeIndex, if a partial-date selection returns a single element, it will never be converted to a scalar coordinate; this is in sligh...
python
def _partial_date_slice(self, resolution, parsed): """Adapted from pandas.tseries.index.DatetimeIndex._partial_date_slice Note that when using a CFTimeIndex, if a partial-date selection returns a single element, it will never be converted to a scalar coordinate; this is in sligh...
[ "def", "_partial_date_slice", "(", "self", ",", "resolution", ",", "parsed", ")", ":", "start", ",", "end", "=", "_parsed_string_to_bounds", "(", "self", ".", "date_type", ",", "resolution", ",", "parsed", ")", "times", "=", "self", ".", "_data", "if", "se...
Adapted from pandas.tseries.index.DatetimeIndex._partial_date_slice Note that when using a CFTimeIndex, if a partial-date selection returns a single element, it will never be converted to a scalar coordinate; this is in slight contrast to the behavior when using a DatetimeIndex,...
[ "Adapted", "from", "pandas", ".", "tseries", ".", "index", ".", "DatetimeIndex", ".", "_partial_date_slice" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L241-L301
train
Adapted from pandas. tseries. index. DatetimeIndex. _partial_date_slice
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex._get_string_slice
def _get_string_slice(self, key): """Adapted from pandas.tseries.index.DatetimeIndex._get_string_slice""" parsed, resolution = _parse_iso8601_with_reso(self.date_type, key) try: loc = self._partial_date_slice(resolution, parsed) except KeyError: raise KeyError(key...
python
def _get_string_slice(self, key): """Adapted from pandas.tseries.index.DatetimeIndex._get_string_slice""" parsed, resolution = _parse_iso8601_with_reso(self.date_type, key) try: loc = self._partial_date_slice(resolution, parsed) except KeyError: raise KeyError(key...
[ "def", "_get_string_slice", "(", "self", ",", "key", ")", ":", "parsed", ",", "resolution", "=", "_parse_iso8601_with_reso", "(", "self", ".", "date_type", ",", "key", ")", "try", ":", "loc", "=", "self", ".", "_partial_date_slice", "(", "resolution", ",", ...
Adapted from pandas.tseries.index.DatetimeIndex._get_string_slice
[ "Adapted", "from", "pandas", ".", "tseries", ".", "index", ".", "DatetimeIndex", ".", "_get_string_slice" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L303-L310
train
Adapted from pandas. tseries. index. DatetimeIndex. _get_string_slice
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex.get_loc
def get_loc(self, key, method=None, tolerance=None): """Adapted from pandas.tseries.index.DatetimeIndex.get_loc""" if isinstance(key, str): return self._get_string_slice(key) else: return pd.Index.get_loc(self, key, method=method, toler...
python
def get_loc(self, key, method=None, tolerance=None): """Adapted from pandas.tseries.index.DatetimeIndex.get_loc""" if isinstance(key, str): return self._get_string_slice(key) else: return pd.Index.get_loc(self, key, method=method, toler...
[ "def", "get_loc", "(", "self", ",", "key", ",", "method", "=", "None", ",", "tolerance", "=", "None", ")", ":", "if", "isinstance", "(", "key", ",", "str", ")", ":", "return", "self", ".", "_get_string_slice", "(", "key", ")", "else", ":", "return", ...
Adapted from pandas.tseries.index.DatetimeIndex.get_loc
[ "Adapted", "from", "pandas", ".", "tseries", ".", "index", ".", "DatetimeIndex", ".", "get_loc" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L312-L318
train
Adapted from pandas. tseries. index. DatetimeIndex. get_loc
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex._maybe_cast_slice_bound
def _maybe_cast_slice_bound(self, label, side, kind): """Adapted from pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound""" if isinstance(label, str): parsed, resolution = _parse_iso8601_with_reso(self.date_type, label...
python
def _maybe_cast_slice_bound(self, label, side, kind): """Adapted from pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound""" if isinstance(label, str): parsed, resolution = _parse_iso8601_with_reso(self.date_type, label...
[ "def", "_maybe_cast_slice_bound", "(", "self", ",", "label", ",", "side", ",", "kind", ")", ":", "if", "isinstance", "(", "label", ",", "str", ")", ":", "parsed", ",", "resolution", "=", "_parse_iso8601_with_reso", "(", "self", ".", "date_type", ",", "labe...
Adapted from pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound
[ "Adapted", "from", "pandas", ".", "tseries", ".", "index", ".", "DatetimeIndex", ".", "_maybe_cast_slice_bound" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L320-L332
train
Adapted from pandas. tseries. index. DatetimeIndex. _maybe_cast_slice_bound
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex.get_value
def get_value(self, series, key): """Adapted from pandas.tseries.index.DatetimeIndex.get_value""" if np.asarray(key).dtype == np.dtype(bool): return series.iloc[key] elif isinstance(key, slice): return series.iloc[self.slice_indexer( key.start, key.stop, k...
python
def get_value(self, series, key): """Adapted from pandas.tseries.index.DatetimeIndex.get_value""" if np.asarray(key).dtype == np.dtype(bool): return series.iloc[key] elif isinstance(key, slice): return series.iloc[self.slice_indexer( key.start, key.stop, k...
[ "def", "get_value", "(", "self", ",", "series", ",", "key", ")", ":", "if", "np", ".", "asarray", "(", "key", ")", ".", "dtype", "==", "np", ".", "dtype", "(", "bool", ")", ":", "return", "series", ".", "iloc", "[", "key", "]", "elif", "isinstanc...
Adapted from pandas.tseries.index.DatetimeIndex.get_value
[ "Adapted", "from", "pandas", ".", "tseries", ".", "index", ".", "DatetimeIndex", ".", "get_value" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L336-L344
train
Adapted from pandas. tseries. index. DatetimeIndex. get_value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex.shift
def shift(self, n, freq): """Shift the CFTimeIndex a multiple of the given frequency. See the documentation for :py:func:`~xarray.cftime_range` for a complete listing of valid frequency strings. Parameters ---------- n : int Periods to shift by freq ...
python
def shift(self, n, freq): """Shift the CFTimeIndex a multiple of the given frequency. See the documentation for :py:func:`~xarray.cftime_range` for a complete listing of valid frequency strings. Parameters ---------- n : int Periods to shift by freq ...
[ "def", "shift", "(", "self", ",", "n", ",", "freq", ")", ":", "from", ".", "cftime_offsets", "import", "to_offset", "if", "not", "isinstance", "(", "n", ",", "int", ")", ":", "raise", "TypeError", "(", "\"'n' must be an int, got {}.\"", ".", "format", "(",...
Shift the CFTimeIndex a multiple of the given frequency. See the documentation for :py:func:`~xarray.cftime_range` for a complete listing of valid frequency strings. Parameters ---------- n : int Periods to shift by freq : str or datetime.timedelta ...
[ "Shift", "the", "CFTimeIndex", "a", "multiple", "of", "the", "given", "frequency", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L360-L400
train
Shift the CFTimeIndex a multiple of the given frequency.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftimeindex.py
CFTimeIndex.to_datetimeindex
def to_datetimeindex(self, unsafe=False): """If possible, convert this index to a pandas.DatetimeIndex. Parameters ---------- unsafe : bool Flag to turn off warning when converting from a CFTimeIndex with a non-standard calendar to a DatetimeIndex (default ``Fals...
python
def to_datetimeindex(self, unsafe=False): """If possible, convert this index to a pandas.DatetimeIndex. Parameters ---------- unsafe : bool Flag to turn off warning when converting from a CFTimeIndex with a non-standard calendar to a DatetimeIndex (default ``Fals...
[ "def", "to_datetimeindex", "(", "self", ",", "unsafe", "=", "False", ")", ":", "# noqa: E501", "nptimes", "=", "cftime_to_nptime", "(", "self", ")", "calendar", "=", "infer_calendar_name", "(", "self", ")", "if", "calendar", "not", "in", "_STANDARD_CALENDARS", ...
If possible, convert this index to a pandas.DatetimeIndex. Parameters ---------- unsafe : bool Flag to turn off warning when converting from a CFTimeIndex with a non-standard calendar to a DatetimeIndex (default ``False``). Returns ------- pandas...
[ "If", "possible", "convert", "this", "index", "to", "a", "pandas", ".", "DatetimeIndex", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L429-L477
train
Convert this index to a pandas. DatetimeIndex.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
_dask_or_eager_func
def _dask_or_eager_func(name, eager_module=np, dask_module=dask_array, list_of_args=False, array_args=slice(1), requires_dask=None): """Create a function that dispatches to dask for dask array inputs.""" if dask_module is not None: def f(*args, **kwargs): ...
python
def _dask_or_eager_func(name, eager_module=np, dask_module=dask_array, list_of_args=False, array_args=slice(1), requires_dask=None): """Create a function that dispatches to dask for dask array inputs.""" if dask_module is not None: def f(*args, **kwargs): ...
[ "def", "_dask_or_eager_func", "(", "name", ",", "eager_module", "=", "np", ",", "dask_module", "=", "dask_array", ",", "list_of_args", "=", "False", ",", "array_args", "=", "slice", "(", "1", ")", ",", "requires_dask", "=", "None", ")", ":", "if", "dask_mo...
Create a function that dispatches to dask for dask array inputs.
[ "Create", "a", "function", "that", "dispatches", "to", "dask", "for", "dask", "array", "inputs", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L26-L48
train
Create a function that dispatches to dask for dask array inputs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
as_shared_dtype
def as_shared_dtype(scalars_or_arrays): """Cast a arrays to a shared dtype using xarray's type promotion rules.""" arrays = [asarray(x) for x in scalars_or_arrays] # Pass arrays directly instead of dtypes to result_type so scalars # get handled properly. # Note that result_type() safely gets the dty...
python
def as_shared_dtype(scalars_or_arrays): """Cast a arrays to a shared dtype using xarray's type promotion rules.""" arrays = [asarray(x) for x in scalars_or_arrays] # Pass arrays directly instead of dtypes to result_type so scalars # get handled properly. # Note that result_type() safely gets the dty...
[ "def", "as_shared_dtype", "(", "scalars_or_arrays", ")", ":", "arrays", "=", "[", "asarray", "(", "x", ")", "for", "x", "in", "scalars_or_arrays", "]", "# Pass arrays directly instead of dtypes to result_type so scalars", "# get handled properly.", "# Note that result_type() ...
Cast a arrays to a shared dtype using xarray's type promotion rules.
[ "Cast", "a", "arrays", "to", "a", "shared", "dtype", "using", "xarray", "s", "type", "promotion", "rules", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L123-L131
train
Cast a list of scalars to a shared dtype using xarray s type promotion rules.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
allclose_or_equiv
def allclose_or_equiv(arr1, arr2, rtol=1e-5, atol=1e-8): """Like np.allclose, but also allows values to be NaN in both arrays """ arr1, arr2 = as_like_arrays(arr1, arr2) if arr1.shape != arr2.shape: return False return bool( isclose(arr1, arr2, rtol=rtol, atol=atol, equal_nan=True).a...
python
def allclose_or_equiv(arr1, arr2, rtol=1e-5, atol=1e-8): """Like np.allclose, but also allows values to be NaN in both arrays """ arr1, arr2 = as_like_arrays(arr1, arr2) if arr1.shape != arr2.shape: return False return bool( isclose(arr1, arr2, rtol=rtol, atol=atol, equal_nan=True).a...
[ "def", "allclose_or_equiv", "(", "arr1", ",", "arr2", ",", "rtol", "=", "1e-5", ",", "atol", "=", "1e-8", ")", ":", "arr1", ",", "arr2", "=", "as_like_arrays", "(", "arr1", ",", "arr2", ")", "if", "arr1", ".", "shape", "!=", "arr2", ".", "shape", "...
Like np.allclose, but also allows values to be NaN in both arrays
[ "Like", "np", ".", "allclose", "but", "also", "allows", "values", "to", "be", "NaN", "in", "both", "arrays" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L141-L148
train
Like np. allclose but also allows values to be NaN in both arrays
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
array_equiv
def array_equiv(arr1, arr2): """Like np.array_equal, but also allows values to be NaN in both arrays """ arr1, arr2 = as_like_arrays(arr1, arr2) if arr1.shape != arr2.shape: return False with warnings.catch_warnings(): warnings.filterwarnings('ignore', "In the future, 'NAT == x'") ...
python
def array_equiv(arr1, arr2): """Like np.array_equal, but also allows values to be NaN in both arrays """ arr1, arr2 = as_like_arrays(arr1, arr2) if arr1.shape != arr2.shape: return False with warnings.catch_warnings(): warnings.filterwarnings('ignore', "In the future, 'NAT == x'") ...
[ "def", "array_equiv", "(", "arr1", ",", "arr2", ")", ":", "arr1", ",", "arr2", "=", "as_like_arrays", "(", "arr1", ",", "arr2", ")", "if", "arr1", ".", "shape", "!=", "arr2", ".", "shape", ":", "return", "False", "with", "warnings", ".", "catch_warning...
Like np.array_equal, but also allows values to be NaN in both arrays
[ "Like", "np", ".", "array_equal", "but", "also", "allows", "values", "to", "be", "NaN", "in", "both", "arrays" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L151-L164
train
Like np. array_equal but also allows values to be NaN in both arrays
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
count
def count(data, axis=None): """Count the number of non-NA in this array along the given axis or axes """ return np.sum(np.logical_not(isnull(data)), axis=axis)
python
def count(data, axis=None): """Count the number of non-NA in this array along the given axis or axes """ return np.sum(np.logical_not(isnull(data)), axis=axis)
[ "def", "count", "(", "data", ",", "axis", "=", "None", ")", ":", "return", "np", ".", "sum", "(", "np", ".", "logical_not", "(", "isnull", "(", "data", ")", ")", ",", "axis", "=", "axis", ")" ]
Count the number of non-NA in this array along the given axis or axes
[ "Count", "the", "number", "of", "non", "-", "NA", "in", "this", "array", "along", "the", "given", "axis", "or", "axes" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L185-L188
train
Count the number of non - NA in this array along the given axis or axes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
datetime_to_numeric
def datetime_to_numeric(array, offset=None, datetime_unit=None, dtype=float): """Convert an array containing datetime-like data to an array of floats. Parameters ---------- da : np.array Input data offset: Scalar with the same type of array or None If None, subtract minimum values t...
python
def datetime_to_numeric(array, offset=None, datetime_unit=None, dtype=float): """Convert an array containing datetime-like data to an array of floats. Parameters ---------- da : np.array Input data offset: Scalar with the same type of array or None If None, subtract minimum values t...
[ "def", "datetime_to_numeric", "(", "array", ",", "offset", "=", "None", ",", "datetime_unit", "=", "None", ",", "dtype", "=", "float", ")", ":", "# TODO: make this function dask-compatible?", "if", "offset", "is", "None", ":", "offset", "=", "array", ".", "min...
Convert an array containing datetime-like data to an array of floats. Parameters ---------- da : np.array Input data offset: Scalar with the same type of array or None If None, subtract minimum values to reduce round off error datetime_unit: None or any of {'Y', 'M', 'W', 'D', 'h', ...
[ "Convert", "an", "array", "containing", "datetime", "-", "like", "data", "to", "an", "array", "of", "floats", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L292-L327
train
Convert an array containing datetime - like data to an array of floats.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
mean
def mean(array, axis=None, skipna=None, **kwargs): """inhouse mean that can handle np.datetime64 or cftime.datetime dtypes""" from .common import _contains_cftime_datetimes array = asarray(array) if array.dtype.kind in 'Mm': offset = min(array) # xarray always uses np.datetime64[ns]...
python
def mean(array, axis=None, skipna=None, **kwargs): """inhouse mean that can handle np.datetime64 or cftime.datetime dtypes""" from .common import _contains_cftime_datetimes array = asarray(array) if array.dtype.kind in 'Mm': offset = min(array) # xarray always uses np.datetime64[ns]...
[ "def", "mean", "(", "array", ",", "axis", "=", "None", ",", "skipna", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", ".", "common", "import", "_contains_cftime_datetimes", "array", "=", "asarray", "(", "array", ")", "if", "array", ".", "dtype"...
inhouse mean that can handle np.datetime64 or cftime.datetime dtypes
[ "inhouse", "mean", "that", "can", "handle", "np", ".", "datetime64", "or", "cftime", ".", "datetime", "dtypes" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L335-L359
train
inhouse mean that can handle np. datetime64 or cftime. datetime64 dtypes
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
first
def first(values, axis, skipna=None): """Return the first non-NA elements in this array along the given axis """ if (skipna or skipna is None) and values.dtype.kind not in 'iSU': # only bother for dtypes that can hold NaN _fail_on_dask_array_input_skipna(values) return nanfirst(value...
python
def first(values, axis, skipna=None): """Return the first non-NA elements in this array along the given axis """ if (skipna or skipna is None) and values.dtype.kind not in 'iSU': # only bother for dtypes that can hold NaN _fail_on_dask_array_input_skipna(values) return nanfirst(value...
[ "def", "first", "(", "values", ",", "axis", ",", "skipna", "=", "None", ")", ":", "if", "(", "skipna", "or", "skipna", "is", "None", ")", "and", "values", ".", "dtype", ".", "kind", "not", "in", "'iSU'", ":", "# only bother for dtypes that can hold NaN", ...
Return the first non-NA elements in this array along the given axis
[ "Return", "the", "first", "non", "-", "NA", "elements", "in", "this", "array", "along", "the", "given", "axis" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L393-L400
train
Return the first non - NA elements in this array along the given axis
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
last
def last(values, axis, skipna=None): """Return the last non-NA elements in this array along the given axis """ if (skipna or skipna is None) and values.dtype.kind not in 'iSU': # only bother for dtypes that can hold NaN _fail_on_dask_array_input_skipna(values) return nanlast(values, ...
python
def last(values, axis, skipna=None): """Return the last non-NA elements in this array along the given axis """ if (skipna or skipna is None) and values.dtype.kind not in 'iSU': # only bother for dtypes that can hold NaN _fail_on_dask_array_input_skipna(values) return nanlast(values, ...
[ "def", "last", "(", "values", ",", "axis", ",", "skipna", "=", "None", ")", ":", "if", "(", "skipna", "or", "skipna", "is", "None", ")", "and", "values", ".", "dtype", ".", "kind", "not", "in", "'iSU'", ":", "# only bother for dtypes that can hold NaN", ...
Return the last non-NA elements in this array along the given axis
[ "Return", "the", "last", "non", "-", "NA", "elements", "in", "this", "array", "along", "the", "given", "axis" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L403-L410
train
Return the last non - NA elements in this array along the given axis
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/duck_array_ops.py
rolling_window
def rolling_window(array, axis, window, center, fill_value): """ Make an ndarray with a rolling window of axis-th dimension. The rolling dimension will be placed at the last dimension. """ if isinstance(array, dask_array_type): return dask_array_ops.rolling_window( array, axis, w...
python
def rolling_window(array, axis, window, center, fill_value): """ Make an ndarray with a rolling window of axis-th dimension. The rolling dimension will be placed at the last dimension. """ if isinstance(array, dask_array_type): return dask_array_ops.rolling_window( array, axis, w...
[ "def", "rolling_window", "(", "array", ",", "axis", ",", "window", ",", "center", ",", "fill_value", ")", ":", "if", "isinstance", "(", "array", ",", "dask_array_type", ")", ":", "return", "dask_array_ops", ".", "rolling_window", "(", "array", ",", "axis", ...
Make an ndarray with a rolling window of axis-th dimension. The rolling dimension will be placed at the last dimension.
[ "Make", "an", "ndarray", "with", "a", "rolling", "window", "of", "axis", "-", "th", "dimension", ".", "The", "rolling", "dimension", "will", "be", "placed", "at", "the", "last", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/duck_array_ops.py#L413-L423
train
Make an ndarray with a rolling window of axis - th dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
concat
def concat(objs, dim=None, data_vars='all', coords='different', compat='equals', positions=None, indexers=None, mode=None, concat_over=None): """Concatenate xarray objects along a new or existing dimension. Parameters ---------- objs : sequence of Dataset and DataArray objects ...
python
def concat(objs, dim=None, data_vars='all', coords='different', compat='equals', positions=None, indexers=None, mode=None, concat_over=None): """Concatenate xarray objects along a new or existing dimension. Parameters ---------- objs : sequence of Dataset and DataArray objects ...
[ "def", "concat", "(", "objs", ",", "dim", "=", "None", ",", "data_vars", "=", "'all'", ",", "coords", "=", "'different'", ",", "compat", "=", "'equals'", ",", "positions", "=", "None", ",", "indexers", "=", "None", ",", "mode", "=", "None", ",", "con...
Concatenate xarray objects along a new or existing dimension. Parameters ---------- objs : sequence of Dataset and DataArray objects xarray objects to concatenate together. Each object is expected to consist of variables and coordinates with matching shapes except for along the conc...
[ "Concatenate", "xarray", "objects", "along", "a", "new", "or", "existing", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L15-L120
train
Concatenate two or more xarray objects along a new or existing dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
_calc_concat_dim_coord
def _calc_concat_dim_coord(dim): """ Infer the dimension name and 1d coordinate variable (if appropriate) for concatenating along the new dimension. """ from .dataarray import DataArray if isinstance(dim, str): coord = None elif not isinstance(dim, (DataArray, Variable)): di...
python
def _calc_concat_dim_coord(dim): """ Infer the dimension name and 1d coordinate variable (if appropriate) for concatenating along the new dimension. """ from .dataarray import DataArray if isinstance(dim, str): coord = None elif not isinstance(dim, (DataArray, Variable)): di...
[ "def", "_calc_concat_dim_coord", "(", "dim", ")", ":", "from", ".", "dataarray", "import", "DataArray", "if", "isinstance", "(", "dim", ",", "str", ")", ":", "coord", "=", "None", "elif", "not", "isinstance", "(", "dim", ",", "(", "DataArray", ",", "Vari...
Infer the dimension name and 1d coordinate variable (if appropriate) for concatenating along the new dimension.
[ "Infer", "the", "dimension", "name", "and", "1d", "coordinate", "variable", "(", "if", "appropriate", ")", "for", "concatenating", "along", "the", "new", "dimension", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L123-L144
train
Calculates the name and 1d coordinate variable for concatenating along the new dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
_calc_concat_over
def _calc_concat_over(datasets, dim, data_vars, coords): """ Determine which dataset variables need to be concatenated in the result, and which can simply be taken from the first dataset. """ # Return values concat_over = set() equals = {} if dim in datasets[0]: concat_over.add(...
python
def _calc_concat_over(datasets, dim, data_vars, coords): """ Determine which dataset variables need to be concatenated in the result, and which can simply be taken from the first dataset. """ # Return values concat_over = set() equals = {} if dim in datasets[0]: concat_over.add(...
[ "def", "_calc_concat_over", "(", "datasets", ",", "dim", ",", "data_vars", ",", "coords", ")", ":", "# Return values", "concat_over", "=", "set", "(", ")", "equals", "=", "{", "}", "if", "dim", "in", "datasets", "[", "0", "]", ":", "concat_over", ".", ...
Determine which dataset variables need to be concatenated in the result, and which can simply be taken from the first dataset.
[ "Determine", "which", "dataset", "variables", "need", "to", "be", "concatenated", "in", "the", "result", "and", "which", "can", "simply", "be", "taken", "from", "the", "first", "dataset", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L147-L212
train
Calculates which dataset variables need to be concatenated in the result.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
_dataset_concat
def _dataset_concat(datasets, dim, data_vars, coords, compat, positions): """ Concatenate a sequence of datasets along a new or existing dimension """ from .dataset import Dataset if compat not in ['equals', 'identical']: raise ValueError("compat=%r invalid: must be 'equals' " ...
python
def _dataset_concat(datasets, dim, data_vars, coords, compat, positions): """ Concatenate a sequence of datasets along a new or existing dimension """ from .dataset import Dataset if compat not in ['equals', 'identical']: raise ValueError("compat=%r invalid: must be 'equals' " ...
[ "def", "_dataset_concat", "(", "datasets", ",", "dim", ",", "data_vars", ",", "coords", ",", "compat", ",", "positions", ")", ":", "from", ".", "dataset", "import", "Dataset", "if", "compat", "not", "in", "[", "'equals'", ",", "'identical'", "]", ":", "r...
Concatenate a sequence of datasets along a new or existing dimension
[ "Concatenate", "a", "sequence", "of", "datasets", "along", "a", "new", "or", "existing", "dimension" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L215-L316
train
Concatenate a sequence of datasets along a new or existing dimension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
_infer_tile_ids_from_nested_list
def _infer_tile_ids_from_nested_list(entry, current_pos): """ Given a list of lists (of lists...) of objects, returns a iterator which returns a tuple containing the index of each object in the nested list structure as the key, and the object. This can then be called by the dict constructor to creat...
python
def _infer_tile_ids_from_nested_list(entry, current_pos): """ Given a list of lists (of lists...) of objects, returns a iterator which returns a tuple containing the index of each object in the nested list structure as the key, and the object. This can then be called by the dict constructor to creat...
[ "def", "_infer_tile_ids_from_nested_list", "(", "entry", ",", "current_pos", ")", ":", "if", "isinstance", "(", "entry", ",", "list", ")", ":", "for", "i", ",", "item", "in", "enumerate", "(", "entry", ")", ":", "for", "result", "in", "_infer_tile_ids_from_n...
Given a list of lists (of lists...) of objects, returns a iterator which returns a tuple containing the index of each object in the nested list structure as the key, and the object. This can then be called by the dict constructor to create a dictionary of the objects organised by their position in the o...
[ "Given", "a", "list", "of", "lists", "(", "of", "lists", "...", ")", "of", "objects", "returns", "a", "iterator", "which", "returns", "a", "tuple", "containing", "the", "index", "of", "each", "object", "in", "the", "nested", "list", "structure", "as", "t...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L393-L421
train
A generator function that yields tuples containing the tile IDs of each object in the nested list.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
_combine_nd
def _combine_nd(combined_ids, concat_dims, data_vars='all', coords='different', compat='no_conflicts'): """ Concatenates and merges an N-dimensional structure of datasets. No checks are performed on the consistency of the datasets, concat_dims or tile_IDs, because it is assumed that thi...
python
def _combine_nd(combined_ids, concat_dims, data_vars='all', coords='different', compat='no_conflicts'): """ Concatenates and merges an N-dimensional structure of datasets. No checks are performed on the consistency of the datasets, concat_dims or tile_IDs, because it is assumed that thi...
[ "def", "_combine_nd", "(", "combined_ids", ",", "concat_dims", ",", "data_vars", "=", "'all'", ",", "coords", "=", "'different'", ",", "compat", "=", "'no_conflicts'", ")", ":", "# Perform N-D dimensional concatenation", "# Each iteration of this loop reduces the length of ...
Concatenates and merges an N-dimensional structure of datasets. No checks are performed on the consistency of the datasets, concat_dims or tile_IDs, because it is assumed that this has already been done. Parameters ---------- combined_ids : Dict[Tuple[int, ...]], xarray.Dataset] Structure ...
[ "Concatenates", "and", "merges", "an", "N", "-", "dimensional", "structure", "of", "datasets", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L444-L477
train
Concatenates a set of datasets into a single N - dimensional structure.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
_auto_combine
def _auto_combine(datasets, concat_dims, compat, data_vars, coords, infer_order_from_coords, ids): """ Calls logic to decide concatenation order before concatenating. """ # Arrange datasets for concatenation if infer_order_from_coords: raise NotImplementedError # T...
python
def _auto_combine(datasets, concat_dims, compat, data_vars, coords, infer_order_from_coords, ids): """ Calls logic to decide concatenation order before concatenating. """ # Arrange datasets for concatenation if infer_order_from_coords: raise NotImplementedError # T...
[ "def", "_auto_combine", "(", "datasets", ",", "concat_dims", ",", "compat", ",", "data_vars", ",", "coords", ",", "infer_order_from_coords", ",", "ids", ")", ":", "# Arrange datasets for concatenation", "if", "infer_order_from_coords", ":", "raise", "NotImplementedError...
Calls logic to decide concatenation order before concatenating.
[ "Calls", "logic", "to", "decide", "concatenation", "order", "before", "concatenating", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L523-L554
train
Combines the datasets into a single N - D tree.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/core/combine.py
auto_combine
def auto_combine(datasets, concat_dim=_CONCAT_DIM_DEFAULT, compat='no_conflicts', data_vars='all', coords='different'): """Attempt to auto-magically combine the given datasets into one. This method attempts to combine a list of datasets into a single entity by inspecting metadata and using ...
python
def auto_combine(datasets, concat_dim=_CONCAT_DIM_DEFAULT, compat='no_conflicts', data_vars='all', coords='different'): """Attempt to auto-magically combine the given datasets into one. This method attempts to combine a list of datasets into a single entity by inspecting metadata and using ...
[ "def", "auto_combine", "(", "datasets", ",", "concat_dim", "=", "_CONCAT_DIM_DEFAULT", ",", "compat", "=", "'no_conflicts'", ",", "data_vars", "=", "'all'", ",", "coords", "=", "'different'", ")", ":", "# noqa", "# Coerce 1D input into ND to maintain backwards-compatibl...
Attempt to auto-magically combine the given datasets into one. This method attempts to combine a list of datasets into a single entity by inspecting metadata and using a combination of concat and merge. It does not concatenate along more than one dimension or sort data under any circumstances. It does a...
[ "Attempt", "to", "auto", "-", "magically", "combine", "the", "given", "datasets", "into", "one", ".", "This", "method", "attempts", "to", "combine", "a", "list", "of", "datasets", "into", "a", "single", "entity", "by", "inspecting", "metadata", "and", "using...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/combine.py#L557-L625
train
This method attempts to auto - magically combine the given datasets into one.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftime_offsets.py
get_date_type
def get_date_type(calendar): """Return the cftime date type for a given calendar name.""" try: import cftime except ImportError: raise ImportError( 'cftime is required for dates with non-standard calendars') else: calendars = { 'noleap': cftime.DatetimeNoL...
python
def get_date_type(calendar): """Return the cftime date type for a given calendar name.""" try: import cftime except ImportError: raise ImportError( 'cftime is required for dates with non-standard calendars') else: calendars = { 'noleap': cftime.DatetimeNoL...
[ "def", "get_date_type", "(", "calendar", ")", ":", "try", ":", "import", "cftime", "except", "ImportError", ":", "raise", "ImportError", "(", "'cftime is required for dates with non-standard calendars'", ")", "else", ":", "calendars", "=", "{", "'noleap'", ":", "cft...
Return the cftime date type for a given calendar name.
[ "Return", "the", "cftime", "date", "type", "for", "a", "given", "calendar", "name", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftime_offsets.py#L58-L77
train
Return the cftime date type for a given calendar name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftime_offsets.py
_get_day_of_month
def _get_day_of_month(other, day_option): """Find the day in `other`'s month that satisfies a BaseCFTimeOffset's onOffset policy, as described by the `day_option` argument. Parameters ---------- other : cftime.datetime day_option : 'start', 'end' 'start': returns 1 'end': return...
python
def _get_day_of_month(other, day_option): """Find the day in `other`'s month that satisfies a BaseCFTimeOffset's onOffset policy, as described by the `day_option` argument. Parameters ---------- other : cftime.datetime day_option : 'start', 'end' 'start': returns 1 'end': return...
[ "def", "_get_day_of_month", "(", "other", ",", "day_option", ")", ":", "if", "day_option", "==", "'start'", ":", "return", "1", "elif", "day_option", "==", "'end'", ":", "days_in_month", "=", "_days_in_month", "(", "other", ")", "return", "days_in_month", "eli...
Find the day in `other`'s month that satisfies a BaseCFTimeOffset's onOffset policy, as described by the `day_option` argument. Parameters ---------- other : cftime.datetime day_option : 'start', 'end' 'start': returns 1 'end': returns last day of the month Returns ------- ...
[ "Find", "the", "day", "in", "other", "s", "month", "that", "satisfies", "a", "BaseCFTimeOffset", "s", "onOffset", "policy", "as", "described", "by", "the", "day_option", "argument", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftime_offsets.py#L165-L192
train
Return the day in the month that satisfies a BaseCFTimeOffset s onOffset policy.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftime_offsets.py
_days_in_month
def _days_in_month(date): """The number of days in the month of the given date""" if date.month == 12: reference = type(date)(date.year + 1, 1, 1) else: reference = type(date)(date.year, date.month + 1, 1) return (reference - timedelta(days=1)).day
python
def _days_in_month(date): """The number of days in the month of the given date""" if date.month == 12: reference = type(date)(date.year + 1, 1, 1) else: reference = type(date)(date.year, date.month + 1, 1) return (reference - timedelta(days=1)).day
[ "def", "_days_in_month", "(", "date", ")", ":", "if", "date", ".", "month", "==", "12", ":", "reference", "=", "type", "(", "date", ")", "(", "date", ".", "year", "+", "1", ",", "1", ",", "1", ")", "else", ":", "reference", "=", "type", "(", "d...
The number of days in the month of the given date
[ "The", "number", "of", "days", "in", "the", "month", "of", "the", "given", "date" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftime_offsets.py#L195-L201
train
The number of days in the month of the given date
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pydata/xarray
xarray/coding/cftime_offsets.py
_adjust_n_months
def _adjust_n_months(other_day, n, reference_day): """Adjust the number of times a monthly offset is applied based on the day of a given date, and the reference day provided. """ if n > 0 and other_day < reference_day: n = n - 1 elif n <= 0 and other_day > reference_day: n = n + 1 ...
python
def _adjust_n_months(other_day, n, reference_day): """Adjust the number of times a monthly offset is applied based on the day of a given date, and the reference day provided. """ if n > 0 and other_day < reference_day: n = n - 1 elif n <= 0 and other_day > reference_day: n = n + 1 ...
[ "def", "_adjust_n_months", "(", "other_day", ",", "n", ",", "reference_day", ")", ":", "if", "n", ">", "0", "and", "other_day", "<", "reference_day", ":", "n", "=", "n", "-", "1", "elif", "n", "<=", "0", "and", "other_day", ">", "reference_day", ":", ...
Adjust the number of times a monthly offset is applied based on the day of a given date, and the reference day provided.
[ "Adjust", "the", "number", "of", "times", "a", "monthly", "offset", "is", "applied", "based", "on", "the", "day", "of", "a", "given", "date", "and", "the", "reference", "day", "provided", "." ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftime_offsets.py#L204-L212
train
Adjust the number of times a monthly offset is applied based on the day of a given date.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...