home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 219321876

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
219321876 MDU6SXNzdWUyMTkzMjE4NzY= 1352 Saving to netCDF with 0D dimension doesn't work 358378 closed 0     9 2017-04-04T17:16:40Z 2021-07-17T18:38:29Z 2021-07-17T18:38:15Z CONTRIBUTOR      

I'm using xarray 0.9.1.

When I have an array

<xarray.Dataset>
Dimensions:       (category: 1, lat: 672, lon: 720, species: 1)
Coordinates:
  * lat           (lat) float64 30.03 30.09 30.16 30.22 30.28 30.34 30.41 ...
  * category      (category) <U3 'agr'
  * species       (species) <U4 'PM10'
  * lon           (lon) float64 -29.94 -29.81 -29.69 -29.56 -29.44 -29.31 ...
Data variables:
    TNO-MACC3_EU  (lon, lat) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...

and try to write to netCDF using .to_netcdf(), I get an

IndexError: tuple index out of range

I can fix this by manually doing

d_['species'] = np.atleast_1d(d_['species'])
d_['category'] = np.atleast_1d(d_['category'])

before calling .to_netcdf().

I believe it would be good if xarray would do this check on its own and apply the coorection on-the-fly to allow saving to netCDF in this case as well.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1352/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 9 rows from issue in issue_comments
Powered by Datasette · Queries took 0.691ms · About: xarray-datasette