home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 575939446

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
575939446 MDU6SXNzdWU1NzU5Mzk0NDY= 3830 Documentation request: add examples for carrying out "ncecat" in xarray 19657652 open 0     4 2020-03-05T01:58:17Z 2023-04-13T20:06:20Z   NONE      

In climate science, a very common task involves concatenating NetCDF files with identical variables, dimensions, and coordinates along a brand new "ensemble member" or "record" dimension. With the NetCDF Operators, this is accomplished using ncecat.

MCVE Code Sample

Currently, it seems the correct way to do this in xarray is with xarray.combine_nested as follows:

python import xarray as xr files = ['member1.nc', 'member2.nc', ...] ds = xr.open_mfdataset( files, combine='nested', concat_dim='record', )

Problem Description

While this works, there does not seem to be any mention of this use case in the combine_nested or open_mfdataset docs... and using combine='nested' to concatenate along a brand new dimension feels quite unintuitive to me.

It would be nice to have examples in combine_nested and/or open_mfdataset with this special usage or mention the possibility of creating brand new dimensions with concat_dim. For example:

python In [1]: import xarray as xr ...: datasets = [ ...: xr.Dataset({'temp': (('x', 'y'), np.random.rand(10, 20))}) ...: for i in range(3) ...: ] ...: xr.combine_nested(datasets, concat_dim='record') Out[1]: <xarray.Dataset> Dimensions: (record: 3, x: 10, y: 20) Dimensions without coordinates: record, x, y Data variables: temp (record, x, y) float64 0.32 0.4897 0.2659 ... 0.3485 0.0251 0.399

Output of xr.show_versions()

n/a

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

Links from other tables

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