Skip to content

Commit bdcf02a

Browse files
committed
test: add icon cross_section test case
1 parent 2a839c9 commit bdcf02a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/io/test_icon.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,17 @@ def test_read_icon_grid(gridpath):
88
def test_read_icon_dataset(gridpath):
99
grid_path = gridpath("icon", "R02B04", "icon_grid_0010_R02B04_G.nc")
1010
uxds = ux.open_dataset(grid_path, grid_path)
11+
12+
def test_icon_cross_section(gridpath):
13+
grid_path = gridpath("icon", "R02B04", "icon_grid_0010_R02B04_G.nc")
14+
uxds = ux.open_dataset(grid_path, grid_path)
15+
16+
# Test cross_section with cell_area variable
17+
result = uxds.cell_area.cross_section(start=(0, -90), end=(0, 90))
18+
assert result is not None
19+
assert len(result) == 100 # 100 steps by default
20+
assert result.dims == ('steps',)
21+
assert all(result.coords['lon'] == 0.0) # Constant longitude
22+
assert result.coords['lat'].min() == -90.0
23+
assert result.coords['lat'].max() == 90.0
24+
assert result.attrs['units'] == 'steradian'

0 commit comments

Comments
 (0)