Skip to content

HEALPix: Grid.node_lat raises TypeError: 'Grid' object does not support item assignment #1637

Description

@rajeeja

Grid.node_lat fails on any HEALPix grid when node_lat has not already been populated.

import uxarray as ux
ux.Grid.from_healpix(zoom=2).node_lat
File "uxarray/grid/grid.py", line 1003, in node_lat
    _populate_healpix_boundaries(self)
File "uxarray/io/_healpix.py", line 181, in _populate_healpix_boundaries
    ds["node_lon"] = xr.DataArray(node_lon, dims=["n_node"], attrs=ugrid.NODE_LON_ATTRS)
TypeError: 'Grid' object does not support item assignment

_populate_healpix_boundaries expects an xr.Dataset. The node_lon property passes self._ds correctly (grid.py:982), but the node_lat property passes self (grid.py:1003).

Fix is _populate_healpix_boundaries(self._ds) at grid.py:1003.

Reproduces on current main (d83d23d) at every zoom level. Accessing node_lon first masks the failure, which is why it is not caught by existing tests.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
👀 In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions