Skip to content

Commit 6ef6422

Browse files
committed
added ancillary pytest
1 parent ca8c856 commit 6ef6422

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/test_ancillary.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Tests for sliderule-python icesat2 api."""
2+
3+
import pytest
4+
from requests.exceptions import ConnectTimeout, ConnectionError
5+
import sliderule
6+
from sliderule import icesat2
7+
from pathlib import Path
8+
import os.path
9+
10+
TESTDIR = Path(__file__).parent
11+
12+
@pytest.mark.network
13+
class TestRemote:
14+
15+
def test_geo(self, server, asset, organization):
16+
icesat2.init(server, organization=organization)
17+
region = icesat2.toregion(os.path.join(TESTDIR, "data/grandmesa.geojson"))
18+
parms = {
19+
"poly": region["poly"],
20+
"srt": icesat2.SRT_LAND,
21+
"atl03_geo_fields": ["solar_elevation"]
22+
}
23+
gdf = icesat2.atl06p(parms, asset, resources=["ATL03_20181017222812_02950102_005_01.h5"])
24+
assert len(gdf["solar_elevation"]) == 1180
25+
assert gdf['solar_elevation'].describe()["min"] - 20.803468704223633 < 0.0000001
26+
27+
def test_ph(self, server, asset, organization):
28+
icesat2.init(server, organization=organization)
29+
region = icesat2.toregion(os.path.join(TESTDIR, "data/grandmesa.geojson"))
30+
parms = {
31+
"poly": region["poly"],
32+
"srt": icesat2.SRT_LAND,
33+
"atl03_ph_fields": ["ph_id_count"]
34+
}
35+
gdf = icesat2.atl03s(parms, "ATL03_20181017222812_02950102_005_01.h5", asset)
36+
assert gdf["ph_id_count"][0] == 2
37+
assert gdf["ph_id_count"][1] == 1
38+
assert gdf["ph_id_count"][2] == 2
39+
assert gdf["ph_id_count"][3] == 1
40+
assert gdf["ph_id_count"][4] == 1
41+
assert len(gdf["ph_id_count"]) == 410233

0 commit comments

Comments
 (0)