home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 518747403

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/3159#issuecomment-518747403 https://api.github.com/repos/pydata/xarray/issues/3159 518747403 MDEyOklzc3VlQ29tbWVudDUxODc0NzQwMw== 23618263 2019-08-06T16:36:42Z 2019-08-06T16:36:42Z CONTRIBUTOR

So far, this addition can do the following:

  • Use a scalar value ```python

    xr.DataArray(5, coords=[('x', np.arange(3)), ('y', ['a', 'b'])])

<xarray.DataArray (x: 3, y: 2)> array([[5, 5], [5, 5], [5, 5]]) Coordinates: * x (x) int64 0 1 2 * y (y) <U1 'a' 'b' ```

  • Use a scalar array ```python

    xr.DataArray(np.array(1.0), coords=[('x', np.arange(3)), ('y', ['a', 'b'])])

<xarray.DataArray (x: 3, y: 2)> array([[1., 1.], [1., 1.], [1., 1.]]) Coordinates: * x (x) int64 0 1 2 * y (y) <U1 'a' 'b' ```

  • Match any number of dims ```python

    xr.DataArray(0, coords={'x': pd.date_range('20190101', '20190131'), 'y': ['north', 'south'], 'z': np.arange(4)}, dims=['w', 'x', 'y', 'p', 'z'])

<xarray.DataArray (w: 1, x: 31, y: 2, p: 1, z: 4)> array([[[[[0, ..., 0]],

     [[0, ..., 0]]],


    ...,


    [[[0, ..., 0]],

     [[0, ..., 0]]]]])

Coordinates: * x (x) datetime64[ns] 2019-01-01 2019-01-02 ... 2019-01-30 2019-01-31 * y (y) <U5 'north' 'south' * z (z) int64 0 1 2 3 Dimensions without coordinates: w, p ```

  • Use None to get an empty array

```python

xr.DataArray(None, coords={'x': np.datetime64('2019-01-01'), 'y': np.arange(100), 'z': 'ST1', 'p': np.arange(10)}, dims=['y', 'p'])

<xarray.DataArray (y: 100, p: 10)> array([[ 4.047386e-320, 6.719293e-321, 0.000000e+000, ..., 6.935425e-310, 6.935319e-310, 0.000000e+000], [ 4.940656e-324, 6.935107e-310, 6.935432e-310, ..., 6.935432e-310, 1.086944e-322, 6.935430e-310], [ 6.935432e-310, 6.935319e-310, 2.758595e-313, ..., 6.935432e-310, 6.935432e-310, 6.935432e-310], ..., [ 6.781676e+194, 3.328071e-113, 9.124901e+192, ..., 2.195875e-157, -4.599251e-303, -2.217863e-250], [ 7.830998e+247, -8.407382e+089, 1.299071e+193, ..., 9.124901e+192, -4.661908e-303, 2.897933e+193], [ 1.144295e-309, 7.041423e+053, -8.538757e-210, ..., 1.473665e+256, -6.525461e-210, -1.665001e-075]]) Coordinates: x datetime64[ns] 2019-01-01 * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 ... 90 91 92 93 94 95 96 97 98 99 z <U3 'ST1' * p (p) int64 0 1 2 3 4 5 6 7 8 9 ```

Any comment on what is missing or needs to be fixed is welcome.

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