home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where issue = 860038564 and user = 5635139 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • max-sixty · 1 ✖

issue 1

  • Clip broadcasts min or max array input · 1 ✖

author_association 1

  • MEMBER 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
821878676 https://github.com/pydata/xarray/issues/5173#issuecomment-821878676 https://api.github.com/repos/pydata/xarray/issues/5173 MDEyOklzc3VlQ29tbWVudDgyMTg3ODY3Ng== max-sixty 5635139 2021-04-17T19:55:30Z 2021-04-17T19:55:30Z MEMBER

I'm looking at implementing this.

I think we could do this with a simple broadcast_like on the input, as above. But is that going to miss things that our normal machinery is capturing? Currently .clip is a unary_ops which I haven't looked at in a while. And I'm not being that successful at evaluating what's going wrong from the stack trace — so posting here in case those who've worked with this recently have it cached.

One thing to note: there are different errors depending on which dimensions are missing, because of the missing broadcasting before removing the dim information:

```python

In [27]: da.clip(da.mean('a'))

ValueError Traceback (most recent call last) <ipython-input-27-c8b9c6d0e0a1> in <module> ----> 1 da.clip(da.mean('a'))

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/dataarray.py in func(self, args, kwargs) 2964 ) 2965 with np.errstate(all="ignore"): -> 2966 da = self.array_wrap(f(self.variable.data, args, **kwargs)) 2967 if keep_attrs: 2968 da.attrs = self.attrs

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/ops.py in func(self, args, kwargs) 228 def _method_wrapper(name): 229 def func(self, args, **kwargs): --> 230 return _call_possibly_missing_method(self, name, args, kwargs) 231 232 func.name = name

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/ops.py in _call_possibly_missing_method(arg, name, args, kwargs) 214 raise 215 else: --> 216 return method(args, *kwargs) 217 218

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/numpy/core/_methods.py in _clip(a, min, max, out, casting, kwargs) 153 um.minimum, a, max, out=out, casting=casting, kwargs) 154 elif max is None: --> 155 return _clip_dep_invoke_with_casting( 156 um.maximum, a, min, out=out, casting=casting, **kwargs) 157 else:

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/numpy/core/_methods.py in _clip_dep_invoke_with_casting(ufunc, out, casting, args, kwargs) 110 # try to deal with broken casting rules 111 try: --> 112 return ufunc(args, out=out, **kwargs) 113 except _exceptions._UFuncOutputCastingError as e: 114 # Numpy 1.17.0, 2019-02-24

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/arithmetic.py in array_ufunc(self, ufunc, method, inputs, kwargs) 68 join = dataset_join = OPTIONS["arithmetic_join"] 69 ---> 70 return apply_ufunc( 71 ufunc, 72 inputs,

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/computation.py in apply_ufunc(func, input_core_dims, output_core_dims, exclude_dims, vectorize, join, dataset_join, dataset_fill_value, keep_attrs, kwargs, dask, output_dtypes, output_sizes, meta, dask_gufunc_kwargs, args) 1126 # feed DataArray apply_variable_ufunc through apply_dataarray_vfunc 1127 elif any(isinstance(a, DataArray) for a in args): -> 1128 return apply_dataarray_vfunc( 1129 variables_vfunc, 1130 args,

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/computation.py in apply_dataarray_vfunc(func, signature, join, exclude_dims, keep_attrs, args) 269 270 data_vars = [getattr(a, "variable", a) for a in args] --> 271 result_var = func(data_vars) 272 273 if signature.num_outputs > 1:

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/computation.py in apply_variable_ufunc(func, signature, exclude_dims, dask, output_dtypes, vectorize, keep_attrs, dask_gufunc_kwargs, *args) 741 data = as_compatible_data(data) 742 if data.ndim != len(dims): --> 743 raise ValueError( 744 "applied function returned data with unexpected " 745 f"number of dimensions. Received {data.ndim} dimension(s) but "

ValueError: applied function returned data with unexpected number of dimensions. Received 3 dimension(s) but expected 2 dimensions with names: ('b', 'c') ```

When the final dimension is missing: ```python

In [28]: da.clip(da.mean('c'))

ValueError Traceback (most recent call last) <ipython-input-28-8e46fcdf9b64> in <module> ----> 1 da.clip(da.mean('c'))

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/dataarray.py in func(self, args, kwargs) 2964 ) 2965 with np.errstate(all="ignore"): -> 2966 da = self.array_wrap(f(self.variable.data, args, **kwargs)) 2967 if keep_attrs: 2968 da.attrs = self.attrs

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/ops.py in func(self, args, kwargs) 228 def _method_wrapper(name): 229 def func(self, args, **kwargs): --> 230 return _call_possibly_missing_method(self, name, args, kwargs) 231 232 func.name = name

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/ops.py in _call_possibly_missing_method(arg, name, args, kwargs) 214 raise 215 else: --> 216 return method(args, *kwargs) 217 218

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/numpy/core/_methods.py in _clip(a, min, max, out, casting, kwargs) 153 um.minimum, a, max, out=out, casting=casting, kwargs) 154 elif max is None: --> 155 return _clip_dep_invoke_with_casting( 156 um.maximum, a, min, out=out, casting=casting, **kwargs) 157 else:

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/numpy/core/_methods.py in _clip_dep_invoke_with_casting(ufunc, out, casting, args, kwargs) 110 # try to deal with broken casting rules 111 try: --> 112 return ufunc(args, out=out, **kwargs) 113 except _exceptions._UFuncOutputCastingError as e: 114 # Numpy 1.17.0, 2019-02-24

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/arithmetic.py in array_ufunc(self, ufunc, method, inputs, kwargs) 68 join = dataset_join = OPTIONS["arithmetic_join"] 69 ---> 70 return apply_ufunc( 71 ufunc, 72 inputs,

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/computation.py in apply_ufunc(func, input_core_dims, output_core_dims, exclude_dims, vectorize, join, dataset_join, dataset_fill_value, keep_attrs, kwargs, dask, output_dtypes, output_sizes, meta, dask_gufunc_kwargs, args) 1126 # feed DataArray apply_variable_ufunc through apply_dataarray_vfunc 1127 elif any(isinstance(a, DataArray) for a in args): -> 1128 return apply_dataarray_vfunc( 1129 variables_vfunc, 1130 args,

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/computation.py in apply_dataarray_vfunc(func, signature, join, exclude_dims, keep_attrs, args) 269 270 data_vars = [getattr(a, "variable", a) for a in args] --> 271 result_var = func(data_vars) 272 273 if signature.num_outputs > 1:

~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/computation.py in apply_variable_ufunc(func, signature, exclude_dims, dask, output_dtypes, vectorize, keep_attrs, dask_gufunc_kwargs, args) 722 ) 723 --> 724 result_data = func(input_data) 725 726 if signature.num_outputs == 1:

ValueError: operands could not be broadcast together with shapes (2,4,3) (2,4) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Clip broadcasts min or max array input 860038564

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 122.53ms · About: xarray-datasette