Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for xarray interface add_dimension implementation #820

merged 1 commit into from Aug 18, 2016
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+7 −3
Diff settings


Just for now

@@ -359,7 +359,8 @@ def aggregate(self, dimensions=None, function=None, spreadfn=None, **kwargs):
combined = self.clone(aggregated, kdims=kdims)
for i, d in enumerate(vdims):
dim = d('_'.join([, spread_name]))
combined = combined.add_dimension(dim, ndims+i, error[d], True)
dvals = error.dimension_values(d, False, False)
combined = combined.add_dimension(dim, ndims+i, dvals, True)
return combined

if np.isscalar(aggregated):
@@ -191,7 +191,8 @@ def select(cls, dataset, selection_mask=None, **selection):
if isinstance(v, set):
validated[k] = list(v)
elif isinstance(v, tuple):
validated[k] = slice(v[0], v[1]-sys.float_info.epsilon*10)
upper = None if v[1] is None else v[1]-sys.float_info.epsilon*10

This comment has been minimized.

Copy link

jlstevens Aug 18, 2016


Why sys.float_info.epsilon*10? Is sys.float_info.epsilon not enough of a difference?

This comment has been minimized.

Copy link

philippjfr Aug 18, 2016

Author Contributor

Yea apparently not, bit annoying.

validated[k] = slice(v[0], upper)
elif isinstance(v, types.FunctionType):
validated[k] = v(dataset[k])
@@ -231,7 +232,9 @@ def add_dimension(cls, dataset, dimension, dim_pos, values, vdim):
if not vdim:
raise Exception("Cannot add key dimension to a dense representation.")
dim = if isinstance(dimension, Dimension) else dimension
return dataset.assign(**{dim: values})
arr = xr.DataArray(values,, name=dim,
return**{dim: arr})

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.