home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 660136749

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/4234#issuecomment-660136749 https://api.github.com/repos/pydata/xarray/issues/4234 660136749 MDEyOklzc3VlQ29tbWVudDY2MDEzNjc0OQ== 1610850 2020-07-17T14:26:35Z 2020-07-17T14:32:03Z CONTRIBUTOR

@jthielen Something like this?

```python import xarray as xr import cupy as cp

@xr.register_dataset_accessor("cupy") class CupyAccessor: def to_cupy(self): """Convert all data arrays to cupy."""

    for var in self.data_vars: 
        self.data_vars[var].data = cp.asarray(self.data_vars[var].data)

    return self

```

Which would then be used like this.

```python import xarray as xr import cupy as cp

ds = xr.open_mfdataset("/path/to/files/*.nc") gds = ds.cupy.to_cupy() ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  659129613
Powered by Datasette · Queries took 0.533ms · About: xarray-datasette