home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 284225363

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/pull/1260#issuecomment-284225363 https://api.github.com/repos/pydata/xarray/issues/1260 284225363 MDEyOklzc3VlQ29tbWVudDI4NDIyNTM2Mw== 10050469 2017-03-05T12:42:45Z 2017-03-05T12:42:45Z MEMBER

@shoyer thanks for the tips, I think that getting the lons and lats from dask is probably the most elegant method.

After trying various things I am still struggling with dask, and in particular on how to apply elemwise to functions like np.meshgrid (I get shape broadcasting errors). To get me started, I'd be grateful for an example on how to use dask to replace the code snippet below:

```python import xarray as xr import numpy as np

ds = xr.DataArray(np.zeros((2, 3)), coords={'x': np.arange(3), 'y': np.arange(2)}, dims=['y', 'x']).to_dataset(name='data')

non-dask version

lon, lat = np.meshgrid(ds.x, ds.y) ds['lon'] = (('y', 'x'), lon) ds['lat'] = (('y', 'x'), lat) ds.set_coords(['lon', 'lat'], inplace=True) print(ds) ```

Thanks a lot!

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