Skip to content

Commit

Permalink
Add tolerances to tests affected by Trollimage dtype handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuu committed Nov 23, 2023
1 parent d250a9d commit 9244ba4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions satpy/tests/test_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ def test_basic_default_not_provided(self, sunz_ds1, as_32bit):
sunz_ds1 = sunz_ds1.astype(np.float32)
comp = SunZenithCorrector(name="sza_test", modifiers=tuple())
res = comp((sunz_ds1,), test_attr="test")
np.testing.assert_allclose(res.values, np.array([[22.401667, 22.31777], [22.437503, 22.353533]]))
np.testing.assert_allclose(res.values, np.array([[22.401667, 22.31777], [22.437503, 22.353533]]),
rtol=1e-6)
assert "y" in res.coords
assert "x" in res.coords
ds1 = sunz_ds1.copy().drop_vars(("y", "x"))
res = comp((ds1,), test_attr="test")
res_np = res.compute()
np.testing.assert_allclose(res_np.values, np.array([[22.401667, 22.31777], [22.437503, 22.353533]]))
np.testing.assert_allclose(res_np.values, np.array([[22.401667, 22.31777], [22.437503, 22.353533]]),
rtol=1e-6)
assert res.dtype == res_np.dtype
assert "y" not in res.coords
assert "x" not in res.coords
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/writer_tests/test_ninjogeotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def test_write_and_read_file_units(
np.testing.assert_allclose(float(tgs["ninjo_Gradient"]),
0.467717, rtol=1e-5)
np.testing.assert_allclose(float(tgs["ninjo_AxisIntercept"]),
-79.86771)
-79.86771, rtol=1e-5)
fn2 = os.fspath(tmp_path / "test2.tif")
with caplog.at_level(logging.WARNING):
ngtw.save_dataset(
Expand Down

0 comments on commit 9244ba4

Please sign in to comment.