diff --git a/tests/test_xarrayfits.py b/tests/test_xarrayfits.py index 8cfb4e9..644086c 100644 --- a/tests/test_xarrayfits.py +++ b/tests/test_xarrayfits.py @@ -98,6 +98,7 @@ def test_beam_creation(beam_cube): cmp_data = cmp_data.reshape(xds.hdu0.shape) np.testing.assert_array_equal(xds.hdu0.data, cmp_data) assert xds.hdu0.data.shape == (257, 257, 32) + assert xds.hdu0.dims == ("hdu0-0", "hdu0-1", "hdu0-2") assert xds.hdu0.attrs == { "BITPIX": -64, "EQUINOX": 2000.0, diff --git a/xarrayfits/fits.py b/xarrayfits/fits.py index 1a0f7ea..ca91d2c 100644 --- a/xarrayfits/fits.py +++ b/xarrayfits/fits.py @@ -198,7 +198,7 @@ def _xarray_from_fits_hdu( fits_filename, fits_key, fits_graph, hdu_index, shape, dtype, flat_chunks ) - dims = tuple(f"{name_prefix}{hdu_index}-{i}" for i in range(naxis, 0, -1)) + dims = tuple(f"{name_prefix}{hdu_index}-{i}" for i in range(0, naxis)) attrs = {(k, v) for k, v in sorted(hdu.header.items())} return xr.DataArray(array, dims=dims, attrs=attrs)