home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

3 rows where state = "closed", type = "issue" and user = 4441338 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 1

  • issue · 3 ✖

state 1

  • closed · 3 ✖

repo 1

  • xarray 3
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1050937380 I_kwDOAMm_X84-pAgk 5975 Typing of dim in concat.py does not include Hashable LunarLanding 4441338 closed 0     2 2021-11-11T12:38:44Z 2022-05-17T20:53:07Z 2022-05-17T20:53:07Z NONE      

i.e. https://github.com/pydata/xarray/blob/5871637873cd83c3a656ee6f4df86ea6628cf68a/xarray/core/concat.py#L46

Arent' dims supposed to be any Hashable? In other xarray methods they generally are.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5975/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
869786882 MDU6SXNzdWU4Njk3ODY4ODI= 5228 sel(dim=slice(a,b,c)) only accepts integers for c, uses c as isel does LunarLanding 4441338 closed 0     1 2021-04-28T10:22:40Z 2021-04-28T10:47:00Z 2021-04-28T10:46:59Z NONE      

Trying to slice with sel using label delta values as interval, i.e. da.sel(mydim=slice(None,None,c).

What happened: The label delta value is not accepted.

What you expected to happen: Selecting c-spaced samples from the DataArray da.

Minimal Complete Verifiable Example:

```python dim0_n = 100 d = xr.DataArray(np.arange(dim0_n),coords={'dim0':np.linspace(0,1,num=dim0_n)},dims=('dim0',)) d.sel(dim0=slice(None,None,0.1))

expected 0,10,20,...,90

instead get a TypeError: 'float' object cannot be interpreted as an integer

(full traceback below)

```

Full traceback

``` TypeError Traceback (most recent call last) <ipython-input-43-9eb3e3c8bbe4> in <module> 1 dim0_n = 100 2 d = xr.DataArray(np.arange(dim0_n),coords={'dim0':np.linspace(0,1,num=dim0_n)},dims=('dim0',)) ----> 3 d.sel(dim0=slice(None,None,0.1)) 4 # expected 0,10,20,...,90 5 # instead get a TypeError (traceback below) ~/miniconda3/lib/python3.9/site-packages/xarray/core/dataarray.py in sel(self, indexers, method, tolerance, drop, **indexers_kwargs) 1252 Dimensions without coordinates: points 1253 """ -> 1254 ds = self._to_temp_dataset().sel( 1255 indexers=indexers, 1256 drop=drop, ~/miniconda3/lib/python3.9/site-packages/xarray/core/dataset.py in sel(self, indexers, method, tolerance, drop, **indexers_kwargs) 2231 self, indexers=indexers, method=method, tolerance=tolerance 2232 ) -> 2233 result = self.isel(indexers=pos_indexers, drop=drop) 2234 return result._overwrite_indexes(new_indexes) 2235 ~/miniconda3/lib/python3.9/site-packages/xarray/core/dataset.py in isel(self, indexers, drop, missing_dims, **indexers_kwargs) 2093 var_indexers = {k: v for k, v in indexers.items() if k in var_value.dims} 2094 if var_indexers: -> 2095 var_value = var_value.isel(var_indexers) 2096 if drop and var_value.ndim == 0 and var_name in coord_names: 2097 coord_names.remove(var_name) ~/miniconda3/lib/python3.9/site-packages/xarray/core/variable.py in isel(self, indexers, missing_dims, **indexers_kwargs) 1164 1165 key = tuple(indexers.get(dim, slice(None)) for dim in self.dims) -> 1166 return self[key] 1167 1168 def squeeze(self, dim=None): ~/miniconda3/lib/python3.9/site-packages/xarray/core/variable.py in __getitem__(self, key) 808 array `x.values` directly. 809 """ --> 810 dims, indexer, new_order = self._broadcast_indexes(key) 811 data = as_indexable(self._data)[indexer] 812 if new_order: ~/miniconda3/lib/python3.9/site-packages/xarray/core/variable.py in _broadcast_indexes(self, key) 647 648 if all(isinstance(k, BASIC_INDEXING_TYPES) for k in key): --> 649 return self._broadcast_indexes_basic(key) 650 651 self._validate_indexers(key) ~/miniconda3/lib/python3.9/site-packages/xarray/core/variable.py in _broadcast_indexes_basic(self, key) 675 dim for k, dim in zip(key, self.dims) if not isinstance(k, integer_types) 676 ) --> 677 return dims, BasicIndexer(key), None 678 679 def _validate_indexers(self, key): ~/miniconda3/lib/python3.9/site-packages/xarray/core/indexing.py in __init__(self, key) 382 k = int(k) 383 elif isinstance(k, slice): --> 384 k = as_integer_slice(k) 385 else: 386 raise TypeError( ~/miniconda3/lib/python3.9/site-packages/xarray/core/indexing.py in as_integer_slice(value) 359 start = as_integer_or_none(value.start) 360 stop = as_integer_or_none(value.stop) --> 361 step = as_integer_or_none(value.step) 362 return slice(start, stop, step) 363 ~/miniconda3/lib/python3.9/site-packages/xarray/core/indexing.py in as_integer_or_none(value) 353 354 def as_integer_or_none(value): --> 355 return None if value is None else operator.index(value) 356 357 TypeError: 'float' object cannot be interpreted as an integer ```

Anything else we need to know?:

I think a warning in the documentation would be nice. It happened that I was giving integer values to c and xarray was subsetting datasets in an entirely different way that the one intended. It took noticing a downstream effect to find this behavior.

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:46) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.11.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: None LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.17.0 pandas: 1.2.4 numpy: 1.20.2 scipy: 1.6.2 netCDF4: 1.5.6 pydap: None h5netcdf: 0.11.0 h5py: 3.1.0 Nio: None zarr: 2.8.1 cftime: 1.4.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2021.04.1 distributed: 2021.04.1 matplotlib: 3.3.4 cartopy: None seaborn: 0.11.1 numbagg: None pint: None setuptools: 51.0.0.post20201207 pip: 21.1 conda: 4.10.1 pytest: None IPython: 7.22.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5228/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
831148018 MDU6SXNzdWU4MzExNDgwMTg= 5034 output_dtypes needs to be a tuple, not a sequence LunarLanding 4441338 closed 0     4 2021-03-14T12:47:49Z 2021-04-19T19:33:14Z 2021-04-19T19:33:14Z NONE      

