Created
November 24, 2015 23:05
-
-
Save jfburkhart/6510dd8f0caab5b22479 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Trying to merge / combine to xray.Datasets: | |
In [161]: o1 = xray.Dataset({'x':(('t'), (np.ones(10)))}, coords={'t':np.arange(10)}) | |
In [162]: o2 = xray.Dataset({'x':(('t'), (np.ones(10) * 2))}, coords={'t':np.arange(5,15)}) | |
In [163]: o1 | |
Out[163]: | |
<xray.Dataset> | |
Dimensions: (t: 10) | |
Coordinates: | |
* t (t) int64 0 1 2 3 4 5 6 7 8 9 | |
Data variables: | |
x (t) float64 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 | |
In [164]: o2 | |
Out[164]: | |
<xray.Dataset> | |
Dimensions: (t: 10) | |
Coordinates: | |
* t (t) int64 5 6 7 8 9 10 11 12 13 14 | |
Data variables: | |
x (t) float64 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 | |
In [165]: o1.merge((o1 + o2), join='outer', overwrite_vars='x') | |
Out[165]: | |
<xray.Dataset> | |
Dimensions: (t: 10) | |
Coordinates: | |
* t (t) int64 0 1 2 3 4 5 6 7 8 9 | |
Data variables: | |
x (t) float64 nan nan nan nan nan 3.0 3.0 3.0 3.0 3.0 | |
This is what I want: | |
Out[AS I WANT]: | |
<xray.Dataset> | |
Dimensions: (t: 10) | |
Coordinates: | |
* t (t) int64 0 1 2 3 4 5 6 7 8 9 | |
Data variables: | |
x (t) float64 1.0 1.0 1.0 1.0 1.0 3.0 3.0 3.0 3.0 3.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment