SlideRuleEarth / sliderule

Server and client framework for on-demand science data processing in the cloud
https://slideruleearth.io
Other
25 stars 11 forks source link

Intermittent pytest raster subsetting failures #358

Open jpswinski opened 7 months ago

jpswinski commented 7 months ago

Intermittently, the raster subsetting test will fail with one of the asserted values being close but not exact. It is unclear why there is non-determinism in the test execution.

    def test_rasterize(self, init):
        resource = "ATL03_20181017222812_02950102_005_01.h5"
        region = sliderule.toregion(os.path.join(TESTDIR, "data/grandmesa.geojson"))
        parms = {
            "poly": region['poly'],
            "raster": region['raster'],
            "srt": icesat2.SRT_LAND,
            "cnf": icesat2.CNF_SURFACE_LOW,
            "ats": 20.0,
            "cnt": 10,
            "len": 40.0,
            "res": 20.0 }
        gdf = icesat2.atl06p(parms, resources=[resource])
        assert init
        assert len(gdf) == 953
>       assert abs(gdf["h_mean"].describe()["mean"] - 1749.8443895024502) < 0.01
E       assert 0.015798150227510632 < 0.01
E        +  where 0.015798150227510632 = abs((1749.8601876526777 - 1749.8443895024502))

FAILED tests/test_subsetting.py::TestSubsetting::test_rasterize - assert 0.015798150227510632 < 0.01
jpswinski commented 7 months ago

See above commit - pytest conditions are relaxed to allow tests to pass (and catch other issues). Once this issue is resolved, the test needs to be updated again to put back the stricter condition.