home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 607616849

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
607616849 MDU6SXNzdWU2MDc2MTY4NDk= 4009 Incoherencies between docs in open_mfdataset and combine_by_coords and its behaviour. 20629530 closed 0     2 2020-04-27T14:55:33Z 2020-06-24T18:22:19Z 2020-06-24T18:22:19Z CONTRIBUTOR      

PR #3877 adds nice control over the attrs of the ouput, but there are some incoherencies in the docs and the behaviour that break previously fine code.

MCVE Code Sample

python import xarray as xr out = xr.open_mfdataset('/files/with/*_conflicting_attrs.nc', combine='by_coords')

Expected Output

out having the attributes from the first file in the sorted glob list.

Problem Description

Fails with a MergeError .

In the doc of open_mfdataset it is said: attrs_file : str or pathlib.Path, optional Path of the file used to read global attributes from. By default global attributes are read from the first file provided, with wildcard matches sorted by filename. But in the code, open_mfdataset calls combine_by_coords without specifying its combine_attrs argument, which defaults to 'no_conflicts', instead of the expected 'override' or 'drop'. The attributes are anyway managed by open_mfdataset further down, but in the case of conflicts the code never reaches that point.

Also, in the doc of combine_by_coords the wrong default is specified: ``` combine_attrs : {'drop', 'identical', 'no_conflicts', 'override'}, default 'drop' String indicating how to combine attrs of the objects being merged:

    - 'drop': empty attrs on returned Dataset.
    - 'identical': all attrs must be the same on every object.
    - 'no_conflicts': attrs from all objects are combined, any that have
      the same name must also have the same value.
    - 'override': skip comparing and copy attrs from the first dataset to
      the result.

```

I think we expect either combine_by_coords to have 'drop' as the default or open_mfdataset to pass combine_attrs='drop'.

Versions

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 08:20:52) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.6.7-arch1-1 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: fr_CA.utf8 LOCALE: fr_CA.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.15.2.dev29+g7eeba59f pandas: 1.0.3 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.1.1.2 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2.14.0 distributed: 2.14.0 matplotlib: 3.2.1 cartopy: None seaborn: None numbagg: None setuptools: 46.1.3.post20200325 pip: 20.0.2 conda: None pytest: 5.4.1 IPython: 7.13.0 sphinx: 3.0.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4009/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

  • 0 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.608ms · About: xarray-datasette