home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 473354516

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/2811#issuecomment-473354516 https://api.github.com/repos/pydata/xarray/issues/2811 473354516 MDEyOklzc3VlQ29tbWVudDQ3MzM1NDUxNg== 5821660 2019-03-15T16:30:38Z 2019-03-15T16:30:38Z MEMBER

@shoyer I'm sorry if I did not explain well enough and if my intentions were vague. So let me first clarify, I really appreciate all your hard work to make xarray better. I've adapted many of my workflows to use xarray and I'm happy that such a library exist.

Let's consider just one more example where I hopefully get better to the point of my problems in understanding.

Two files are created, same dimensions, same data, but one without coordinates the other with coordinates.

```python data = np.zeros((2,3)) src_dim0 = xr.Dataset({'test': (['c', 'b'], data)}) src_dim0.to_netcdf('src_dim0.nc')

src_dim1 = xr.Dataset({'test': (['c', 'b'], data)}, coords={'c': (['c'], np.arange(data.shape[0])), 'b': (['b'], np.arange(data.shape[1])),}) src_dim1.to_netcdf('src_dim1.nc') The dump of both: netcdf src_dim0 { dimensions: c = 2 ; b = 3 ; variables: double test(c, b) ; test:_FillValue = NaN ; data:

test = 0, 0, 0, 0, 0, 0 ; }

netcdf src_dim1 { dimensions: c = 2 ; b = 3 ; variables: double test(c, b) ; test:_FillValue = NaN ; int64 c(c) ; int64 b(b) ; data:

test = 0, 0, 0, 0, 0, 0 ;

c = 0, 1 ;

b = 0, 1, 2 ; } ```

Now, from the dump, the 'c' dimension is first in both. Lets read those files again and concat them along the c-dimension:

```python dst_dim0 = xr.open_dataset('src_dim0.nc') dst_dim0 = xr.concat([dst_dim0, dst_dim0], dim='c') dst_dim0.to_netcdf('dst_dim0.nc')

dst_dim1 = xr.open_dataset('src_dim1.nc') dst_dim1 = xr.concat([dst_dim1, dst_dim1], dim='c') dst_dim1.to_netcdf('dst_dim1.nc') ```

Now, and this is what confuses me, the file without coordinates has 'c' dimension first and the file with coordinates has 'b' dimension first.: ``` netcdf dst_dim0 { dimensions: c = 4 ; b = 3 ; variables: double test(c, b) ; test:_FillValue = NaN ; data:

test = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; }

netcdf dst_dim1 { dimensions: b = 3 ; c = 4 ; variables: int64 b(b) ; double test(c, b) ; test:_FillValue = NaN ; int64 c(c) ; data:

b = 0, 1, 2 ;

test = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;

c = 0, 1, 0, 1 ; } ```

I really like to understand why there is this difference. Thanks for your patience!

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