Description
Code Sample, a copy-pastable example if possible
The problem occurs for me in the midst of a data-processing pipeline that starts with some ~40MB netCDF files. I've tried to create pasteable code that reproduces the behavior from scratch, but I haven't succeeded.
Problem description
I pass two DataArrays to xr.align()
with join="outer"
. The DataArrays are dtype float64, and contain a mix of NaNs and floats. They are 2D and have MultiIndexes with some numeric and some string levels.
The tuple of DataArrays returned by align()
have the correct shape and expected indexes, but the contents of the arrays are all NaNs. The original float values are gone. np.nonzero(~np.isnan(da))
returns an empty array.
I've set breakpoints and delved into the code. On line 656 in xarray.core.variable.Variable._getitem_with_mask
, self
contains non-NaN values, but the data
returned by as_indexable(self._data)[actual_indexer]
evaluates as all NaNs. However, data.array
at that point (which is xarray.backends.netCDF4_.NetCDF4ArrayWrapper
) has non-NaNs. So it's some sort of masking caused by the indexing that makes it look like data
is all NaNs.
Expected Output
A tuple of DataArrays which contain some non-NaN values.
Output of xr.show_versions()
xarray: 0.10.4
pandas: 0.22.0
numpy: 1.14.0
scipy: 1.0.0
netCDF4: 1.3.1
h5netcdf: None
h5py: None
Nio: None
zarr: None
bottleneck: None
cyordereddict: None
dask: None
distributed: None
matplotlib: 2.1.2
cartopy: None
seaborn: None
setuptools: 38.4.0
pip: 9.0.1
conda: None
pytest: 3.3.2
IPython: 6.2.1
sphinx: None