-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
open_mfdataset() on a single file drops the concat_dim #1988
Comments
This does seem inconsistent to me. Not that the behavior of concat already works with a single object: In [1]: import xarray as xr
In [2]: da = xr.DataArray([1, 2], dims='x', name='foo')
In [3]: xr.concat([da], dim='y')
Out[3]:
<xarray.DataArray 'foo' (y: 1, x: 2)>
array([[1, 2]])
Dimensions without coordinates: y, x The offending line is here: Lines 342 to 344 in 9261601
Based on this, I'm surprised my little example with concat works the way it does. In either event, it would be great if someone could spend some time normalizing the behavior here. |
Yes, this seems like a bug. |
Could the fix be as simple as |
@WeatherGod Possibly! As usual, tests are the hard part :) |
I'll give it a go tomorrow. My work has gotten to this point now, and I have some unit tests that happen to exercise this edge case. On a somewhat related note, would a Any interest? |
Yup... looks like that did the trick (for auto_combine and open_mfdataset). I even have a simple test to demonstrate it. PR coming shortly. |
* concat_dim for auto_combine for a single object is now respected Closes #1988 * Added what's new entry for the bugfix.
Closes pydata#2647 and re-affirms pydata#1988.
When calling
xr.open_mfdataset()
on a 1 element list of filenames, the concat dimension is never added.This isn't a MWE at the moment (will make one soon enough), just wanted to get my thoughts down.
Problem description
If there are two files, then there is a
time
coordinate, and the data array becomes 3D.Output of
xr.show_versions()
I am currently on a recent-ish master of xarray.
The text was updated successfully, but these errors were encountered: