Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test #82

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions tests/test_ring1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import pystare
import numpy


lon = numpy.array(
[-85.05302284, -85.04985684, -85.048693 , -85.04581243,
-85.03830776, -85.02631278, -85.01450956, -85.00872611,
-84.99967414, -84.97818575, -84.96099141, -84.94492526,
-84.93301499, -84.91281083, -84.89230342, -84.87637997,
-84.86385434, -84.83998031, -84.81881745, -84.80287169,
-84.78683681, -84.78713106, -84.78621694, -84.7858112 ,
-84.78353255, -84.78040227, -84.7794882 , -84.77995189,
-84.78271657, -84.79163924, -84.80622044, -84.82970213,
-84.84403364, -84.85562289, -84.87043601, -84.88543644,
-84.89975903, -84.91236046, -84.91586976, -84.92411915,
-84.92997835, -84.94509027, -84.95679537, -84.97966613,
-84.9962763 , -85.02011016, -85.02806078, -85.03598901,
-85.03522654, -85.03063366, -85.0318376 , -85.02786452,
-85.03998442, -85.05302284])
lon = numpy.flip(lon)

lat = numpy.array(
[10.53049262, 10.55936978, 10.58398848, 10.63505855, 10.63615554,
10.63887553, 10.64879706, 10.65794272, 10.63450562, 10.60838865,
10.59715617, 10.58199974, 10.56463154, 10.56456913, 10.56423019,
10.55536106, 10.54880169, 10.52366129, 10.50953484, 10.49977391,
10.49750424, 10.48580355, 10.47353652, 10.47357221, 10.46301754,
10.44553789, 10.43562525, 10.41881895, 10.39774964, 10.3936116 ,
10.38571898, 10.37309086, 10.36760165, 10.36099331, 10.36239345,
10.37098167, 10.37659123, 10.38644135, 10.39384797, 10.39752225,
10.39077118, 10.38136249, 10.37894119, 10.37712186, 10.37816975,
10.37903033, 10.39470858, 10.42088795, 10.43799754, 10.45821507,
10.48127308, 10.50238247, 10.51614325, 10.53049262])
lat = numpy.flip(lat)

sids_ring_correct = numpy.array(
[3391924102456410124, 3391927435351031820, 3391927538430246923,
3391927675869200396, 3391927744588677132, 3391927778948415500,
3391927813308153868, 3391927882027630604, 3391927916387368972,
3391927950747107338, 3391928500502921226, 3391929050258735114,
3391929600014549004, 3391929634374287372, 3391929703093764108,
3391929737453502475, 3391930012331409420, 3391930081050886156,
3391930115410624524, 3391930149770362892, 3391930218489839628,
3391930252849577996, 3391930424648269836, 3391930459008008204,
3391930527727484940, 3391930596446961676, 3391931524159897612,
3391931592879374348, 3391931627239112716, 3391945817811058700,
3391945852170797068, 3391945920890273804, 3392917511212105740,
3392917545571844108, 3392917614291320844, 3392919229199024140,
3392919297918500876, 3392919332278239244, 3392919400997715980,
3392919435357454347, 3392919572796407820, 3392919607156146188,
3392919675875622924, 3392919778954838028, 3392919847674314763,
3392919985113268235, 3392920122552221707, 3392920259991175178,
3392920809746989066, 3392924658037686283, 3392924864196116492,
3392925139074023436, 3392928231450476556, 3392929090443935756,
3392929193523150859, 3392929468401057804, 3392929537120534540,
3392929571480272908, 3392929743278964748])

sids_ring_false = numpy.array(
[3391927950747107338, 3391927538430246923, 3391928775380828171,
3391929050258735115, 3391929325136642059, 3391929462575595531,
3392919435357454347, 3392919985113268235, 3392920259991175179,
3392920397430128651, 3392920672308035595, 3392920947185942539,
3392921084624896011, 3392921222063849483, 3391924102456410124,
3391927435351031820, 3391927675869200396, 3391927744588677132,
3391927778948415500, 3391927813308153868, 3391927882027630604,
3391927916387368972, 3391928500502921228, 3391928534862659596,
3391928569222397964, 3391928603582136332, 3391928637941874700,
3391928672301613068, 3391928706661351436, 3391928741021089804,
3391928912819781644, 3391928947179520012, 3391928981539258380,
3391929015898996748, 3391929187697688588, 3391929222057426956,
3391929256417165324, 3391929290776903692, 3391929600014549004,
3391929634374287372, 3391929703093764108, 3391929737453502476,
3391929771813240844, 3391929806172979212, 3391929840532717580,
3391930012331409420, 3391930081050886156, 3391930115410624524,
3391930149770362892, 3391930218489839628, 3391930252849577996,
3391930424648269836, 3391930459008008204, 3391930527727484940,
3391930596446961676, 3391931524159897612, 3391931592879374348,
3391931627239112716, 3391945817811058700, 3391945852170797068,
3391945920890273804, 3392917511212105740, 3392917545571844108,
3392917614291320844, 3392919229199024140, 3392919297918500876,
3392919332278239244, 3392919400997715980, 3392919572796407820,
3392919607156146188, 3392919675875622924, 3392919778954838028,
3392919847674314764, 3392919882034053132, 3392919916393791500,
3392919950753529868, 3392920122552221708, 3392920156911960076,
3392920191271698444, 3392920225631436812, 3392920534869082124,
3392920569228820492, 3392920603588558860, 3392920637948297228,
3392920809746989068, 3392920844106727436, 3392920878466465804,
3392920912826204172, 3392924658037686284, 3392924692397424652,
3392924726757163020, 3392924761116901388, 3392924864196116492,
3392925139074023436, 3392928231450476556, 3392929090443935756,
3392929193523150860, 3392929227882889228, 3392929262242627596,
3392929296602365964, 3392929468401057804, 3392929537120534540,
3392929571480272908, 3392929743278964748])

