22
33import pytest
44from pathlib import Path
5+ import numpy
56import os
67import os .path
78import sliderule
@@ -26,7 +27,7 @@ def test_atl06(self, domain, asset, organization):
2627 "output" : { "path" : "testfile1.parquet" , "format" : "parquet" , "open_on_complete" : True } }
2728 gdf = icesat2 .atl06p (parms , asset = asset , resources = [resource ])
2829 assert len (gdf ) == 964
29- assert len (gdf .keys ()) == 17
30+ assert len (gdf .keys ()) == 16
3031 assert gdf ["rgt" ][0 ] == 1160
3132 assert gdf ["cycle" ][0 ] == 2
3233 assert gdf ['segment_id' ].describe ()["min" ] == 405240
@@ -48,9 +49,49 @@ def test_atl03(self, domain, asset, organization):
4849 "output" : { "path" : "testfile2.parquet" , "format" : "parquet" , "open_on_complete" : True } }
4950 gdf = icesat2 .atl03sp (parms , asset = asset , resources = [resource ])
5051 assert len (gdf ) == 194696
51- assert len (gdf .keys ()) == 18
52+ assert len (gdf .keys ()) == 17
5253 assert gdf ["rgt" ][0 ] == 1160
5354 assert gdf ["cycle" ][0 ] == 2
5455 assert gdf ['segment_id' ].describe ()["min" ] == 405240
5556 assert gdf ['segment_id' ].describe ()["max" ] == 405915
5657 os .remove ("testfile2.parquet" )
58+
59+ def test_atl06_index (self , domain , asset , organization ):
60+ icesat2 .init (domain , organization = organization )
61+ resource = "ATL03_20181017222812_02950102_005_01.h5"
62+ region = sliderule .toregion (os .path .join (TESTDIR , "data/grandmesa.geojson" ))
63+ parms = {
64+ "poly" : region ["poly" ],
65+ "raster" : region ["raster" ],
66+ "srt" : icesat2 .SRT_LAND ,
67+ "cnf" : icesat2 .CNF_SURFACE_HIGH ,
68+ "ats" : 10.0 ,
69+ "cnt" : 10 ,
70+ "len" : 40.0 ,
71+ "res" : 20.0 ,
72+ "output" : { "path" : "testfile3.parquet" , "format" : "parquet" , "open_on_complete" : True } }
73+ gdf = icesat2 .atl06p (parms , asset = asset , resources = [resource ])
74+ assert len (gdf ) == 275
75+ assert gdf .index .values .min () == numpy .datetime64 ('2018-10-17T22:31:35.330187264' )
76+ assert gdf .index .values .max () == numpy .datetime64 ('2018-10-17T22:31:37.693747456' )
77+ os .remove ("testfile3.parquet" )
78+
79+ def test_atl03_index (self , domain , asset , organization ):
80+ icesat2 .init (domain , organization = organization )
81+ resource = "ATL03_20181017222812_02950102_005_01.h5"
82+ region = sliderule .toregion (os .path .join (TESTDIR , "data/grandmesa.geojson" ))
83+ parms = {
84+ "poly" : region ["poly" ],
85+ "raster" : region ["raster" ],
86+ "srt" : icesat2 .SRT_LAND ,
87+ "cnf" : icesat2 .CNF_SURFACE_HIGH ,
88+ "ats" : 10.0 ,
89+ "cnt" : 10 ,
90+ "len" : 40.0 ,
91+ "res" : 20.0 ,
92+ "output" : { "path" : "testfile4.parquet" , "format" : "parquet" , "open_on_complete" : True } }
93+ gdf = icesat2 .atl03sp (parms , asset = asset , resources = [resource ])
94+ assert len (gdf ) == 21029
95+ assert gdf .index .values .min () == numpy .datetime64 ('2018-10-17T22:31:35.330047488' )
96+ assert gdf .index .values .max () == numpy .datetime64 ('2018-10-17T22:31:37.695347456' )
97+ os .remove ("testfile4.parquet" )
0 commit comments