home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 174404136

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
174404136 MDExOlB1bGxSZXF1ZXN0ODM1NDgwNzU= 996 add 'no_conflicts' as compat option for merging non-conflicting data 8982598 closed 0     8 2016-08-31T23:38:00Z 2016-09-15T16:07:16Z 2016-09-15T16:07:16Z CONTRIBUTOR   0 pydata/xarray/pulls/996

This solves #742 and partially #835 (does not address a combine_first option yet). It essentially adds a notnull_equals method to Variable (and currently DataArray/set) that merge can use to compare objects, subsequently combining them with 'fillna'. Used as such:

``` python

import xarray as xr ds1 = xr.Dataset(data_vars={'x': ('a', [1, 2])}) ds2 = xr.Dataset(data_vars={'x': ('a', [2, 3])}, coords={'a': [1, 2]}) xr.merge([ds1, ds2], compat='notnull_equals') <xarray.Dataset> Dimensions: (a: 3) Coordinates: * a (a) int64 0 1 2 Data variables: x (a) float64 1.0 2.0 3.0 ```

Should be very easy to add other merging options such as overwriting left to write and vice versa.

TODO

  • docs
  • tests for various type combinations
  • some of the error excepting is mirrored from equals and might not be necessary (e.g. for numpy structured arrays).

ISSUES

  • It seemed natural to add notnull_equals as a method to Dataset, but it might be unnecessary/not useful. Current version is conservative in that it still requires aligned Datasets with all the same variables.
  • Due to the float nature of NaN, type is sometimes not preserved, e.g. merging two int arrays yields a float array, even when the final array has no NaN values itself.
  • float rounding errors can cause unintended failures, so a notnull_allclose option might be nice.

Currently all tests passing (6 new), and no flake8 errors on the diff...

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

Links from other tables

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