home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 273687248

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/1217#issuecomment-273687248 https://api.github.com/repos/pydata/xarray/issues/1217 273687248 MDEyOklzc3VlQ29tbWVudDI3MzY4NzI0OA== 1217238 2017-01-19T05:42:25Z 2017-01-19T05:43:22Z MEMBER

For reference, it may be helpful to try your example on a smaller dataset: ds = xr.Dataset() ds['data1'] = xr.DataArray(np.arange(100), coords={'t1': np.linspace(0, 1, 100)}) ds['data1b'] = xr.DataArray(np.arange(100, 200), coords={'t1': np.linspace(0, 1, 100)}) ds['data2'] = xr.DataArray(np.arange(200, 500), coords={'t2': np.linspace(0, 1, 300)}) ds['data2b'] = xr.DataArray(np.arange(600, 900), coords={'t2': np.linspace(0, 1, 300)}) This is what the data looks like: ```

ds <xarray.Dataset> Dimensions: (t1: 100, t2: 300) Coordinates: * t1 (t1) float64 0.0 0.0101 0.0202 0.0303 0.0404 0.05051 0.06061 ... * t2 (t2) float64 0.0 0.003344 0.006689 0.01003 0.01338 0.01672 ... Data variables: data1 (t1) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... data1b (t1) int64 100 101 102 103 104 105 106 107 108 109 110 111 112 ... data2 (t2) int64 200 201 202 203 204 205 206 207 208 209 210 211 212 ... data2b (t2) int64 600 601 602 603 604 605 606 607 608 609 610 611 612 ... and here's what happens with `where`: ds.where(ds.data1 < 50, drop=True) <xarray.Dataset> Dimensions: (t1: 50, t2: 300) Coordinates: * t1 (t1) float64 0.0 0.0101 0.0202 0.0303 0.0404 0.05051 0.06061 ... * t2 (t2) float64 0.0 0.003344 0.006689 0.01003 0.01338 0.01672 ... Data variables: data1 (t1) float64 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 ... data1b (t1) float64 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 ... data2 (t2, t1) float64 200.0 200.0 200.0 200.0 200.0 200.0 200.0 ... data2b (t2, t1) float64 600.0 600.0 600.0 600.0 600.0 600.0 600.0 ... ```

I suspect this probably isn't really doing what you want, unless you really want two-dimensional versions of data2 and data2b. It probably makes more sense to subset out the relevant variables first.

Broadcasting producing gigantic arrays without any warning is really a NumPy issue, e.g., trynp.where(True, np.zeros((1000000, 1)), np.ones((1, 1000000))) (this will probably crash your computer!).

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