NeoBase 0.34.3__tar.gz → 0.34.5__tar.gz
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.
- {neobase-0.34.3 → neobase-0.34.5}/NeoBase.egg-info/PKG-INFO +37 -1
- {neobase-0.34.3 → neobase-0.34.5}/PKG-INFO +37 -1
- {neobase-0.34.3 → neobase-0.34.5}/README.rst +36 -0
- neobase-0.34.5/neobase/_version.py +1 -0
- {neobase-0.34.3 → neobase-0.34.5}/neobase/optd_por_public.csv +302 -291
- neobase-0.34.3/neobase/_version.py +0 -1
- {neobase-0.34.3 → neobase-0.34.5}/.github/workflows/python-package.yml +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/.gitignore +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/LICENSE +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/MANIFEST.in +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/NeoBase.egg-info/SOURCES.txt +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/NeoBase.egg-info/dependency_links.txt +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/NeoBase.egg-info/entry_points.txt +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/NeoBase.egg-info/not-zip-safe +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/NeoBase.egg-info/top_level.txt +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/_config.yml +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/conftest.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/doc/Makefile +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/doc/conf.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/doc/index.rst +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/doc/make.bat +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/neobase/__init__.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/neobase/__main__.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/neobase/neobase.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/pyproject.toml +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/setup.cfg +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/setup.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/test_neobase.py +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/tox.ini +0 -0
- {neobase-0.34.3 → neobase-0.34.5}/update_data.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: NeoBase
|
|
3
|
-
Version: 0.34.
|
|
3
|
+
Version: 0.34.5
|
|
4
4
|
Summary: Python library to manipulate Open Travel Data
|
|
5
5
|
Home-page: https://github.com/alexprengere/neobase
|
|
6
6
|
Author: Alex Prengère
|
|
@@ -146,3 +146,39 @@ Tests
|
|
|
146
146
|
.. code:: bash
|
|
147
147
|
|
|
148
148
|
tox
|
|
149
|
+
|
|
150
|
+
A note about performance
|
|
151
|
+
------------------------
|
|
152
|
+
|
|
153
|
+
The geographical operations like ``N.find_near("ORY", 100)`` or ``N.find_closest_from("ORY")`` perform a full scan of the data, and are not optimized (remember that this library has no dependencies by design).
|
|
154
|
+
|
|
155
|
+
If you want a more efficient solution, you should use a spatial index like a *BallTree*, for example using `scikit-learn <https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.BallTree.html>`__:
|
|
156
|
+
|
|
157
|
+
.. code:: python
|
|
158
|
+
|
|
159
|
+
import numpy as np
|
|
160
|
+
from sklearn.neighbors import BallTree
|
|
161
|
+
from neobase import NeoBase
|
|
162
|
+
|
|
163
|
+
N = NeoBase()
|
|
164
|
+
|
|
165
|
+
iata_codes = []
|
|
166
|
+
coords = []
|
|
167
|
+
for key in N:
|
|
168
|
+
lat, lon = N.get_location(key)
|
|
169
|
+
if lat is not None and lon is not None:
|
|
170
|
+
iata_codes.append(N.get(key, "iata_code"))
|
|
171
|
+
coords.append([np.radians(lat), np.radians(lon)])
|
|
172
|
+
coords = np.array(coords)
|
|
173
|
+
|
|
174
|
+
tree = BallTree(coords, metric="haversine")
|
|
175
|
+
|
|
176
|
+
def find_closest_with_balltree(coord):
|
|
177
|
+
point = np.radians(coord)
|
|
178
|
+
_, idx = tree.query([point], k=1)
|
|
179
|
+
iata_code = iata_codes[idx[0][0]]
|
|
180
|
+
return iata_code
|
|
181
|
+
|
|
182
|
+
paris = (48.8566, 2.3522)
|
|
183
|
+
print(find_closest_with_balltree(paris)) # <0.1ms
|
|
184
|
+
print(list(N.find_closest_from_location(paris))) # ~30ms
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: NeoBase
|
|
3
|
-
Version: 0.34.
|
|
3
|
+
Version: 0.34.5
|
|
4
4
|
Summary: Python library to manipulate Open Travel Data
|
|
5
5
|
Home-page: https://github.com/alexprengere/neobase
|
|
6
6
|
Author: Alex Prengère
|
|
@@ -146,3 +146,39 @@ Tests
|
|
|
146
146
|
.. code:: bash
|
|
147
147
|
|
|
148
148
|
tox
|
|
149
|
+
|
|
150
|
+
A note about performance
|
|
151
|
+
------------------------
|
|
152
|
+
|
|
153
|
+
The geographical operations like ``N.find_near("ORY", 100)`` or ``N.find_closest_from("ORY")`` perform a full scan of the data, and are not optimized (remember that this library has no dependencies by design).
|
|
154
|
+
|
|
155
|
+
If you want a more efficient solution, you should use a spatial index like a *BallTree*, for example using `scikit-learn <https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.BallTree.html>`__:
|
|
156
|
+
|
|
157
|
+
.. code:: python
|
|
158
|
+
|
|
159
|
+
import numpy as np
|
|
160
|
+
from sklearn.neighbors import BallTree
|
|
161
|
+
from neobase import NeoBase
|
|
162
|
+
|
|
163
|
+
N = NeoBase()
|
|
164
|
+
|
|
165
|
+
iata_codes = []
|
|
166
|
+
coords = []
|
|
167
|
+
for key in N:
|
|
168
|
+
lat, lon = N.get_location(key)
|
|
169
|
+
if lat is not None and lon is not None:
|
|
170
|
+
iata_codes.append(N.get(key, "iata_code"))
|
|
171
|
+
coords.append([np.radians(lat), np.radians(lon)])
|
|
172
|
+
coords = np.array(coords)
|
|
173
|
+
|
|
174
|
+
tree = BallTree(coords, metric="haversine")
|
|
175
|
+
|
|
176
|
+
def find_closest_with_balltree(coord):
|
|
177
|
+
point = np.radians(coord)
|
|
178
|
+
_, idx = tree.query([point], k=1)
|
|
179
|
+
iata_code = iata_codes[idx[0][0]]
|
|
180
|
+
return iata_code
|
|
181
|
+
|
|
182
|
+
paris = (48.8566, 2.3522)
|
|
183
|
+
print(find_closest_with_balltree(paris)) # <0.1ms
|
|
184
|
+
print(list(N.find_closest_from_location(paris))) # ~30ms
|
|
@@ -130,3 +130,39 @@ Tests
|
|
|
130
130
|
.. code:: bash
|
|
131
131
|
|
|
132
132
|
tox
|
|
133
|
+
|
|
134
|
+
A note about performance
|
|
135
|
+
------------------------
|
|
136
|
+
|
|
137
|
+
The geographical operations like ``N.find_near("ORY", 100)`` or ``N.find_closest_from("ORY")`` perform a full scan of the data, and are not optimized (remember that this library has no dependencies by design).
|
|
138
|
+
|
|
139
|
+
If you want a more efficient solution, you should use a spatial index like a *BallTree*, for example using `scikit-learn <https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.BallTree.html>`__:
|
|
140
|
+
|
|
141
|
+
.. code:: python
|
|
142
|
+
|
|
143
|
+
import numpy as np
|
|
144
|
+
from sklearn.neighbors import BallTree
|
|
145
|
+
from neobase import NeoBase
|
|
146
|
+
|
|
147
|
+
N = NeoBase()
|
|
148
|
+
|
|
149
|
+
iata_codes = []
|
|
150
|
+
coords = []
|
|
151
|
+
for key in N:
|
|
152
|
+
lat, lon = N.get_location(key)
|
|
153
|
+
if lat is not None and lon is not None:
|
|
154
|
+
iata_codes.append(N.get(key, "iata_code"))
|
|
155
|
+
coords.append([np.radians(lat), np.radians(lon)])
|
|
156
|
+
coords = np.array(coords)
|
|
157
|
+
|
|
158
|
+
tree = BallTree(coords, metric="haversine")
|
|
159
|
+
|
|
160
|
+
def find_closest_with_balltree(coord):
|
|
161
|
+
point = np.radians(coord)
|
|
162
|
+
_, idx = tree.query([point], k=1)
|
|
163
|
+
iata_code = iata_codes[idx[0][0]]
|
|
164
|
+
return iata_code
|
|
165
|
+
|
|
166
|
+
paris = (48.8566, 2.3522)
|
|
167
|
+
print(find_closest_with_balltree(paris)) # <0.1ms
|
|
168
|
+
print(list(N.find_closest_from_location(paris))) # ~30ms
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.34.5"
|