From 3aa69ffe75f489b5f3c04f42d198b1b1f3bf3050 Mon Sep 17 00:00:00 2001 From: niklasphabian Date: Wed, 3 Nov 2021 19:27:13 -0700 Subject: [PATCH 1/2] added test --- tests/test_ring.py | 1 - tests/test_ring2.py | 59 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/test_ring2.py diff --git a/tests/test_ring.py b/tests/test_ring.py index 9270873..6afe9a0 100644 --- a/tests/test_ring.py +++ b/tests/test_ring.py @@ -1,5 +1,4 @@ import pystare -import pytest import numpy diff --git a/tests/test_ring2.py b/tests/test_ring2.py new file mode 100644 index 0000000..01386f6 --- /dev/null +++ b/tests/test_ring2.py @@ -0,0 +1,59 @@ +import pystare +import numpy + + +xs = numpy.array([-83.50488443538553, -83.7, -83.7, + -83.67112067358016, -83.66907393801182, -83.66554227965247, + -83.64263147496257, -83.63320937411328, -83.62664108022165, + -83.61956002347625, -83.61137316124234, -83.59750533380407, + -83.59332273895319, -83.59425462005464, -83.5903484399285, + -83.5810869256211, -83.57322555321667, -83.53436445815316, + -83.51525277469574, -83.50685181985557, -83.48374027209582, + -83.47450991390139, -83.45, -83.45, + -83.47240973162377, -83.50488443538553]) + +ys = numpy.array([10.55, 10.55, 10.278107169257183, + 10.297085463823123, 10.345720887309142, 10.360511759110466, + 10.371931475457302, 10.369180219991222, 10.371458806179021, + 10.378249995241163, 10.376069489115707, 10.364449118731898, + 10.354670297296423, 10.33245057843152, 10.32146336494236, + 10.313312134747264, 10.31232223838066, 10.325070807371901, + 10.320794491472668, 10.322225865031669, 10.314743498413748, + 10.29640319944815, 10.300752042488822, 10.448955087106551, + 10.485058914237527, 10.55]) + +sids_false = numpy.array(['0x2f1b640000000009', '0x2f1b7a800000000a', '0x2f1b66000000000b', + '0x2f1b66200000000b', '0x2f1b66600000000b', '0x2f1b7bc00000000b', + '0x2f1b28800000000c', '0x2f1b2a000000000c', '0x2f1b2a400000000c', + '0x2f1b2b000000000c', '0x2f1b2b080000000c', '0x2f1b2b180000000c', + '0x2f1b2b200000000c', '0x2f1b2ba00000000c', '0x2f1b2f000000000c', + '0x2f1b34000000000c', '0x2f1b38000000000c', '0x2f1b61000000000c', + '0x2f1b62800000000c', '0x2f1b62880000000c', '0x2f1b62980000000c', + '0x2f1b62b00000000c', '0x2f1b62f00000000c', '0x2f1b66480000000c', + '0x2f1b66500000000c', '0x2f1b66580000000c', '0x2f1b66800000000c', + '0x2f1b66880000000c', '0x2f1b66900000000c', '0x2f1b66980000000c', + '0x2f1b66c00000000c', '0x2f1b66c80000000c', '0x2f1b66d00000000c', + '0x2f1b66d80000000c', '0x2f1b66e00000000c', '0x2f1b66e80000000c', + '0x2f1b66f00000000c', '0x2f1b66f80000000c', '0x2f1b67a80000000c', + '0x2f1b67c00000000c', '0x2f1b67c80000000c', '0x2f1b67d00000000c', + '0x2f1b67d80000000c', '0x2f1b67e00000000c', '0x2f1b67e80000000c', + '0x2f1b67f80000000c', '0x2f1b72000000000c', '0x2f1b7a000000000c', + '0x2f1b7a080000000c', '0x2f1b7a100000000c', '0x2f1b7a180000000c', + '0x2f1b7a200000000c', '0x2f1b7a280000000c', '0x2f1b7a300000000c', + '0x2f1b7a380000000c', '0x2f1b7a500000000c', '0x2f1b7a600000000c', + '0x2f1b7a680000000c', '0x2f1b7a700000000c', '0x2f1b7a780000000c', + '0x2f1b7b400000000c', '0x2f1b7b500000000c', '0x2f1b7b580000000c', + '0x2f1b7b800000000c', '0x2f1b7b880000000c', '0x2f1b7b900000000c', + '0x2f1b7b980000000c', '0x2f1b7ba80000000c', '0x2f1b7be00000000c', + '0x2f1b7be80000000c', '0x2f1b7bf00000000c', '0x2f1b7bf80000000c', + '0x2f1b7d000000000c', '0x2f1b7e000000000c', '0x2f1b7e100000000c', + '0x2f1b7e180000000c', '0x2f1b7e400000000c', '0x2f1b7e480000000c', + '0x2f1b7e580000000c', '0x2f1b7e680000000c', '0x2f1b7f200000000c', + '0x2f1b7f380000000c', '0x2f1b7fa00000000c']) +sids_false = pystare.hex2int(sids_false) + + +def test_issue81(): + sids = pystare.cover_from_ring(ys, xs, level=12) + assert not numpy.array_equal(sids, sids_false) + From fee391cbc8bbfa261c00b4d72a40baffef6ec930 Mon Sep 17 00:00:00 2001 From: griessbaum Date: Fri, 21 Jan 2022 09:32:54 -0800 Subject: [PATCH 2/2] moved test_ring from master to here --- tests/{test_ring.py => test_ring1.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename tests/{test_ring.py => test_ring1.py} (99%) diff --git a/tests/test_ring.py b/tests/test_ring1.py similarity index 99% rename from tests/test_ring.py rename to tests/test_ring1.py index 6afe9a0..1128fd2 100644 --- a/tests/test_ring.py +++ b/tests/test_ring1.py @@ -152,12 +152,12 @@ 3392929846358179852]) -def test_ring(): +def test_issue80_ring(): sids = pystare.cover_from_ring(lat=lat, lon=lon, level=12) assert numpy.array_equal(sids, sids_ring_correct) -def test_hull(): +def test_issue80_hull(): sids = pystare.cover_from_hull(lat=lat, lon=lon, level=12) assert numpy.array_equal(sids, sids_hull_correct)