Skip to content

Commit

Permalink
use arrow functions to extract cell coordinates (#114)
Browse files Browse the repository at this point in the history
* expect `cells_to_coordinates` to return a `RecordBatch`

* also use `assert_allclose` for the h3 tutorial

* changelog
  • Loading branch information
keewis authored Dec 9, 2024
1 parent 0e7c5e0 commit 82c3adf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

## Bug fixes

- use explicit `arrow` API to extract cell coordinates ({issue}`113`, {pull}`114`)

## Documentation

## Internal changes
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/h3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"metadata": {},
"outputs": [],
"source": [
"xr.testing.assert_equal(derived_ds, original_ds)"
"xr.testing.assert_allclose(derived_ds, original_ds)"
]
},
{
Expand Down
5 changes: 4 additions & 1 deletion xdggs/h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def cell_ids2geographic(
lat : array-like
The latitude coordinate values of the grid cells in degree
"""
lat, lon = cells_to_coordinates(cell_ids, radians=False)
result = cells_to_coordinates(cell_ids, radians=False)

lon = result.column("lng").to_numpy()
lat = result.column("lat").to_numpy()

return lon, lat

Expand Down

0 comments on commit 82c3adf

Please sign in to comment.