From 2d31d5d978c06205fd1ff78e8d6a3d1588af7b6e Mon Sep 17 00:00:00 2001 From: akrherz Date: Tue, 6 Aug 2024 13:46:45 -0500 Subject: [PATCH] fix: add IEMRE roundtrip test --- tests/test_iemre.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_iemre.py b/tests/test_iemre.py index e0c40dd2..d61376a1 100644 --- a/tests/test_iemre.py +++ b/tests/test_iemre.py @@ -114,8 +114,12 @@ def test_writing_grids(): cursor = pgconn.cursor() valid = datetime.date.today() + datetime.timedelta(days=120) ds = iemre.get_grids(valid, varnames=["high_tmpk"], domain=domain) + # Set a sentinel value to see if it approximately round-trips + sentinel = 251 + ds["high_tmpk"].values[140, 130] = sentinel iemre.set_grids(valid, ds, domain=domain) ds = iemre.get_grids(valid, varnames=["high_tmpk"], domain=domain) + assert abs(ds["high_tmpk"].values[140, 130] - sentinel) < 0.1 assert ds["high_tmpk"].lat[0] > 0 # Cleanup after ourself cursor.execute(