pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.62k stars 1.08k forks source link

⚠️ Nightly upstream-dev CI failed ⚠️ #7158

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Workflow Run URL

Python 3.10 Test Summary ``` xarray/tests/test_formatting.py::test__mapping_repr_recursive: ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part. xarray/tests/test_variable.py::TestVariable::test_index_0d_timedelta64: AssertionError: assert dtype('\narray([ 0, 86400, 172800], dtype='timedelta64[s]').dtype + and dtype('('timedelta64[ns]') + where = np.dtype xarray/tests/test_variable.py::TestVariable::test_timedelta64_conversion_scalar: AssertionError: assert dtype('\narray(86400, dtype='timedelta64[s]').dtype + and dtype('('timedelta64[ns]') + where = np.dtype xarray/tests/test_variable.py::TestVariable::test_0d_timedelta: AssertionError: assert dtype('\narray(1, dtype='timedelta64[s]').dtype + and dtype('('timedelta64[ns]') + where = np.dtype xarray/tests/test_variable.py::TestVariableWithDask::test_index_0d_timedelta64: AssertionError: assert dtype('\ndask.array.dtype + and dtype('('timedelta64[ns]') + where = np.dtype xarray/tests/test_variable.py::TestIndexVariable::test_index_0d_timedelta64: AssertionError: Items are not equal: ACTUAL: numpy.timedelta64(3600000000,'ns') DESIRED: numpy.timedelta64(3600000000,'us') xarray/tests/test_variable.py::TestIndexVariable::test_timedelta64_conversion: AssertionError: assert dtype('\narray([ 0, 86400, 172800], dtype='timedelta64[s]').dtype + and dtype('('timedelta64[ns]') + where = np.dtype ```
headtr1ck commented 2 years ago

Is that a valid syntax: xr.Dataset({"a": [["x"], [1, 2, 3]]}), or does one need to use a tuple? It seems to use the full list as data and then fails because it is inhomogeneous.

Why does this only fail in upstream?

dcherian commented 2 years ago

It warns on the release version:

/Users/dcherian/mambaforge/envs/flox-tests/lib/python3.10/site-packages/xarray/core/variable.py:243: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  data = np.asarray(data)
headtr1ck commented 2 years ago

Ok, then I think using a list to create a DataArray is not supported by xarray. I never noticed before, haha!