home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 358853933

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/1839#issuecomment-358853933 https://api.github.com/repos/pydata/xarray/issues/1839 358853933 MDEyOklzc3VlQ29tbWVudDM1ODg1MzkzMw== 1386642 2018-01-19T03:07:32Z 2018-01-19T03:09:08Z CONTRIBUTOR

I guess the main reason barrier for me is initializing the coordinates quickly, which xr.DataArray(np.ones(3, 4), dims=['x', 'y']) doesn't do.

What would use suggest for the signature of a function like xr.ones?

Something like the following would work for me:

```python def ones(shape, dims=None): """Create DataArray of ones with initialized coordinates

Parameters
----------
shape : tuple
    shape of the array
dims : list of str, optional
    list of dimensions with same length as shape. The default will be
    dim_0, dim_1,...,etc
coordinate_initializer : optional
    function which returns the appropriate coordinates. The signature for
    this function must be coordinate_initializer(dim, dim_length). The
    default is to initialize all the coordinates with
    ``np.arange(dim_length)``
"""
pass

```

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