https://github.com/pydata/xarray/blob/d4b7a608bab0e7c140937b0b59ca45115d205145/xarray/core/computation.py#L807

If a sequence, I get TypeError: Field elements must be 2- or 3-tuples, got 'dtype('float64')'

MVE ( WIP, will finish later )

```

p,v are chunked in 'time'

M is a positive integer

msd_w_one_mol takes two args, has two outputs

m,w = xr.apply_ufunc( msd_w_one_mol, p,v, input_core_dims=[('time','spatial'),('time',)], output_core_dims=[('interval',),('interval',)], vectorize=True, dask='parallelized', dask_gufunc_kwargs={ 'output_sizes':{'interval':M}, 'allow_rechunk':True,

'meta':(np.empty((M,),dtype=p.dtype),np.empty((M,),dtype=np.min_scalar_type(M)))

'output_dtypes':[p.dtype,np.min_scalar_type(M)],

},
output_dtypes=[p.dtype,np.min_scalar_type(M)] # error
output_dtypes=(p.dtype,np.min_scalar_type(M)) # works

)

```

Stack Trace: ```


ValueError Traceback (most recent call last) ~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/gufunc.py in apply_gufunc(func, signature, args, kwargs) 429 try: --> 430 tmp = blockwise( # First try to compute meta 431 func, loop_output_dims, arginds, concatenate=True, **kwargs

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/blockwise.py in blockwise(func, out_ind, name, token, dtype, adjust_chunks, new_axes, align_arrays, concatenate, meta, args, kwargs) 278 --> 279 meta = compute_meta(func, dtype, args[::2], **kwargs) 280 return new_da_object(graph, out, chunks, meta=meta, dtype=dtype)

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/utils.py in compute_meta(func, _dtype, args, kwargs) 138 if isinstance(func, np.vectorize): --> 139 meta = func(args_meta) 140 else:

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/numpy/lib/function_base.py in call(self, args, *kwargs) 2112 -> 2113 return self._vectorize_call(func=func, args=vargs) 2114

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/numpy/lib/function_base.py in _vectorize_call(self, func, args) 2186 if self.signature is not None: -> 2187 res = self._vectorize_call_with_signature(func, args) 2188 elif not args:

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/numpy/lib/function_base.py in _vectorize_call_with_signature(self, func, args) 2260 for dim in dims): -> 2261 raise ValueError('cannot call vectorize with a signature ' 2262 'including new output dimensions on size 0 '

ValueError: cannot call vectorize with a signature including new output dimensions on size 0 inputs

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last) <ipython-input-119-a2a3ac7df12d> in <module> ----> 1 m,w = xr.apply_ufunc( 2 msd_w_one_mol, 3 p,v, 4 input_core_dims=[('time','spatial'),('time',)], 5 output_core_dims=[('interval',),('interval',)],

~/dotfiles/conda/base/.conda/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,

~/dotfiles/conda/base/.conda/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:

~/dotfiles/conda/base/.conda/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:

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/xarray/core/computation.py in func(*arrays) 690 import dask.array as da 691 --> 692 res = da.apply_gufunc( 693 numpy_func, 694 signature.to_gufunc_string(exclude_dims),

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/gufunc.py in apply_gufunc(func, signature, args, *kwargs) 441 ) 442 else: --> 443 meta = tuple( 444 meta_from_array(sample, dtype=odt) 445 for ocd, odt in zip((output_coredimss,), (output_dtypes,))

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/gufunc.py in <genexpr>(.0) 442 else: 443 meta = tuple( --> 444 meta_from_array(sample, dtype=odt) 445 for ocd, odt in zip((output_coredimss,), (output_dtypes,)) 446 )

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/utils.py in meta_from_array(x, ndim, dtype) 104 meta = np.array(meta) 105 --> 106 if dtype and meta.dtype != dtype: 107 try: 108 meta = meta.astype(dtype)

TypeError: Field elements must be 2- or 3-tuples, got 'dtype('float64')' ```

Preliminary investigation using %debug: ```

~/dotfiles/conda/base/.conda/lib/python3.8/site-packages/dask/array/utils.py(106)meta_from_array() 104 meta = np.array(meta) 105 --> 106 if dtype and meta.dtype != dtype: 107 try: 108 meta = meta.astype(dtype)

ipdb> print(dtype)

[dtype('float64'), dtype('uint16')]

ipdb> print(meta.dtype)

float64

ipdb> print(dtype)

[dtype('float64'), dtype('uint16')]

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5034/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

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

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 393.787ms · About: xarray-datasette