issues
15 rows where type = "issue" and user = 1828519 sorted by updated_at descending
This data as json, CSV (advanced)
Suggested facets: comments, created_at (date), updated_at (date), closed_at (date)
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1974350560 | I_kwDOAMm_X851rjLg | 8402 | `where` dtype upcast with numpy 2 | djhoese 1828519 | open | 0 | 10 | 2023-11-02T14:12:49Z | 2024-04-15T19:18:49Z | CONTRIBUTOR | What happened?I'm testing my code with numpy 2.0 and current Doing The main problem seems to come down to: As this converts my scalar input ```python import numpy as np a = np.zeros((2, 2), dtype=np.uint16) what I'm intending to do with my xarray
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8402/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
xarray 13221727 | issue | ||||||||
1966675016 | I_kwDOAMm_X851ORRI | 8388 | Type annotation compatibility with numpy ufuncs | djhoese 1828519 | closed | 0 | 4 | 2023-10-28T17:25:11Z | 2023-11-02T12:44:50Z | 2023-11-02T12:44:50Z | CONTRIBUTOR | Is your feature request related to a problem?I'd like mypy to understand that xarray DataArrays passed to numpy ufuncs have a return type of xarray DataArray. ```python import xarray as xr import numpy as np def compute_relative_azimuth(sat_azi: xr.DataArray, sun_azi: xr.DataArray) -> xr.DataArray: abs_diff = np.absolute(sun_azi - sat_azi) ssadiff = np.minimum(abs_diff, 360 - abs_diff) return ssadiff ```
Describe the solution you'd likeI'm not sure if this is possible, if it is something xarray can fix, or something numpy needs to "fix". I'd like the above situation to "just work" without anything more than maybe some extra type-stub package. Describe alternatives you've consideredCast types or other type coercion or tell mypy to ignore the type issues for these numpy call. Additional context |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8388/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
1085992113 | I_kwDOAMm_X85Auuyx | 6092 | DeprecationWarning regarding use of distutils Version classes | djhoese 1828519 | closed | 0 | 10 | 2021-12-21T16:11:08Z | 2023-09-05T06:39:39Z | 2021-12-24T14:50:48Z | CONTRIBUTOR | What happened: While working on some tests that catch and check for warnings in my library I found that xarray with new versions of Python (I think this is the trigger) causes a ton of DeprecationWarnings on import:
What you expected to happen: No warnings. Minimal Complete Verifiable Example: ```python import warnings warnings.simplefilter("always") import xarray as xr ``` Results in:
Anything else we need to know?: Environment: Output of <tt>xr.show_versions()</tt>``` /home/davidh/miniconda3/envs/satpy_py39/lib/python3.9/site-packages/_distutils_hack/__init__.py:35: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") /home/davidh/miniconda3/envs/satpy_py39/lib/python3.9/asyncio/base_events.py:681: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False> _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self) ResourceWarning: Enable tracemalloc to get the object allocation traceback INSTALLED VERSIONS ------------------ commit: None python: 3.9.9 | packaged by conda-forge | (main, Dec 20 2021, 02:41:03) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 5.15.5-76051505-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.1 libnetcdf: 4.8.1 xarray: 0.20.2 pandas: 1.3.5 numpy: 1.20.3 scipy: 1.7.3 netCDF4: 1.5.8 pydap: None h5netcdf: 0.12.0 h5py: 3.6.0 Nio: None zarr: 2.10.3 cftime: 1.5.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: 1.2.10 cfgrib: None iris: None bottleneck: 1.3.2 dask: 2021.12.0 distributed: 2021.12.0 matplotlib: 3.5.1 cartopy: 0.20.1 seaborn: None numbagg: None fsspec: 2021.11.1 cupy: None pint: None sparse: None setuptools: 60.0.3 pip: 21.3.1 conda: None pytest: 6.2.5 IPython: 7.30.1 sphinx: 4.3.2 ``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6092/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
573031381 | MDU6SXNzdWU1NzMwMzEzODE= | 3813 | Xarray operations produce read-only array | djhoese 1828519 | open | 0 | 7 | 2020-02-28T22:07:59Z | 2023-03-22T15:11:14Z | CONTRIBUTOR | I've turned on testing my Satpy package with unstable or pre-releases of some of our dependencies including numpy and xarray. I've found one error so far where in previous versions of xarray it was possible to assign to the numpy array taken from a DataArray. MCVE Code Sample```python import numpy as np import dask.array as da import xarray as xr data = np.arange(15, 301, 15).reshape(2, 10) data_arr = xr.DataArray(data, dims=('y', 'x'), attrs={'test': 'test'}) data_arr = data_arr.copy() data_arr = data_arr.expand_dims('bands') data_arr['bands'] = ['L'] n_arr = np.asarray(data_arr.data) n_arr[n_arr == 45] = 5 ``` Which results in: ```ValueError Traceback (most recent call last) <ipython-input-12-90dae37dd808> in <module> ----> 1 n_arr = np.asarray(data_arr.data); n_arr[n_arr == 45] = 5 ValueError: assignment destination is read-only ``` Expected OutputA writable array. No error. Problem DescriptionIf this is expected new behavior then so be it, but wanted to check with the xarray devs before I tried to work around it. Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3813/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
xarray 13221727 | issue | ||||||||
1419602897 | I_kwDOAMm_X85UnWvR | 7197 | Unstable pandas causes CF datetime64 issues | djhoese 1828519 | closed | 0 | 4 | 2022-10-23T02:30:39Z | 2022-10-26T16:00:35Z | 2022-10-26T16:00:35Z | CONTRIBUTOR | What happened?The Satpy project has a CI environment that installs numpy, pandas, and xarray (and a couple other packages) from their unstable sources (nightly builds, github source, etc). In the last week or two this environment has started failing with various datetime64 issues. It all seems to be caused by some recent change in pandas, but I can't place exactly what the problem is nor the commit/PR that started it. It seems there are a couple datetime related PRs. What did you expect to happen?Datetime or datetime64 objects should be allowed to be in whatever units they need to be in (days or minutes or nanoseconds. It seems parts of xarray (or pandas) assume Minimal Complete Verifiable ExampleYou should be able to take any environment with modern xarray and install dev pandas with:
Then run this snippet: ```Python import xarray as xr import numpy as np from xarray.coding.times import CFDatetimeCoder a = xr.DataArray(np.arange(1.0), dims=("time",), coords={"time": [np.datetime64('2018-05-30T10:05:00')]}) CFDatetimeCoder().encode(a.coords["time"]) ``` I haven't been able to generate a higher-level MVCE yet, but I'm hoping this little snippet will make the issue obvious to someone familiar with xarray internals. MVCE confirmation
Relevant log output``` ----> 1 CFDatetimeCoder().encode(a.coords["time"]) File ~/miniconda3/envs/satpy_py39_unstable/lib/python3.9/site-packages/xarray/coding/times.py:676, in CFDatetimeCoder.encode(self, variable, name) 672 dims, data, attrs, encoding = unpack_for_encoding(variable) 673 if np.issubdtype(data.dtype, np.datetime64) or contains_cftime_datetimes( 674 variable 675 ): --> 676 (data, units, calendar) = encode_cf_datetime( 677 data, encoding.pop("units", None), encoding.pop("calendar", None) 678 ) 679 safe_setitem(attrs, "units", units, name=name) 680 safe_setitem(attrs, "calendar", calendar, name=name) File ~/miniconda3/envs/satpy_py39_unstable/lib/python3.9/site-packages/xarray/coding/times.py:612, in encode_cf_datetime(dates, units, calendar) 609 dates = np.asarray(dates) 611 if units is None: --> 612 units = infer_datetime_units(dates) 613 else: 614 units = _cleanup_netcdf_time_units(units) File ~/miniconda3/envs/satpy_py39_unstable/lib/python3.9/site-packages/xarray/coding/times.py:394, in infer_datetime_units(dates) 392 print("Formatting datetime object") 393 reference_date = dates[0] if len(dates) > 0 else "1970-01-01" --> 394 reference_date = format_cftime_datetime(reference_date) 395 unique_timedeltas = np.unique(np.diff(dates)) 396 units = _infer_time_units_from_diff(unique_timedeltas) File ~/miniconda3/envs/satpy_py39_unstable/lib/python3.9/site-packages/xarray/coding/times.py:405, in format_cftime_datetime(date) 400 def format_cftime_datetime(date): 401 """Converts a cftime.datetime object to a string with the format: 402 YYYY-MM-DD HH:MM:SS.UUUUUU 403 """ 404 return "{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:06d}".format( --> 405 date.year, 406 date.month, 407 date.day, 408 date.hour, 409 date.minute, 410 date.second, 411 date.microsecond, 412 ) AttributeError: 'numpy.datetime64' object has no attribute 'year' ``` Anything else we need to know?No response Environment
```
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:59)
[GCC 10.3.0]
python-bits: 64
OS: Linux
OS-release: 5.19.0-76051900-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.8.1
xarray: 2022.10.0
pandas: 2.0.0.dev0+422.g6c46013c54
numpy: 1.23.4
scipy: 1.10.0.dev0+1848.f114d8b
netCDF4: 1.6.0
pydap: None
h5netcdf: 1.0.0
h5py: 3.7.0
Nio: None
zarr: 2.13.0a3.dev5
cftime: 1.6.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.4dev
cfgrib: None
iris: None
bottleneck: 1.3.5
dask: 2022.10.0+6.gc8dc3955
distributed: None
matplotlib: 3.7.0.dev473+gc450aa7baf
cartopy: 0.20.3
seaborn: None
numbagg: None
fsspec: 2022.5.0
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 65.3.0
pip: 22.2.2
conda: None
pytest: 7.1.1
IPython: 8.2.0
sphinx: 5.0.0
```
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7197/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
341331807 | MDU6SXNzdWUzNDEzMzE4MDc= | 2288 | Add CRS/projection information to xarray objects | djhoese 1828519 | open | 0 | 45 | 2018-07-15T16:02:55Z | 2022-10-14T20:27:26Z | CONTRIBUTOR | Problem descriptionThis issue is to start the discussion for a feature that would be helpful to a lot of people. It may not necessarily be best to put it in xarray, but let's figure that out. I'll try to describe things below to the best of my knowledge. I'm typically thinking of raster/image data when it comes to this stuff, but it could probably be used for GIS-like point data. Geographic data can be projected (uniform grid) or unprojected (nonuniform). Unprojected data typically has longitude and latitude values specified per-pixel. I don't think I've ever seen non-uniform data in a projected space. Projected data can be specified by a CRS (PROJ.4), a number of pixels (shape), and extents/bbox in CRS units (xmin, ymin, xmax, ymax). This could also be specified in different ways like origin (X, Y) and pixel size. Seeing as xarray already computes all So the question is: Should these properties be standardized in xarray Dataset/DataArray objects and how? Related libraries and developers
I know @WeatherGod also showed interest on gitter. Complications and things to consider
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2288/reactions", "total_count": 14, "+1": 14, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
xarray 13221727 | issue | ||||||||
1392878100 | I_kwDOAMm_X85TBaIU | 7111 | New deep copy behavior in 2022.9.0 causes maximum recursion error | djhoese 1828519 | closed | 0 | 23 | 2022-09-30T19:11:38Z | 2022-10-06T22:04:02Z | 2022-10-06T22:04:02Z | CONTRIBUTOR | What happened?I have a case where a Dataset to be written to a NetCDF file has "ancillary_variables" that have a circular dependence. For example, variable A has What did you expect to happen?Circular dependencies are detected and avoided. No maximum recursion error. Minimal Complete Verifiable Example```Python In [1]: import xarray as xr In [2]: a = xr.DataArray(1.0, attrs={}) In [3]: b = xr.DataArray(2.0, attrs={}) In [4]: a.attrs["other"] = b In [5]: b.attrs["other"] = a In [6]: a_copy = a.copy(deep=True)RecursionError Traceback (most recent call last) Cell In [6], line 1 ----> 1 a_copy = a.copy(deep=True) File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/dataarray.py:1172, in DataArray.copy(self, deep, data)
1104 def copy(self: T_DataArray, deep: bool = True, data: Any = None) -> T_DataArray:
1105 """Returns a copy of this array.
1106
1107 If File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/variable.py:996, in Variable.copy(self, deep, data) 989 if self.shape != ndata.shape: 990 raise ValueError( 991 "Data shape {} must match shape of object {}".format( 992 ndata.shape, self.shape 993 ) 994 ) --> 996 attrs = copy.deepcopy(self._attrs) if deep else copy.copy(self._attrs) 997 encoding = copy.deepcopy(self._encoding) if deep else copy.copy(self._encoding) 999 # note: dims is already an immutable tuple File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:146, in deepcopy(x, memo, _nil) 144 copier = _deepcopy_dispatch.get(cls) 145 if copier is not None: --> 146 y = copier(x, memo) 147 else: 148 if issubclass(cls, type): File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:231, in _deepcopy_dict(x, memo, deepcopy) 229 memo[id(x)] = y 230 for key, value in x.items(): --> 231 y[deepcopy(key, memo)] = deepcopy(value, memo) 232 return y File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:153, in deepcopy(x, memo, _nil) 151 copier = getattr(x, "deepcopy", None) 152 if copier is not None: --> 153 y = copier(memo) 154 else: 155 reductor = dispatch_table.get(cls) File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/dataarray.py:1190, in DataArray.deepcopy(self, memo) 1187 def deepcopy(self: T_DataArray, memo=None) -> T_DataArray: 1188 # memo does nothing but is required for compatibility with 1189 # copy.deepcopy -> 1190 return self.copy(deep=True) File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/dataarray.py:1172, in DataArray.copy(self, deep, data)
1104 def copy(self: T_DataArray, deep: bool = True, data: Any = None) -> T_DataArray:
1105 """Returns a copy of this array.
1106
1107 If File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/variable.py:996, in Variable.copy(self, deep, data) 989 if self.shape != ndata.shape: 990 raise ValueError( 991 "Data shape {} must match shape of object {}".format( 992 ndata.shape, self.shape 993 ) 994 ) --> 996 attrs = copy.deepcopy(self._attrs) if deep else copy.copy(self._attrs) 997 encoding = copy.deepcopy(self._encoding) if deep else copy.copy(self._encoding) 999 # note: dims is already an immutable tuple File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:146, in deepcopy(x, memo, _nil) 144 copier = _deepcopy_dispatch.get(cls) 145 if copier is not None: --> 146 y = copier(x, memo) 147 else: 148 if issubclass(cls, type): File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:231, in _deepcopy_dict(x, memo, deepcopy) 229 memo[id(x)] = y 230 for key, value in x.items(): --> 231 y[deepcopy(key, memo)] = deepcopy(value, memo) 232 return y File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:153, in deepcopy(x, memo, _nil) 151 copier = getattr(x, "deepcopy", None) 152 if copier is not None: --> 153 y = copier(memo) 154 else: 155 reductor = dispatch_table.get(cls) File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/dataarray.py:1190, in DataArray.deepcopy(self, memo) 1187 def deepcopy(self: T_DataArray, memo=None) -> T_DataArray: 1188 # memo does nothing but is required for compatibility with 1189 # copy.deepcopy -> 1190 return self.copy(deep=True)
File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/variable.py:996, in Variable.copy(self, deep, data) 989 if self.shape != ndata.shape: 990 raise ValueError( 991 "Data shape {} must match shape of object {}".format( 992 ndata.shape, self.shape 993 ) 994 ) --> 996 attrs = copy.deepcopy(self._attrs) if deep else copy.copy(self._attrs) 997 encoding = copy.deepcopy(self._encoding) if deep else copy.copy(self._encoding) 999 # note: dims is already an immutable tuple File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:146, in deepcopy(x, memo, _nil) 144 copier = _deepcopy_dispatch.get(cls) 145 if copier is not None: --> 146 y = copier(x, memo) 147 else: 148 if issubclass(cls, type): File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:231, in _deepcopy_dict(x, memo, deepcopy) 229 memo[id(x)] = y 230 for key, value in x.items(): --> 231 y[deepcopy(key, memo)] = deepcopy(value, memo) 232 return y File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:153, in deepcopy(x, memo, _nil) 151 copier = getattr(x, "deepcopy", None) 152 if copier is not None: --> 153 y = copier(memo) 154 else: 155 reductor = dispatch_table.get(cls) File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/dataarray.py:1190, in DataArray.deepcopy(self, memo) 1187 def deepcopy(self: T_DataArray, memo=None) -> T_DataArray: 1188 # memo does nothing but is required for compatibility with 1189 # copy.deepcopy -> 1190 return self.copy(deep=True) File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/dataarray.py:1172, in DataArray.copy(self, deep, data)
1104 def copy(self: T_DataArray, deep: bool = True, data: Any = None) -> T_DataArray:
1105 """Returns a copy of this array.
1106
1107 If File ~/miniconda3/envs/satpy_py310/lib/python3.10/site-packages/xarray/core/variable.py:985, in Variable.copy(self, deep, data) 982 ndata = indexing.MemoryCachedArray(ndata.array) 984 if deep: --> 985 ndata = copy.deepcopy(ndata) 987 else: 988 ndata = as_compatible_data(data) File ~/miniconda3/envs/satpy_py310/lib/python3.10/copy.py:137, in deepcopy(x, memo, _nil) 134 if memo is None: 135 memo = {} --> 137 d = id(x) 138 y = memo.get(d, _nil) 139 if y is not _nil: RecursionError: maximum recursion depth exceeded while calling a Python object ``` MVCE confirmation
Relevant log outputNo response Anything else we need to know?I have at least one other issue related to the new xarray release but I'm still tracking it down. I think it is also related to the deep copy behavior change which was merged a day before the release so our CI didn't have time to test the "unstable" version of xarray. Environment
```
INSTALLED VERSIONS
------------------
commit: None
python: 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:35:26) [GCC 10.4.0]
python-bits: 64
OS: Linux
OS-release: 5.19.0-76051900-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.8.1
xarray: 2022.9.0
pandas: 1.5.0
numpy: 1.23.3
scipy: 1.9.1
netCDF4: 1.6.1
pydap: None
h5netcdf: 1.0.2
h5py: 3.7.0
Nio: None
zarr: 2.13.2
cftime: 1.6.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.3.2
cfgrib: None
iris: None
bottleneck: 1.3.5
dask: 2022.9.1
distributed: 2022.9.1
matplotlib: 3.6.0
cartopy: 0.21.0
seaborn: None
numbagg: None
fsspec: 2022.8.2
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 65.4.0
pip: 22.2.2
conda: None
pytest: 7.1.3
IPython: 8.5.0
sphinx: 5.2.3
```
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7111/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
812692450 | MDU6SXNzdWU4MTI2OTI0NTA= | 4934 | ImplicitToExplicitIndexingAdapter being returned with dask unstable version | djhoese 1828519 | closed | 0 | 4 | 2021-02-20T19:41:12Z | 2021-03-09T22:51:13Z | 2021-03-09T22:51:13Z | CONTRIBUTOR | What happened: I have a couple CI environments that use unstable versions of xarray and dask among other libraries. A couple tests have been failing in different but similar ways. I was able to get one of them down to the below example. This happens with the dask master branch on either the xarray latest release or xarray master. Here are the commits I was using when doing unstable both. Dask: I don't see this with dask's latest release and this is likely caused by a change in dask, but after seeing PRs like #4884 I'm wondering if this is something similar and requires a change in xarray. The bottom line is that doing various things like
What you expected to happen: I would expect to get a numpy array back when computing the underlying dask array. Minimal Complete Verifiable Example: ```python from PIL import Image import xarray as xr import numpy as np create a test imageImage.fromarray(np.zeros((5, 5, 3), dtype=np.uint8)).save('test.png') r = xr.open_rasterio('test.png', chunks='auto') print(r.data.compute()) ImplicitToExplicitIndexingAdapter(array=CopyOnWriteArray(array=LazilyOuterIndexedArray(array=<xarray.backends.rasterio_.RasterioArrayWrapper object at 0x7f25e72bcc10>, key=BasicIndexer((slice(0, 2, 1), slice(0, 100, 1), slice(0, 100, 1))))))``` Anything else we need to know?: As mentioned above other weird things are happening when array wrappers seem to be involved but I haven't been able to make a small example of them. Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:33:48) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.8.0-7642-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.3 xarray: 0.16.3.dev132+geb7e112d pandas: 1.2.2 numpy: 1.20.1 scipy: 1.6.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: 2.6.2.dev42 cftime: 1.4.1 nc_time_axis: None PseudoNetCDF: None rasterio: 1.3dev cfgrib: None iris: None bottleneck: 1.4.0.dev0+117.gf2bc792 dask: 2021.02.0+21.gad01acc1 distributed: 2021.02.0+7.g383ea032 matplotlib: 3.4.0rc1 cartopy: 0.17.0 seaborn: None numbagg: None pint: None setuptools: 45.2.0.post20200209 pip: 20.0.2 conda: None pytest: 5.3.5 IPython: 7.12.0 sphinx: 2.4.3 |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4934/reactions", "total_count": 3, "+1": 3, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
449840662 | MDU6SXNzdWU0NDk4NDA2NjI= | 2996 | Checking non-dimensional coordinates for equality | djhoese 1828519 | open | 0 | 3 | 2019-05-29T14:24:41Z | 2021-03-02T05:08:32Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possibleI'm working on a proof-of-concept for the I'm having trouble deciding what the best place is for this CRS information so that it benefits the user; ```python from pyproj import CRS import xarray as xr import dask.array as da crs1 = CRS.from_string('+proj=lcc +datum=WGS84 +lon_0=-95 +lat_0=25 +lat_1=25') crs2 = CRS.from_string('+proj=lcc +datum=WGS84 +lon_0=-95 +lat_0=35 +lat_1=35') a = xr.DataArray(da.zeros((5, 5), chunks=2), dims=('y', 'x'), coords={'y': da.arange(1, 6, chunks=3), 'x': da.arange(2, 7, chunks=3), 'crs': crs1, 'test': 1, 'test2': 2}) b = xr.DataArray(da.zeros((5, 5), chunks=2), dims=('y', 'x'), coords={'y': da.arange(1, 6, chunks=3), 'x': da.arange(2, 7, chunks=3), 'crs': crs2, 'test': 2, 'test2': 2}) a + b Results in:<xarray.DataArray 'zeros-e5723e7f9121b7ac546f61c19dabe786' (y: 5, x: 5)>dask.array<shape=(5, 5), dtype=float64, chunksize=(2, 2)>Coordinates:* y (y) int64 1 2 3 4 5* x (x) int64 2 3 4 5 6test2 int64 2``` In the above code I was hoping that because the Any ideas for how I might be able to accomplish something like this? I'm not an expert on xarray/pandas indexes, but could this be another possible solution? Edit: |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2996/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
xarray 13221727 | issue | ||||||||
425415572 | MDU6SXNzdWU0MjU0MTU1NzI= | 2853 | Future plans for versioneer | djhoese 1828519 | closed | 0 | 3 | 2019-03-26T13:23:51Z | 2020-07-26T11:23:44Z | 2020-07-26T11:23:44Z | CONTRIBUTOR | I have projects that use versioneer after finding out that xarray and dask used it. However, it seems the project is no longer actively maintained with the last commit happening almost 2 years ago: https://github.com/warner/python-versioneer There are two issues I've found with versioneer:
So my question is, do the xarray devs (or dask devs) see this as a problem? What are your plans for the future? Have you enjoyed using versioneer? I guess I should probably CC @warner on this too in case they are still active on github. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2853/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
314457748 | MDU6SXNzdWUzMTQ0NTc3NDg= | 2060 | Confusing error message when attribute not equal during concat | djhoese 1828519 | closed | 0 | 3 | 2018-04-15T22:20:12Z | 2019-12-24T13:37:04Z | 2019-12-24T13:37:04Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possible```python In [1]: import dask.array as da; import xarray as xr; import numpy as np In [2]: a = xr.DataArray(da.random.random((4, 6), chunks=2), attrs={'test': ['x1', 'y1']}, dims=('y', 'x')) In [3]: b = xr.DataArray(da.random.random((4, 6), chunks=2), attrs={'test': ['x2', 'y2']}, dims=('y', 'x')) In [4]: xr.concat([a, b], 'y')ValueError Traceback (most recent call last) <ipython-input-4-c8b32db4cfb7> in <module>() ----> 1 xr.concat([a, b], 'y') ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/combine.py in concat(objs, dim, data_vars, coords, compat, positions, indexers, mode, concat_over) 119 raise TypeError('can only concatenate xarray Dataset and DataArray ' 120 'objects, got %s' % type(first_obj)) --> 121 return f(objs, dim, data_vars, coords, compat, positions) 122 123 ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/combine.py in _dataarray_concat(arrays, dim, data_vars, coords, compat, positions) 337 338 ds = _dataset_concat(datasets, dim, data_vars, coords, compat, --> 339 positions) 340 return arrays[0]._from_temp_dataset(ds, name) 341 ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/combine.py in _dataset_concat(datasets, dim, data_vars, coords, compat, positions) 303 if k in concat_over: 304 vars = ensure_common_dims([ds.variables[k] for ds in datasets]) --> 305 combined = concat_vars(vars, dim, positions) 306 insert_result_variable(k, combined) 307 ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/variable.py in concat(variables, dim, positions, shortcut) 1772 return IndexVariable.concat(variables, dim, positions, shortcut) 1773 else: -> 1774 return Variable.concat(variables, dim, positions, shortcut) 1775 1776 ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/variable.py in concat(cls, variables, dim, positions, shortcut) 1299 if var.dims != first_var.dims: 1300 raise ValueError('inconsistent dimensions') -> 1301 utils.remove_incompatible_items(attrs, var.attrs) 1302 1303 return cls(dims, data, attrs, encoding) ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/utils.py in remove_incompatible_items(first_dict, second_dict, compat) 157 if (k not in second_dict or 158 (k in second_dict and --> 159 not compat(first_dict[k], second_dict[k]))): 160 del first_dict[k] 161 ~/anaconda/envs/polar2grid_py36/lib/python3.6/site-packages/xarray/core/utils.py in equivalent(first, second) 106 return ((first is second) or 107 (first == second) or --> 108 (pd.isnull(first) and pd.isnull(second))) 109 110 ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() ``` Problem descriptionIf two or more Expected OutputI guess the expected result would be that the list attribute is not included in the resulting DataArray's attributes. Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2060/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
462859457 | MDU6SXNzdWU0NjI4NTk0NTc= | 3068 | Multidimensional dask coordinates unexpectedly computed | djhoese 1828519 | closed | 0 | 8 | 2019-07-01T18:52:03Z | 2019-11-05T15:41:15Z | 2019-11-05T15:41:15Z | CONTRIBUTOR | MCVE Code Sample```python from dask.diagnostics import ProgressBar import xarray as xr import numpy as np import dask.array as da a = xr.DataArray(da.zeros((10, 10), chunks=2), dims=('y', 'x'), coords={'y': np.arange(10), 'x': np.arange(10), 'lons': (('y', 'x'), da.zeros((10, 10), chunks=2))}) b = xr.DataArray(da.zeros((10, 10), chunks=2), dims=('y', 'x'), coords={'y': np.arange(10), 'x': np.arange(10), 'lons': (('y', 'x'), da.zeros((10, 10), chunks=2))}) with ProgressBar(): c = a + b ``` Output:
Problem DescriptionUsing arrays with 2D dask array coordinates results in the coordinates being computed for any binary operations (anything combining two or more DataArrays). I use In my own work, when I learned that 2D dask coordinates were possible, I started adding Is this computation by design or a possible bug? Expected OutputNo output from the Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3068/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
479420466 | MDU6SXNzdWU0Nzk0MjA0NjY= | 3205 | Accessors are recreated on every access | djhoese 1828519 | closed | 0 | 3 | 2019-08-11T22:27:14Z | 2019-08-14T05:33:48Z | 2019-08-14T05:33:48Z | CONTRIBUTOR | MCVE Code Sample
```python import xarray as xr @xr.register_dataarray_accessor('test') class TestDataArrayAccessor(object): def init(self, obj): self._obj = obj print("DataArray accessor created") @xr.register_dataset_accessor('test') class TestDatasetAccessor(object): def init(self, obj): self._obj = obj print("Dataset accessor created") ```
```python import xarray as xr import numpy as np import test_accesor ds = xr.Dataset({'a': xr.DataArray(np.array([1, 2, 3])), 'b': xr.DataArray(np.array([4, 5, 6]))}) ds.test Dataset accessor created <accessor created on first access - expected>ds.test <no output - expected>ds['a'].test DataArray accessor created <accessor created on first access - expected>ds['a'].test DataArray accessor created <accessor created on second access - unexpected>var = ds['a'] var.test DataArray accessor created <accessor created on direct instance access - expected/unexpected>var.test <no output - expected>``` Expected OutputBased on the xarray accessor documentation I would have assumed that the accessor would stick around on the same DataArray object for the life of the data. My guess is that Problem DescriptionI'm currently working on an accessor for a new package called
Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3205/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
446722089 | MDU6SXNzdWU0NDY3MjIwODk= | 2976 | Confusing handling of NetCDF coordinates | djhoese 1828519 | closed | 0 | 6 | 2019-05-21T16:47:47Z | 2019-05-21T23:36:22Z | 2019-05-21T23:36:21Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possibleI'm currently trying to figure out why some coordinates of a netcdf file are included in the resulting Dataset object and why some are not. I've tried looking at the To reproduce: Download GOES-16 ABI L1b NetCDF file from (click the link to have google redirect you to the actual file):
Results in:
Even though
and:
shows:
Problem descriptionI would have expected the Can someone summarize the rules on how xarray came up with these coordinates? Or is this a bug? Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2976/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue | ||||||
384449698 | MDU6SXNzdWUzODQ0NDk2OTg= | 2576 | When is transpose not lazy? | djhoese 1828519 | closed | 0 | 1 | 2018-11-26T18:10:36Z | 2019-03-12T15:01:18Z | 2019-03-12T15:01:18Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possible```python import xarray as xr import dask.array as da from dask.diagnostics import ProgressBar a = xr.DataArray(da.zeros((3, 5, 5), chunks=(1, 2, 2)), dims=('bands', 'y', 'x')) with ProgressBar(): b = a.transpose('y', 'x', 'bands') dask does not show a progress bar due to no computationwith ProgressBar(): b = a.transpose('y', 'x', 'bands') b.compute() dask computes the array (since we told it to) and we see a progress bar``` QuestionThe documentation for transpose says that it is not lazy. Is this only in certain situations? By not lazy does it mean that when the data is computed that the transpose task will require all data to be loaded at once (one large chunk) or does it mean that the transpose operation will immediately compute the transposed array? My test above does not seem to compute the data when Or is the documentation just outdated? |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2576/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
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]);