Skip to content

Commit

Permalink
Fix dimension creation
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins committed Mar 18, 2024
1 parent bc1a189 commit fedae73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/test_xarrayfits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion xarrayfits/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit fedae73

Please sign in to comment.