healpix-geo 0.0.5__cp310-cp310-win_amd64.whl → 0.0.6__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of healpix-geo might be problematic. Click here for more details.
- healpix_geo/__init__.py +2 -2
- healpix_geo/healpix_geo.cp310-win_amd64.pyd +0 -0
- healpix_geo/slices.py +4 -0
- healpix_geo/tests/test_index.py +89 -0
- healpix_geo/tests/test_slices.py +116 -0
- {healpix_geo-0.0.5.dist-info → healpix_geo-0.0.6.dist-info}/METADATA +2 -8
- healpix_geo-0.0.6.dist-info/RECORD +16 -0
- {healpix_geo-0.0.5.dist-info → healpix_geo-0.0.6.dist-info}/WHEEL +1 -1
- healpix_geo-0.0.5.dist-info/RECORD +0 -14
- {healpix_geo-0.0.5.dist-info → healpix_geo-0.0.6.dist-info}/licenses/LICENSE +0 -0
healpix_geo/__init__.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
from healpix_geo import nested, ring
|
|
1
|
+
from healpix_geo import nested, ring, slices
|
|
2
2
|
|
|
3
|
-
__all__ = ["nested", "ring"]
|
|
3
|
+
__all__ = ["nested", "ring", "slices"]
|
|
Binary file
|
healpix_geo/slices.py
ADDED
healpix_geo/tests/test_index.py
CHANGED
|
@@ -121,6 +121,95 @@ class TestRangeMOCIndex:
|
|
|
121
121
|
|
|
122
122
|
np.testing.assert_equal(actual.cell_ids(), expected)
|
|
123
123
|
|
|
124
|
+
@pytest.mark.parametrize(
|
|
125
|
+
["level", "cell_ids", "indexer"],
|
|
126
|
+
(
|
|
127
|
+
pytest.param(
|
|
128
|
+
0,
|
|
129
|
+
np.arange(12, dtype="uint64"),
|
|
130
|
+
slice(None),
|
|
131
|
+
id="base cells-slice-full",
|
|
132
|
+
),
|
|
133
|
+
pytest.param(
|
|
134
|
+
0,
|
|
135
|
+
np.arange(12, dtype="uint64"),
|
|
136
|
+
slice(None, 6),
|
|
137
|
+
id="base cells-slice-left_open",
|
|
138
|
+
),
|
|
139
|
+
pytest.param(
|
|
140
|
+
0,
|
|
141
|
+
np.arange(12, dtype="uint64"),
|
|
142
|
+
slice(2, None),
|
|
143
|
+
id="base cells-slice-right_open",
|
|
144
|
+
),
|
|
145
|
+
pytest.param(
|
|
146
|
+
0,
|
|
147
|
+
np.arange(12, dtype="uint64"),
|
|
148
|
+
slice(2, 7),
|
|
149
|
+
id="base cells-slice-domain",
|
|
150
|
+
),
|
|
151
|
+
pytest.param(
|
|
152
|
+
0,
|
|
153
|
+
np.arange(12, dtype="uint64"),
|
|
154
|
+
np.arange(12, dtype="uint64"),
|
|
155
|
+
id="base cells-array-full",
|
|
156
|
+
),
|
|
157
|
+
pytest.param(
|
|
158
|
+
0,
|
|
159
|
+
np.arange(12, dtype="uint64"),
|
|
160
|
+
np.arange(2, 7, dtype="uint64"),
|
|
161
|
+
id="base cells-array-domain",
|
|
162
|
+
),
|
|
163
|
+
pytest.param(
|
|
164
|
+
0,
|
|
165
|
+
np.arange(12, dtype="uint64"),
|
|
166
|
+
np.array([1, 2, 3, 7, 8, 9, 10], dtype="uint64"),
|
|
167
|
+
id="base cells-array-disconnected",
|
|
168
|
+
),
|
|
169
|
+
pytest.param(
|
|
170
|
+
3,
|
|
171
|
+
np.arange(12 * 4**3, dtype="uint64"),
|
|
172
|
+
slice(None, 15),
|
|
173
|
+
id="level 3 cells-slice-left_open",
|
|
174
|
+
),
|
|
175
|
+
pytest.param(
|
|
176
|
+
1,
|
|
177
|
+
np.array([0, 1, 2, 4, 5, 11, 12, 13, 25, 26, 27], dtype="uint64"),
|
|
178
|
+
np.array([2, 5, 11, 12, 25, 27], dtype="uint64"),
|
|
179
|
+
id="list of level 1 cells-array-disconnected",
|
|
180
|
+
),
|
|
181
|
+
pytest.param(
|
|
182
|
+
4,
|
|
183
|
+
np.arange(1 * 4**4, 2 * 4**4, dtype="uint64"),
|
|
184
|
+
slice(260, 280),
|
|
185
|
+
id="single level 4 base cell-slice-domain",
|
|
186
|
+
),
|
|
187
|
+
),
|
|
188
|
+
)
|
|
189
|
+
def test_sel(self, level, cell_ids, indexer):
|
|
190
|
+
if isinstance(indexer, slice):
|
|
191
|
+
n = slice(
|
|
192
|
+
indexer.start if indexer.start is not None else 0,
|
|
193
|
+
(
|
|
194
|
+
indexer.stop + 1
|
|
195
|
+
if indexer.stop is not None
|
|
196
|
+
else int(np.max(cell_ids)) + 1
|
|
197
|
+
),
|
|
198
|
+
indexer.step if indexer.step is not None else 1,
|
|
199
|
+
)
|
|
200
|
+
range_ = np.arange(n.start, n.stop, n.step, dtype="uint64")
|
|
201
|
+
condition = np.isin(cell_ids, range_)
|
|
202
|
+
else:
|
|
203
|
+
condition = np.isin(cell_ids, indexer)
|
|
204
|
+
expected_cell_ids = cell_ids[condition]
|
|
205
|
+
|
|
206
|
+
index = healpix_geo.nested.RangeMOCIndex.from_cell_ids(level, cell_ids)
|
|
207
|
+
|
|
208
|
+
actual_indexer, actual_moc = index.sel(indexer)
|
|
209
|
+
|
|
210
|
+
np.testing.assert_equal(cell_ids[actual_indexer], expected_cell_ids)
|
|
211
|
+
np.testing.assert_equal(actual_moc.cell_ids(), expected_cell_ids)
|
|
212
|
+
|
|
124
213
|
@pytest.mark.parametrize(
|
|
125
214
|
["depth", "cell_ids"],
|
|
126
215
|
(
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from healpix_geo import slices
|
|
4
|
+
|
|
5
|
+
missing = object()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestSlice:
|
|
9
|
+
@pytest.mark.parametrize("start", [0, None, 10])
|
|
10
|
+
@pytest.mark.parametrize("stop", [3, None, 10])
|
|
11
|
+
@pytest.mark.parametrize("step", [1, None, 2, missing])
|
|
12
|
+
def test_init(self, start, stop, step):
|
|
13
|
+
if step is missing:
|
|
14
|
+
vals = (start, stop)
|
|
15
|
+
step = None
|
|
16
|
+
else:
|
|
17
|
+
vals = (start, stop, step)
|
|
18
|
+
|
|
19
|
+
actual = slices.Slice(*vals)
|
|
20
|
+
|
|
21
|
+
assert actual.start == start
|
|
22
|
+
assert actual.stop == stop
|
|
23
|
+
assert actual.step == step
|
|
24
|
+
|
|
25
|
+
@pytest.mark.parametrize("start", [0, None, 10])
|
|
26
|
+
@pytest.mark.parametrize("stop", [3, None, 10])
|
|
27
|
+
@pytest.mark.parametrize("step", [1, None, 2, -1])
|
|
28
|
+
def test_repr(self, start, stop, step):
|
|
29
|
+
slice_ = slices.Slice(start, stop, step)
|
|
30
|
+
actual = repr(slice_)
|
|
31
|
+
|
|
32
|
+
expected = repr(slice(start, stop, step)).title()
|
|
33
|
+
|
|
34
|
+
assert actual == expected
|
|
35
|
+
|
|
36
|
+
@pytest.mark.parametrize(
|
|
37
|
+
"pyslice",
|
|
38
|
+
(
|
|
39
|
+
slice(None),
|
|
40
|
+
slice(None, 2),
|
|
41
|
+
slice(3, None),
|
|
42
|
+
slice(None, None, -1),
|
|
43
|
+
slice(10, None, -1),
|
|
44
|
+
slice(3, -2),
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
def test_from_pyslice(self, pyslice):
|
|
48
|
+
actual = slices.Slice.from_pyslice(pyslice)
|
|
49
|
+
|
|
50
|
+
assert actual.start == pyslice.start
|
|
51
|
+
assert actual.start == pyslice.start
|
|
52
|
+
assert actual.start == pyslice.start
|
|
53
|
+
|
|
54
|
+
@pytest.mark.parametrize(
|
|
55
|
+
"pyslice",
|
|
56
|
+
(
|
|
57
|
+
slice(None),
|
|
58
|
+
slice(None, 2),
|
|
59
|
+
slice(3, None),
|
|
60
|
+
slice(None, None, -1),
|
|
61
|
+
slice(10, None, -1),
|
|
62
|
+
slice(3, -2),
|
|
63
|
+
),
|
|
64
|
+
)
|
|
65
|
+
@pytest.mark.parametrize("size", (3, 8, 13))
|
|
66
|
+
def test_roundtrip_pyslice(self, pyslice, size):
|
|
67
|
+
slice_ = slices.Slice.from_pyslice(pyslice)
|
|
68
|
+
|
|
69
|
+
actual = slice_.as_pyslice()
|
|
70
|
+
assert actual == pyslice
|
|
71
|
+
|
|
72
|
+
@pytest.mark.parametrize(
|
|
73
|
+
"pyslice",
|
|
74
|
+
(
|
|
75
|
+
slice(None),
|
|
76
|
+
slice(None, 2),
|
|
77
|
+
slice(3, None),
|
|
78
|
+
slice(None, None, -1),
|
|
79
|
+
slice(10, None, -1),
|
|
80
|
+
slice(3, -2),
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
@pytest.mark.parametrize("size", (3, 8, 13))
|
|
84
|
+
def test_as_concrete(self, pyslice, size):
|
|
85
|
+
slice_ = slices.Slice(pyslice.start, pyslice.stop, pyslice.step)
|
|
86
|
+
|
|
87
|
+
actual = slice_.as_concrete(size)
|
|
88
|
+
expected = slice(*pyslice.indices(size))
|
|
89
|
+
|
|
90
|
+
assert actual.start == expected.start
|
|
91
|
+
assert actual.stop == expected.stop
|
|
92
|
+
assert actual.step == expected.step
|
|
93
|
+
|
|
94
|
+
def test_in_dict(self):
|
|
95
|
+
slice1 = slices.Slice(0, 4)
|
|
96
|
+
slice2 = slices.Slice(4, 6)
|
|
97
|
+
|
|
98
|
+
d = {slice1: 1, slice2: 2}
|
|
99
|
+
|
|
100
|
+
assert d[slice1] == 1
|
|
101
|
+
assert d[slice2] == 2
|
|
102
|
+
|
|
103
|
+
@pytest.mark.parametrize(
|
|
104
|
+
["vals", "expected"],
|
|
105
|
+
(
|
|
106
|
+
((0, 4), True),
|
|
107
|
+
((1, 4), False),
|
|
108
|
+
((0, 4, 1), False),
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
def test_compare(self, vals, expected):
|
|
112
|
+
slice_ = slices.Slice(0, 4)
|
|
113
|
+
other = slices.Slice(*vals)
|
|
114
|
+
|
|
115
|
+
actual = slice_ == other
|
|
116
|
+
assert actual == expected
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: healpix-geo
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -17,11 +17,5 @@ Requires-Dist: tabulate ; extra == 'docs'
|
|
|
17
17
|
Provides-Extra: tests
|
|
18
18
|
Provides-Extra: docs
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
License: Apache-2.0
|
|
20
|
+
License-Expression: Apache-2.0
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
23
|
-
|
|
24
|
-
# `healpix-geo`
|
|
25
|
-
|
|
26
|
-
This package integrates with `cds-healpix-rust` and `cds-healpix-python` to support specialized algorithms for the geosciences.
|
|
27
|
-
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
healpix_geo-0.0.6.dist-info/METADATA,sha256=oF5iTjtlZpD2GwZkueXnW3xfhZ1TBhmZoPiudqEgCoQ,783
|
|
2
|
+
healpix_geo-0.0.6.dist-info/WHEEL,sha256=gTksDcUm4vEEt-WSZ1CnYcSbBNyUtm2mp9lzlf3Yd0w,96
|
|
3
|
+
healpix_geo-0.0.6.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
4
|
+
healpix_geo/__init__.py,sha256=KemntjpEc5RlTjkX4SWMBT8f0afpSSowuBGHAIwFOHE,88
|
|
5
|
+
healpix_geo/healpix_geo.cp310-win_amd64.pyd,sha256=xKzIFGC66RH-vEwv4hdVuRwgn1GbLBBpbhfZOXSdSUI,1240576
|
|
6
|
+
healpix_geo/nested.py,sha256=mQ75zRvY8gI20nkS9ayruY6VgoKoRyHzuoLuCu_rafw,12983
|
|
7
|
+
healpix_geo/ring.py,sha256=G6zGJDxfAfWH3pOJacCoV23TewnhfImkO1HWi6X3CdM,10601
|
|
8
|
+
healpix_geo/slices.py,sha256=SdErlNhiGF1B_SCJEcwd0pBIt3yegyUk1aoDK8UVT_M,147
|
|
9
|
+
healpix_geo/tests/test_distances.py,sha256=_oxekYaotPdb2M2NqI4pVyFOWiCXqBNqJnDmLf-j3jM,2583
|
|
10
|
+
healpix_geo/tests/test_index.py,sha256=TsW1-tiSVZjUAISyTc42-rpIrCwDIzFz6a9RYaV0hck,8061
|
|
11
|
+
healpix_geo/tests/test_inference.py,sha256=wmpi-5BtLuk8MGtlU4b88Mwo5Q2WbMPLVPyf1mwCxcY,7367
|
|
12
|
+
healpix_geo/tests/test_neighbours.py,sha256=nfBIIwssCZWeSQgI2loJMHYLLm_iAKiQ9X_eXyuzgg4,1227
|
|
13
|
+
healpix_geo/tests/test_slices.py,sha256=F6j0bHR-iMly4WMqNVy9D9MosaZw67lBX_mK0hCOkpo,3238
|
|
14
|
+
healpix_geo/tests/test_zoom.py,sha256=fNiNEwwB5KlcxWGFZEfu76f_nZlyb5esVjw5JO10qY4,2339
|
|
15
|
+
healpix_geo/utils.py,sha256=1N4VkjkhJm5SN1vCyDCLuBC8L6gOGszCEy1cUmdVjoc,746
|
|
16
|
+
healpix_geo-0.0.6.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
healpix_geo-0.0.5.dist-info/METADATA,sha256=QoTnNnL05PQ7dWy7y24dSOPssmBrC1AyWFKbaAzFMQ0,990
|
|
2
|
-
healpix_geo-0.0.5.dist-info/WHEEL,sha256=oIYcReGXK7h7Rxp85Q3K9Z3I1xK99xgU5My5R5-0sSU,96
|
|
3
|
-
healpix_geo-0.0.5.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
4
|
-
healpix_geo/__init__.py,sha256=JJc1U_jRprkKj-0zzlfHex7rHAAILAF0bkeQ--D15WU,70
|
|
5
|
-
healpix_geo/healpix_geo.cp310-win_amd64.pyd,sha256=HEYoLGXDN8p3jH5h1mL1-Wc9B4YEqzYytxsIWBaKJ0I,1127936
|
|
6
|
-
healpix_geo/nested.py,sha256=mQ75zRvY8gI20nkS9ayruY6VgoKoRyHzuoLuCu_rafw,12983
|
|
7
|
-
healpix_geo/ring.py,sha256=G6zGJDxfAfWH3pOJacCoV23TewnhfImkO1HWi6X3CdM,10601
|
|
8
|
-
healpix_geo/tests/test_distances.py,sha256=_oxekYaotPdb2M2NqI4pVyFOWiCXqBNqJnDmLf-j3jM,2583
|
|
9
|
-
healpix_geo/tests/test_index.py,sha256=Xwa6gWHYHD-vnqxOOf2fmLic1nyKZ1TSry4JQLwwYH8,4865
|
|
10
|
-
healpix_geo/tests/test_inference.py,sha256=wmpi-5BtLuk8MGtlU4b88Mwo5Q2WbMPLVPyf1mwCxcY,7367
|
|
11
|
-
healpix_geo/tests/test_neighbours.py,sha256=nfBIIwssCZWeSQgI2loJMHYLLm_iAKiQ9X_eXyuzgg4,1227
|
|
12
|
-
healpix_geo/tests/test_zoom.py,sha256=fNiNEwwB5KlcxWGFZEfu76f_nZlyb5esVjw5JO10qY4,2339
|
|
13
|
-
healpix_geo/utils.py,sha256=1N4VkjkhJm5SN1vCyDCLuBC8L6gOGszCEy1cUmdVjoc,746
|
|
14
|
-
healpix_geo-0.0.5.dist-info/RECORD,,
|
|
File without changes
|