sids_hull_correct = numpy.array(
[3391924102456410124, 3391927435351031820, 3391927538430246923,
3391927675869200395, 3391927813308153867, 3391927950747107338,
3391928500502921226, 3391929050258735114, 3391929600014549004,
3391929634374287372, 3391929703093764108, 3391929737453502475,
3391930012331409420, 3391930081050886156, 3391930115410624524,
3391930149770362892, 3391930218489839628, 3391930252849577996,
3391930424648269835, 3391930596446961676, 3391931524159897611,
3391945817811058700, 3391945852170797068, 3391945920890273804,
3392917511212105740, 3392917545571844108, 3392917614291320844,
3392919229199024140, 3392919297918500875, 3392919435357454347,
3392919572796407819, 3392919778954838028, 3392919847674314763,
3392919985113268235, 3392920122552221707, 3392920259991175178,
3392920809746989066, 3392923833403965452, 3392924658037686283,
3392924795476639756, 3392924864196116492, 3392924898555854860,
3392925139074023436, 3392925345232453644, 3392928231450476556,
3392928265810214924, 3392928334529691660, 3392929090443935756,
3392929193523150859, 3392929468401057804, 3392929537120534540,
3392929571480272908, 3392929743278964748, 3392929811998441484,
3392929846358179852])

sids_hull_false = numpy.array(
[3391927950747107338, 3392920259991175178, 3392920809746989066,
3391927538430246923, 3391928775380828171, 3391929050258735115,
3391929325136642059, 3391929462575595531, 3392919435357454347,
3392919985113268235, 3391924102456410124, 3391927435351031820,
3391927675869200396, 3391927710228938764, 3391927744588677132,
3391927778948415500, 3391927813308153868, 3391927847667892236,
3391927882027630604, 3391927916387368972, 3391928500502921228,
3391928534862659596, 3391928569222397964, 3391928603582136332,
3391928637941874700, 3391928672301613068, 3391928706661351436,
3391928741021089804, 3391928912819781644, 3391928947179520012,
3391928981539258380, 3391929015898996748, 3391929187697688588,
3391929222057426956, 3391929256417165324, 3391929290776903692,
3391929600014549004, 3391929634374287372, 3391929703093764108,
3391929737453502476, 3391929771813240844, 3391929806172979212,
3391929840532717580, 3391930012331409420, 3391930081050886156,
3391930115410624524, 3391930149770362892, 3391930218489839628,
3391930252849577996, 3391930424648269836, 3391930459008008204,
3391930493367746572, 3391930527727484940, 3391930596446961676,
3391931524159897612, 3391931558519635980, 3391931592879374348,
3391931627239112716, 3391945817811058700, 3391945852170797068,
3391945920890273804, 3392917511212105740, 3392917545571844108,
3392917614291320844, 3392919229199024140, 3392919297918500876,
3392919332278239244, 3392919366637977612, 3392919400997715980,
3392919572796407820, 3392919607156146188, 3392919641515884556,
3392919675875622924, 3392919778954838028, 3392919847674314764,
3392919882034053132, 3392919916393791500, 3392919950753529868,
3392920122552221708, 3392920156911960076, 3392920191271698444,
3392920225631436812, 3392923833403965452, 3392924658037686284,
3392924692397424652, 3392924726757163020, 3392924761116901388,
3392924795476639756, 3392924864196116492, 3392924898555854860,
3392925139074023436, 3392925345232453644, 3392928231450476556,
3392928265810214924, 3392928334529691660, 3392929090443935756,
3392929193523150860, 3392929227882889228, 3392929262242627596,
3392929296602365964, 3392929468401057804, 3392929537120534540,
3392929571480272908, 3392929743278964748, 3392929811998441484,
3392929846358179852])


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_issue80_hull():
sids = pystare.cover_from_hull(lat=lat, lon=lon, level=12)
assert numpy.array_equal(sids, sids_hull_correct)

59 changes: 59 additions & 0 deletions tests/test_ring2.py
Original file line number Diff line number Diff line change
@@ -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)