pydata / pydata/xarray

Feature request: merge compat overlap

Open
#4,110 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

xarray.merge should have an option compat overlap.
is that option is combine_first, but it has more sense inside of merge.

import xarray as xr
x1=xr.DataArray([1,2,3,4,11],dims=['time'],coords=[[4,5,6,7,3]]).to_dataset(name='fusionfria')
x2=xr.DataArray([5,6,7,8],dims=['time'],coords=[[0,1,2,3]]).to_dataset(name='fusionfria')
x1.combine_first(x2)

It could be useful to avoid the error in xarray.open_mfdataset, if the time index is overlapped between netcdf files.

ValueError: Resulting object does not have monotonic global indexes along dimension time

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the xarray.merge and DataArray.combine_first behavior shown in the example, then inspect how xarray.open_mfdataset handles overlapping time indexes. Define the intended compat-overlap semantics and verify them with focused merge and overlapping-index cases; done means the option works without the reported monotonic-index error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.