Commit 30a0a3c6 authored by Joseph Siddons's avatar Joseph Siddons
Browse files

chore: fix spell following codespell output

parent 5cb3030c
......@@ -20,7 +20,7 @@ class KDTree:
This implementation is a _balanced_ KDTree, each leaf node should have the
same number of points (or differ by 1 depending on the number of points
the KDTree is intialised with).
the KDTree is initialised with).
The KDTree partitions in each of the lon and lat dimensions alternatively
in sequence by splitting at the median of the dimension of the points
......@@ -34,7 +34,7 @@ class KDTree:
The current depth of the KDTree, you should set this to 0, it is used
internally.
max_depth : int
The maximium depth of the KDTree. The leaf nodes will have depth no
The maximum depth of the KDTree. The leaf nodes will have depth no
larger than this value. Leaf nodes will not be created if there is
only 1 point in the branch.
"""
......
"""
OctTree
-------
Constuctors for OctTree classes that can decrease the number of comparisons
Constructors for OctTree classes that can decrease the number of comparisons
for detecting nearby records for example. This is an implementation that uses
Haversine distances for comparisons between records for identification of
neighbours.
......@@ -25,7 +25,7 @@ class SpaceTimeRecord:
The temporal component was designed to use `datetime` values, however all
methods will work with numeric datetime information - for example a pentad,
timestamp, julian day, etc. Note that any uses within an OctTree and
time-stamp, julian day, etc. Note that any uses within an OctTree and
SpaceTimeRectangle must also have timedelta values replaced with numeric
ranges in this case.
......
"""
QuadTree
--------
Constuctors for QuadTree classes that can decrease the number of comparisons
Constructors for QuadTree classes that can decrease the number of comparisons
for detecting nearby records for example. This is an implementation that uses
Haversine distances for comparisons between records for identification of
neighbours.
......
......@@ -8,6 +8,6 @@ class LatitudeError(ValueError):
class DateWarning(Warning):
"""Warnning for Datetime Value"""
"""Warning for Datetime Value"""
pass
......@@ -81,11 +81,11 @@ N_samples = 1000
records: list[Record] = [Record(choice(lon_range), choice(lat_range)) for _ in range(N_samples)]
# Construct Tree
kt = KDTree(records)
kdtree = KDTree(records)
test_value: Record = Record(lon=47.6, lat=-31.1)
neighbours: list[Record] = []
neighbours, dist = kt.query(test_value)
neighbours, dist = kdtree.query(test_value)
```
### Points within distance (2d \& 3d)
......@@ -126,16 +126,16 @@ N_samples = 1000
# Construct Tree
boundary = Rectangle(-180, 180, -90, 90) # Full domain
qt = QuadTree(boundary)
quadtree = QuadTree(boundary)
records: list[Record] = [Record(choice(lon_range), choice(lat_range)) for _ in range(N_samples)]
for record in records:
qt.insert(record)
quadtree.insert(record)
test_value: Record = Record(lon=47.6, lat=-31.1)
dist: float = 340 # km
neighbours: list[Record] = qt.nearby_points(test_value, dist)
neighbours: list[Record] = quadtree.nearby_points(test_value, dist)
```
#### OctTree - 3d QuadTree
......@@ -190,16 +190,16 @@ N_samples = 1000
# Construct Tree
boundary = SpaceTimeRectangle(-180, 180, -90, 90, datetime(2009, 1, 1, 0), datetime(2009, 1, 2, 23)) # Full domain
ot = OctTree(boundary)
octtree = OctTree(boundary)
records: list[SpaceTimeRecord] = [
SpaceTimeRecord(choice(lon_range), choice(lat_range), choice(dates)) for _ in range(N_samples)]
for record in records:
ot.insert(record)
octtree.insert(record)
test_value: SpaceTimeRecord = SpaceTimeRecord(lon=47.6, lat=-31.1, datetime=datetime(2009, 1, 23, 17, 41))
dist: float = 340 # km
t_dist = timedelta(hours=4)
neighbours: list[Record] = ot.nearby_points(test_value, dist, t_dist)
neighbours: list[Record] = octtree.nearby_points(test_value, dist, t_dist)
```
No preview for this file type
......@@ -64,7 +64,7 @@
\title{GeoSpatialTools}
\date{Feb 27, 2025}
\date{Mar 05, 2025}
\release{0.11.2}
\author{NOC Surface Processes}
\newcommand{\sphinxlogo}{\vbox{}}
......@@ -248,7 +248,7 @@ to True (default), displays a warning if set to False.
\section{QuadTree}
\label{\detokenize{users_guide:quadtree}}\label{\detokenize{users_guide:module-GeoSpatialTools.quadtree}}
\sphinxAtStartPar
Constuctors for QuadTree classes that can decrease the number of comparisons
Constructors for QuadTree classes that can decrease the number of comparisons
for detecting nearby records for example. This is an implementation that uses
Haversine distances for comparisons between records for identification of
neighbours.
......@@ -759,7 +759,7 @@ Check if point is nearby the Rectangle
\section{OctTree}
\label{\detokenize{users_guide:octtree}}\label{\detokenize{users_guide:module-GeoSpatialTools.octtree}}
\sphinxAtStartPar
Constuctors for OctTree classes that can decrease the number of comparisons
Constructors for OctTree classes that can decrease the number of comparisons
for detecting nearby records for example. This is an implementation that uses
Haversine distances for comparisons between records for identification of
neighbours.
......@@ -1131,7 +1131,7 @@ temporal data. It can optionally include a UID and extra data.
\sphinxAtStartPar
The temporal component was designed to use \sphinxtitleref{datetime} values, however all
methods will work with numeric datetime information \sphinxhyphen{} for example a pentad,
timestamp, julian day, etc. Note that any uses within an OctTree and
time\sphinxhyphen{}stamp, julian day, etc. Note that any uses within an OctTree and
SpaceTimeRectangle must also have timedelta values replaced with numeric
ranges in this case.
......@@ -1484,7 +1484,7 @@ A Haverine distance implementation of a balanced KDTree.
\sphinxAtStartPar
This implementation is a \_balanced\_ KDTree, each leaf node should have the
same number of points (or differ by 1 depending on the number of points
the KDTree is intialised with).
the KDTree is initialised with).
\sphinxAtStartPar
The KDTree partitions in each of the lon and lat dimensions alternatively
......@@ -1503,7 +1503,7 @@ internally.
\item {}
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{max\_depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The maximium depth of the KDTree. The leaf nodes will have depth no
\sphinxstyleliteralstrong{\sphinxupquote{max\_depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The maximum depth of the KDTree. The leaf nodes will have depth no
larger than this value. Leaf nodes will not be created if there is
only 1 point in the branch.
......
......@@ -63,7 +63,7 @@
"outputs": [],
"source": [
"def generate_uid(n: int) -> str:\n",
" \"\"\"Generates a psuedo uid by randomly selecting from characters\"\"\"\n",
" \"\"\"Generates a pseudo uid by randomly selecting from characters\"\"\"\n",
" chars = ascii_letters + digits\n",
" return \"\".join(random.choice(chars) for _ in range(n))"
]
......@@ -73,6 +73,9 @@
"execution_count": 4,
"id": "9e647ecd-abdc-46a0-8261-aa081fda2e1d",
"metadata": {
"jupyter": {
"source_hidden": true
},
"scrolled": true
},
"outputs": [],
......@@ -90,7 +93,7 @@
" df : polars Frame\n",
" Dataframe to check\n",
" cols : list[str]\n",
" Requried columns\n",
" Required columns\n",
" var_name : str\n",
" Name of the Frame - used for displaying in any error.\n",
" \"\"\"\n",
......@@ -253,17 +256,17 @@
"text": [
"(16000, 2)\n",
"shape: (5, 2)\n",
"┌─────┬─────┐\n",
"│ lon ┆ lat │\n",
"│ --- ┆ --- │\n",
"│ i64 ┆ i64 │\n",
"╞═════╪═════╡\n",
"│ 62 ┆ -29 │\n",
"│ 146 ┆ 1 │\n",
"│ 104 ┆ 60 │\n",
"│ -162 ┆ -66 │\n",
"│ 72 ┆ 69 │\n",
"└─────┴─────┘\n"
"┌─────┬─────┐\n",
"│ lon ┆ lat │\n",
"│ --- ┆ --- │\n",
"│ i64 ┆ i64 │\n",
"╞═════╪═════╡\n",
"│ -26 ┆ -42 │\n",
"│ 109 ┆ -33 │\n",
"│ -87 ┆ -18 │\n",
"│ -94 ┆ -81 │\n",
"│ -94 ┆ 0 │\n",
"└─────┴─────┘\n"
]
}
],
......@@ -303,7 +306,7 @@
"id": "bd83330b-ef2c-478e-9a7b-820454d198bb",
"metadata": {},
"source": [
"## Intialise the `KDTree`\n",
"## Initialise the `KDTree`\n",
"\n",
"There is an overhead to constructing a `KDTree` object, so performance improvement is only for multiple comparisons."
]
......@@ -318,8 +321,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 32.7 ms, sys: 1.4 ms, total: 34.1 ms\n",
"Wall time: 33.4 ms\n"
"CPU times: user 35 ms, sys: 1.5 ms, total: 36.5 ms\n",
"Wall time: 32.1 ms\n"
]
}
],
......@@ -359,7 +362,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"130 μs ± 847 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
"101 μs ± 3.52 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
]
}
],
......@@ -378,7 +381,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"8.34 ms ± 83.4 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
"8.17 ms ± 38.6 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
]
}
],
......@@ -397,7 +400,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"8.28 ms ± 105 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
"8.22 ms ± 95.3 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
]
}
],
......@@ -424,8 +427,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 16.9 s, sys: 144 ms, total: 17 s\n",
"Wall time: 17 s\n"
"CPU times: user 16.3 s, sys: 74.7 ms, total: 16.4 s\n",
"Wall time: 16.4 s\n"
]
}
],
......
......@@ -44,14 +44,18 @@
"source": [
"## Set-up functions\n",
"\n",
"For comparisons using brute-force appraoch"
"For comparisons using brute-force approach"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "972d4a16-39fd-4f80-8592-1c5d5cabf5be",
"metadata": {},
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"def check_cols(\n",
......@@ -67,7 +71,7 @@
" df : polars Frame\n",
" Dataframe to check\n",
" cols : list[str]\n",
" Requried columns\n",
" Required columns\n",
" var_name : str\n",
" Name of the Frame - used for displaying in any error.\n",
" \"\"\"\n",
......@@ -271,7 +275,7 @@
"outputs": [],
"source": [
"def generate_uid(n: int) -> str:\n",
" \"\"\"Generates a psuedo uid by randomly selecting from characters\"\"\"\n",
" \"\"\"Generates a pseudo uid by randomly selecting from characters\"\"\"\n",
" chars = ascii_letters + digits\n",
" return \"\".join(random.choice(chars) for _ in range(n))"
]
......@@ -327,7 +331,7 @@
" white-space: pre-wrap;\n",
"}\n",
"</style>\n",
"<small>shape: (1_616_000, 4)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>lon</th><th>lat</th><th>datetime</th><th>uid</th></tr><tr><td>i64</td><td>i64</td><td>datetime[μs]</td><td>str</td></tr></thead><tbody><tr><td>-161</td><td>6</td><td>1900-01-22 17:00:00</td><td>&quot;qCulqvN6&quot;</td></tr><tr><td>-1</td><td>25</td><td>1900-01-23 17:00:00</td><td>&quot;krL2tTTH&quot;</td></tr><tr><td>146</td><td>-20</td><td>1900-01-08 22:00:00</td><td>&quot;QCASMObF&quot;</td></tr><tr><td>-16</td><td>-38</td><td>1900-01-05 05:00:00</td><td>&quot;Wh9pptMZ&quot;</td></tr><tr><td>-127</td><td>-33</td><td>1900-01-10 20:00:00</td><td>&quot;PPIxvkbU&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>62</td><td>0</td><td>1900-01-22 11:00:00</td><td>&quot;6PxQzuHv099&quot;</td></tr><tr><td>90</td><td>-34</td><td>1900-01-16 00:00:00</td><td>&quot;pyjCOpgo099&quot;</td></tr><tr><td>-132</td><td>-20</td><td>1900-01-23 05:00:00</td><td>&quot;vZLzl0aX099&quot;</td></tr><tr><td>-104</td><td>39</td><td>1900-01-06 15:00:00</td><td>&quot;8kavFVpP099&quot;</td></tr><tr><td>-131</td><td>-81</td><td>1900-01-24 19:00:00</td><td>&quot;LFTv3XZ1099&quot;</td></tr></tbody></table></div>"
"<small>shape: (1_616_000, 4)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>lon</th><th>lat</th><th>datetime</th><th>uid</th></tr><tr><td>i64</td><td>i64</td><td>datetime[μs]</td><td>str</td></tr></thead><tbody><tr><td>-152</td><td>-90</td><td>1900-01-16 16:00:00</td><td>&quot;OIcjzfs5&quot;</td></tr><tr><td>-177</td><td>8</td><td>1900-01-29 01:00:00</td><td>&quot;xt99511W&quot;</td></tr><tr><td>0</td><td>35</td><td>1900-01-17 06:00:00</td><td>&quot;2E2Zp4SU&quot;</td></tr><tr><td>-54</td><td>-75</td><td>1900-01-08 12:00:00</td><td>&quot;wceONvH7&quot;</td></tr><tr><td>50</td><td>83</td><td>1900-01-27 10:00:00</td><td>&quot;nwuthgEW&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>-29</td><td>-89</td><td>1900-01-03 23:00:00</td><td>&quot;q8Ue8Uzx099&quot;</td></tr><tr><td>11</td><td>45</td><td>1900-01-31 05:00:00</td><td>&quot;6wKA4HVs099&quot;</td></tr><tr><td>-172</td><td>51</td><td>1900-01-06 17:00:00</td><td>&quot;MuIp2NeA099&quot;</td></tr><tr><td>33</td><td>70</td><td>1900-01-23 10:00:00</td><td>&quot;7dNMyTOj099&quot;</td></tr><tr><td>124</td><td>2</td><td>1900-01-15 20:00:00</td><td>&quot;CoQtomTB099&quot;</td></tr></tbody></table></div>"
],
"text/plain": [
"shape: (1_616_000, 4)\n",
......@@ -336,17 +340,17 @@
"│ --- ┆ --- ┆ --- ┆ --- │\n",
"│ i64 ┆ i64 ┆ datetime[μs] ┆ str │\n",
"╞══════╪═════╪═════════════════════╪═════════════╡\n",
"│ -1616 ┆ 1900-01-22 17:00:00 ┆ qCulqvN6 │\n",
"│ -1 ┆ 25 ┆ 1900-01-23 17:00:00 ┆ krL2tTTH │\n",
"│ 146-20 ┆ 1900-01-08 22:00:00 ┆ QCASMObF │\n",
"│ -16 ┆ -38 ┆ 1900-01-05 05:00:00 ┆ Wh9pptMZ │\n",
"│ -127 ┆ -33 ┆ 1900-01-10 20:00:00 ┆ PPIxvkbU │\n",
"│ -152-90 ┆ 1900-01-16 16:00:00 ┆ OIcjzfs5 │\n",
"│ -177 ┆ 8 ┆ 1900-01-29 01:00:00 ┆ xt99511W │\n",
"│ 0 35 ┆ 1900-01-17 06:00:00 ┆ 2E2Zp4SU │\n",
"│ -54 ┆ -75 ┆ 1900-01-08 12:00:00 ┆ wceONvH7 │\n",
"│ 50 ┆ 83 ┆ 1900-01-27 10:00:00 ┆ nwuthgEW │\n",
"│ … ┆ … ┆ … ┆ … │\n",
"│ 62 0 ┆ 1900-01-22 11:00:00 ┆ 6PxQzuHv099 │\n",
"│ 90-34 ┆ 1900-01-16 00:00:00 ┆ pyjCOpgo099 │\n",
"│ -132 ┆ -20 ┆ 1900-01-23 05:00:00 ┆ vZLzl0aX099 │\n",
"│ -10439 ┆ 1900-01-06 15:00:00 ┆ 8kavFVpP099 │\n",
"│ -131 ┆ -81 ┆ 1900-01-24 19:00:00 ┆ LFTv3XZ1099 │\n",
"│ -29-89 ┆ 1900-01-03 23:00:00 ┆ q8Ue8Uzx099 │\n",
"│ 1145 ┆ 1900-01-31 05:00:00 ┆ 6wKA4HVs099 │\n",
"│ -172 ┆ 51 ┆ 1900-01-06 17:00:00 ┆ MuIp2NeA099 │\n",
"│ 33 70 ┆ 1900-01-23 10:00:00 ┆ 7dNMyTOj099 │\n",
"│ 124 ┆ 2 ┆ 1900-01-15 20:00:00 ┆ CoQtomTB099 │\n",
"└──────┴─────┴─────────────────────┴─────────────┘"
]
},
......@@ -376,7 +380,7 @@
"id": "c7bd16e0-96a6-426b-b00a-7c3b8a2aaddd",
"metadata": {},
"source": [
"## Intialise the OctTree Object\n",
"## Initialise the OctTree Object\n",
"\n",
"There is an overhead in constructing the `OctTree` class. The performance benefits appear if multiple neighbourhood searches are performed."
]
......@@ -409,8 +413,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 16.3 s, sys: 163 ms, total: 16.4 s\n",
"Wall time: 16.5 s\n"
"CPU times: user 16.3 s, sys: 253 ms, total: 16.6 s\n",
"Wall time: 16.6 s\n"
]
}
],
......@@ -449,16 +453,16 @@
"- max_depth: 25\n",
"- contents:\n",
"- number of elements: 10\n",
" * SpaceTimeRecord(x = -161, y = 6, datetime = 1900-01-22 17:00:00, uid = qCulqvN6)\n",
" * SpaceTimeRecord(x = -1, y = 25, datetime = 1900-01-23 17:00:00, uid = krL2tTTH)\n",
" * SpaceTimeRecord(x = 146, y = -20, datetime = 1900-01-08 22:00:00, uid = QCASMObF)\n",
" * SpaceTimeRecord(x = -16, y = -38, datetime = 1900-01-05 05:00:00, uid = Wh9pptMZ)\n",
" * SpaceTimeRecord(x = -127, y = -33, datetime = 1900-01-10 20:00:00, uid = PPIxvkbU)\n",
" * SpaceTimeRecord(x = 88, y = 37, datetime = 1900-01-18 12:00:00, uid = gYAwqD2R)\n",
" * SpaceTimeRecord(x = -122, y = 57, datetime = 1900-01-14 13:00:00, uid = L77bWRL1)\n",
" * SpaceTimeRecord(x = -179, y = 23, datetime = 1900-01-29 23:00:00, uid = 3jSwN6aK)\n",
" * SpaceTimeRecord(x = -156, y = 79, datetime = 1900-01-25 16:00:00, uid = OYEzYral)\n",
" * SpaceTimeRecord(x = 140, y = 15, datetime = 1900-01-07 20:00:00, uid = dNqilTiD)\n",
" * SpaceTimeRecord(x = -152, y = -90, datetime = 1900-01-16 16:00:00, uid = OIcjzfs5)\n",
" * SpaceTimeRecord(x = -177, y = 8, datetime = 1900-01-29 01:00:00, uid = xt99511W)\n",
" * SpaceTimeRecord(x = 0, y = 35, datetime = 1900-01-17 06:00:00, uid = 2E2Zp4SU)\n",
" * SpaceTimeRecord(x = -54, y = -75, datetime = 1900-01-08 12:00:00, uid = wceONvH7)\n",
" * SpaceTimeRecord(x = 50, y = 83, datetime = 1900-01-27 10:00:00, uid = nwuthgEW)\n",
" * SpaceTimeRecord(x = -158, y = 56, datetime = 1900-01-05 09:00:00, uid = svHopi53)\n",
" * SpaceTimeRecord(x = 61, y = -31, datetime = 1900-01-30 06:00:00, uid = wQSNr6C4)\n",
" * SpaceTimeRecord(x = 20, y = 54, datetime = 1900-01-19 23:00:00, uid = X0tJnSvA)\n",
" * SpaceTimeRecord(x = -6, y = 20, datetime = 1900-01-22 19:00:00, uid = 0K8N7iN6)\n",
" * SpaceTimeRecord(x = -129, y = -9, datetime = 1900-01-14 11:00:00, uid = 7yXQTGb0)\n",
"- with children:\n",
" OctTree:\n",
" - boundary: SpaceTimeRectangle(west=-180, east=0.0, south=0.0, north=90, start=datetime.datetime(1900, 1, 1, 0, 0), end=datetime.datetime(1900, 1, 16, 11, 30))\n",
......@@ -467,16 +471,16 @@
" - max_depth: 25\n",
" - contents:\n",
" - number of elements: 10\n",
" * SpaceTimeRecord(x = -107, y = 89, datetime = 1900-01-10 01:00:00, uid = dB4jDgBL)\n",
" * SpaceTimeRecord(x = -132, y = 50, datetime = 1900-01-11 18:00:00, uid = ZOzYoDbB)\n",
" * SpaceTimeRecord(x = -28, y = 5, datetime = 1900-01-13 17:00:00, uid = YwB5kPdG)\n",
" * SpaceTimeRecord(x = -153, y = 25, datetime = 1900-01-10 22:00:00, uid = vzNI6J3z)\n",
" * SpaceTimeRecord(x = -45, y = 12, datetime = 1900-01-13 18:00:00, uid = kwHmr9mE)\n",
" * SpaceTimeRecord(x = -31, y = 16, datetime = 1900-01-06 17:00:00, uid = h3JQR5Ab)\n",
" * SpaceTimeRecord(x = -153, y = 25, datetime = 1900-01-14 03:00:00, uid = ZgZwvzHY)\n",
" * SpaceTimeRecord(x = -142, y = 43, datetime = 1900-01-15 14:00:00, uid = jd0JycvC)\n",
" * SpaceTimeRecord(x = -25, y = 81, datetime = 1900-01-07 09:00:00, uid = cQFUsvMk)\n",
" * SpaceTimeRecord(x = -116, y = 43, datetime = 1900-01-09 01:00:00, uid = MDpcWsK8)\n",
" * SpaceTimeRecord(x = -166, y = 34, datetime = 1900-01-11 04:00:00, uid = vXHJHSW5)\n",
" * SpaceTimeRecord(x = -13, y = 21, datetime = 1900-01-05 20:00:00, uid = KgAn9Jbx)\n",
" * SpaceTimeRecord(x = -84, y = 88, datetime = 1900-01-06 06:00:00, uid = ViZnTg8Z)\n",
" * SpaceTimeRecord(x = -165, y = 37, datetime = 1900-01-08 23:00:00, uid = LAjiwrGC)\n",
" * SpaceTimeRecord(x = -132, y = 57, datetime = 1900-01-01 03:00:00, uid = dOI2LWaC)\n",
" * SpaceTimeRecord(x = -156, y = 22, datetime = 1900-01-11 01:00:00, uid = RK8e20dA)\n",
" * SpaceTimeRecord(x = -154, y = 56, datetime = 1900-01-09 08:00:00, uid = KqJoV8UA)\n",
" * SpaceTimeRecord(x = -119, y = 52, datetime = 1900-01-02 10:00:00, uid = UtEIgcof)\n",
" * SpaceTimeRecord(x = -161, y = 63, datetime = 1900-01-10 10:00:00, uid = QjifGPIx)\n",
" * SpaceTimeRecord(x = -133, y = 87, datetime = 1900-01-05 07:00:00, uid = qtolX8oT)\n",
" - with children:\n",
" OctTree:\n",
" - boundary: SpaceTimeRectangle(west=-180, east=-90.0, south=45.0, north=90, start=datetime.datetime(1900, 1, 1, 0, 0), end=datetime.datetime(1900, 1, 8, 17, 45))\n",
......@@ -485,16 +489,16 @@
" - max_depth: 25\n",
" - contents:\n",
" - number of elements: 10\n",
" * SpaceTimeRecord(x = -130, y = 80, datetime = 1900-01-01 03:00:00, uid = sd0nBvvS)\n",
" * SpaceTimeRecord(x = -148, y = 78, datetime = 1900-01-06 03:00:00, uid = FgJRfXD9)\n",
" * SpaceTimeRecord(x = -153, y = 58, datetime = 1900-01-03 12:00:00, uid = AHWomxBm)\n",
" * SpaceTimeRecord(x = -160, y = 47, datetime = 1900-01-06 18:00:00, uid = 3p50Ejkq)\n",
" * SpaceTimeRecord(x = -91, y = 60, datetime = 1900-01-07 06:00:00, uid = 1Psbg1Vk)\n",
" * SpaceTimeRecord(x = -138, y = 54, datetime = 1900-01-08 10:00:00, uid = kDwksPIp)\n",
" * SpaceTimeRecord(x = -99, y = 86, datetime = 1900-01-05 12:00:00, uid = gfhX01rL)\n",
" * SpaceTimeRecord(x = -96, y = 54, datetime = 1900-01-04 23:00:00, uid = o7lz8pja)\n",
" * SpaceTimeRecord(x = -163, y = 79, datetime = 1900-01-07 22:00:00, uid = 2Fw915S3)\n",
" * SpaceTimeRecord(x = -155, y = 74, datetime = 1900-01-08 09:00:00, uid = 9pL97BD0)\n",
" * SpaceTimeRecord(x = -129, y = 54, datetime = 1900-01-05 04:00:00, uid = dZ2BgU6A)\n",
" * SpaceTimeRecord(x = -96, y = 67, datetime = 1900-01-07 11:00:00, uid = KK38iUxT)\n",
" * SpaceTimeRecord(x = -137, y = 50, datetime = 1900-01-04 15:00:00, uid = Mlj2MvCb)\n",
" * SpaceTimeRecord(x = -134, y = 74, datetime = 1900-01-02 04:00:00, uid = wCj1pLL6)\n",
" * SpaceTimeRecord(x = -158, y = 86, datetime = 1900-01-06 04:00:00, uid = sIPv5QW4)\n",
" * SpaceTimeRecord(x = -113, y = 56, datetime = 1900-01-08 02:00:00, uid = 5hnlO6ce)\n",
" * SpaceTimeRecord(x = -166, y = 54, datetime = 1900-01-08 12:00:00, uid = PXj9tTWn)\n",
" * SpaceTimeRecord(x = -97, y = 83, datetime = 1900-01-06 11:00:00, uid = bizLnSZk)\n",
" * SpaceTimeRecord(x = -126, y = 53, datetime = 1900-01-05 13:00:00, uid = guzXcRwq)\n",
" * SpaceTimeRecord(x = -148, y = 55, datetime = 1900-01-02 05:00:00, uid = CizwDlIJ)\n",
" - with children:\n",
" OctTree:\n",
" - boundary: SpaceTimeRectangle(west=-180, east=-135.0, south=67.5, north=90, start=datetime.datetime(1900, 1, 1, 0, 0), end=datetime.datetime(1900, 1, 4, 20, 52, 30))\n",
......@@ -503,16 +507,16 @@
" - max_depth: 25\n",
" - contents:\n",
" - number of elements: 10\n",
" * SpaceTimeRecord(x = -173, y = 71, datetime = 1900-01-04 03:00:00, uid = ThLEI8lF)\n",
" * SpaceTimeRecord(x = -167, y = 83, datetime = 1900-01-04 03:00:00, uid = Q5FzwxD5)\n",
" * SpaceTimeRecord(x = -167, y = 88, datetime = 1900-01-01 16:00:00, uid = DoCBI1YI)\n",
" * SpaceTimeRecord(x = -141, y = 80, datetime = 1900-01-03 16:00:00, uid = 01SVlWsE)\n",
" * SpaceTimeRecord(x = -135, y = 68, datetime = 1900-01-03 22:00:00, uid = Jx2uI4Op)\n",
" * SpaceTimeRecord(x = -163, y = 77, datetime = 1900-01-03 21:00:00, uid = DoOKHLix)\n",
" * SpaceTimeRecord(x = -157, y = 84, datetime = 1900-01-02 11:00:00, uid = lXiFUOBn)\n",
" * SpaceTimeRecord(x = -145, y = 78, datetime = 1900-01-02 05:00:00, uid = 3ngKJmcS)\n",
" * SpaceTimeRecord(x = -179, y = 89, datetime = 1900-01-04 01:00:00, uid = KQXXjSTT)\n",
" * SpaceTimeRecord(x = -171, y = 80, datetime = 1900-01-04 19:00:00, uid = znugCZWi)\n",
" * SpaceTimeRecord(x = -144, y = 83, datetime = 1900-01-03 20:00:00, uid = L5hq9qlG)\n",
" * SpaceTimeRecord(x = -138, y = 84, datetime = 1900-01-03 11:00:00, uid = DnDQBPlt)\n",
" * SpaceTimeRecord(x = -140, y = 78, datetime = 1900-01-01 11:00:00, uid = VVKqwc7O)\n",
" * SpaceTimeRecord(x = -179, y = 85, datetime = 1900-01-02 01:00:00, uid = fd5NWtYa)\n",
" * SpaceTimeRecord(x = -179, y = 86, datetime = 1900-01-04 11:00:00, uid = KJp276Fa)\n",
" * SpaceTimeRecord(x = -176, y = 68, datetime = 1900-01-02 06:00:00, uid = nWy0gnK4)\n",
" * SpaceTimeRecord(x = -136, y = 77, datetime = 1900-01-01 06:00:00, uid = 21nlHCJg)\n",
" * SpaceTimeRecord(x = -171, y = 82, datetime = 1900-01-04 11:00:00, uid = 5uBXalIT)\n",
" * SpaceTimeRecord(x = -145, y = 85, datetime = 1900-01-03 16:00:00, uid = fjG42lVI)\n",
" * SpaceTimeRecord(x = -155, y = 70, datetime = 1900-01-01 13:00:00, uid = lev3XeV1)\n",
" - with children:\n",
" OctTree:\n",
" - boundary: SpaceTimeRectangle(west=-180, east=-157.5, south=78.75, north=90, start=datetime.datetime(1900, 1, 1, 0, 0), end=datetime.datetime(1900, 1, 2, 22, 26, 15))\n",
......@@ -521,16 +525,16 @@
" - max_depth: 25\n",
" - contents:\n",
" - number of elements: 10\n",
" * SpaceTimeRecord(x = -164, y = 79, datetime = 1900-01-01 18:00:00, uid = L0scr6Dw)\n",
" * SpaceTimeRecord(x = -165, y = 87, datetime = 1900-01-02 12:00:00, uid = P2JSVMig)\n",
" * SpaceTimeRecord(x = -158, y = 80, datetime = 1900-01-01 07:00:00, uid = rrfLnl9a000)\n",
" * SpaceTimeRecord(x = -179, y = 88, datetime = 1900-01-01 18:00:00, uid = piKfH7lZ000)\n",
" * SpaceTimeRecord(x = -162, y = 85, datetime = 1900-01-01 00:00:00, uid = TzzMqFl4000)\n",
" * SpaceTimeRecord(x = -170, y = 85, datetime = 1900-01-01 02:00:00, uid = v6BVfkmP000)\n",
" * SpaceTimeRecord(x = -177, y = 87, datetime = 1900-01-01 08:00:00, uid = sAxKIWXJ001)\n",
" * SpaceTimeRecord(x = -164, y = 79, datetime = 1900-01-01 02:00:00, uid = 55vXE5De001)\n",
" * SpaceTimeRecord(x = -167, y = 87, datetime = 1900-01-02 00:00:00, uid = RzUJ5Q7h001)\n",
" * SpaceTimeRecord(x = -170, y = 89, datetime = 1900-01-01 20:00:00, uid = ipKiaytp002)\n",
" * SpaceTimeRecord(x = -169, y = 85, datetime = 1900-01-02 17:00:00, uid = xdVWmHGw)\n",
" * SpaceTimeRecord(x = -176, y = 87, datetime = 1900-01-01 03:00:00, uid = M6ActtYJ)\n",
" * SpaceTimeRecord(x = -171, y = 89, datetime = 1900-01-02 22:00:00, uid = Xw7p5CU0)\n",
" * SpaceTimeRecord(x = -166, y = 86, datetime = 1900-01-01 13:00:00, uid = Ini19LT9)\n",
" * SpaceTimeRecord(x = -166, y = 87, datetime = 1900-01-02 07:00:00, uid = 77vJfw2i000)\n",
" * SpaceTimeRecord(x = -164, y = 83, datetime = 1900-01-01 15:00:00, uid = tSjaLRdX000)\n",
" * SpaceTimeRecord(x = -171, y = 81, datetime = 1900-01-01 04:00:00, uid = xNRbwxLR000)\n",
" * SpaceTimeRecord(x = -177, y = 87, datetime = 1900-01-02 14:00:00, uid = 26OOsEav000)\n",
" * SpaceTimeRecord(x = -163, y = 80, datetime = 1900-01-02 08:00:00, uid = 80kZku0r000)\n",
" * SpaceTimeRecord(x = -174, y = 83, datetime = 1900-01-02 06:00:00, uid = TORItCvU001)\n",
" - with children:\n",
" OctTree:\n",
" - boundary: SpaceTimeRectangle(west=-180, east=-168.75, south=84.375, north=90, start=datetime.datetime(1900, 1, 1, 0, 0), end=datetime.datetime(1900, 1, 1, 23, 13, 7, 500000))\n",
......@@ -539,9 +543,9 @@
" - max_depth: 25\n",
" - contents:\n",
" - number of elements: 10\n",
" * SpaceTimeRecord(x = -178, y = 87, datetime = 1900-01-01 11:00:00, uid = 9i3tUAKH003)\n",
" * SpaceTimeRecord(x = -169, y = 88, datetime = 1900-01-01 23:00:00, uid = ib1mXyZJ003)\n",
" * SpaceTimeRecord(x = -174, y = 88, datetime = 1900-01-01 03:00:00, uid = vYJ8DamM004)\n"
" * SpaceTimeRecord(x = -178, y = 86, datetime = 1900-01-01 19:00:00, uid = iuABumaA002)\n",
" * SpaceTimeRecord(x = -172, y = 88, datetime = 1900-01-01 09:00:00, uid = 7H12EJwT002)\n",
" * SpaceTimeRecord(x = -176, y = 85, datetime = 1900-01-01 13:00:00, uid = A2rVtlYK006)\n"
]
}
],
......@@ -593,7 +597,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1.32 ms ± 20.8 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n"
"1.28 ms ± 28.2 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n"
]
}
],
......@@ -614,7 +618,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"12.1 ms ± 81.4 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
"11.8 ms ± 198 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
]
}
],
......
......@@ -14,7 +14,7 @@ packages = ["GeoSpatialTools"]
name = "GeoSpatialTools"
version = "0.11.2"
dependencies = ["numpy"]
requires-python = ">=3.9"
requires-python = ">=3.11"
authors = [
{ name = "Joseph Siddons", email = "josidd@noc.ac.uk" },
{ name = "Richard Cornes", email = "rcornes@noc.ac.uk" },
......@@ -93,8 +93,15 @@ polars = "pl"
scipy = "sp"
xarray = "xr"
[tool.codespell]
skip = "./docs/_build"
count = true
quiet-level = 3
[project.urls]
Repository = "https://git.noc.ac.uk/nocsurfaceprocesses/geospatialtools"
[dependency-groups]
dev = ["bpython>=0.25"]
dev = [
"bpython>=0.25",
]
......@@ -294,7 +294,7 @@ class TestOctTree(unittest.TestCase):
start = d - dt
end = d + dt
boundary = Rectangle(-180, 180, -90, 90, start, end)
ot = OctTree(boundary, capacity=3)
octree = OctTree(boundary, capacity=3)
quert_rect = Rectangle(140, -160, 40, 50, d, d + timedelta(days=8))
points_want: list[Record] = [
......@@ -311,9 +311,9 @@ class TestOctTree(unittest.TestCase):
]
points.extend(points_want)
for p in points:
ot.insert(p)
octree.insert(p)
res = ot.query(quert_rect)
res = octree.query(quert_rect)
assert len(res) == len(points_want)
assert all([p in res for p in points_want])
......@@ -339,7 +339,7 @@ class TestOctTree(unittest.TestCase):
test_datetime - test_timedelta / 2,
test_datetime + test_timedelta / 2,
)
# TEST: distint locii
# TEST: distinct locii
assert (ellipse.p1_lon, ellipse.p1_lat) != (
ellipse.p2_lon,
ellipse.p2_lat,
......
......@@ -155,7 +155,7 @@ class TestQuadTree(unittest.TestCase):
assert qt_boundary.lat == 0
assert qt_boundary.lat_range == 180
qt = QuadTree(qt_boundary, capacity=3)
quadtree = QuadTree(qt_boundary, capacity=3)
quert_rect = Rectangle(140, -160, 40, 50)
assert quert_rect.lon == 170
......@@ -176,9 +176,9 @@ class TestQuadTree(unittest.TestCase):
]
points.extend(points_want)
for p in points:
qt.insert(p)
quadtree.insert(p)
res = qt.query(quert_rect)
res = quadtree.query(quert_rect)
assert len(res) == len(points_want)
assert all([p in res for p in points_want])
......@@ -188,7 +188,7 @@ class TestQuadTree(unittest.TestCase):
theta = 0
ellipse = Ellipse(12.5, 2.5, d1, d2, theta)
# TEST: distint locii
# TEST: distinct locii
assert (ellipse.p1_lon, ellipse.p1_lat) != (
ellipse.p2_lon,
ellipse.p2_lat,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment