issues: 659129613
This data as json
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
659129613 | MDU6SXNzdWU2NTkxMjk2MTM= | 4234 | Add ability to change underlying array type | 1610850 | open | 0 | 12 | 2020-07-17T10:37:34Z | 2021-04-19T03:21:54Z | CONTRIBUTOR | Is your feature request related to a problem? Please describe. In order to use Xarray with alternative array types like Right now I'm doing something like this. ```python import xarray as xr import cupy as cp ds = xr.tutorial.load_dataset("air_temperature") ds.air.data = cp.asarray(ds.air.data) ``` However this will become burdensome when there are many data arrays and feels brittle and prone to errors. As I see it a conversion could instead be done in a couple of places; on load, or as a utility method. Currently Xarray supports NumPy and Dask array well. Numpy is the defrault and the way you specify whether a Dask array should be used is to give the Side note: There are a few places where the Dask array API bleeds into Xarray in order to have compatibility, the Describe the solution you'd like For other array types I would like to propose the addition of an This would result in something like the following. ```python import xarray as xr import cupy as cp ds = xr.open_mfdataset("/path/to/files/*.nc", asarray=cp.ndarray) ords = xr.open_mfdataset("/path/to/files/*.nc") gds = ds.asarray(cp.ndarray) ``` These operations would convert all data arrays to It is still unclear what to do about index variables, which are currently of type Describe alternatives you've considered Instead of an Another option would be to go more high level with it. For example a Additional context Related to #4212. I'm keen to start implementing this. But would like some discussion/feedback before I dive in here. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4234/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |