Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
NOCSurfaceProcesses
GeoSpatialTools
Commits
a7e594a1
Commit
a7e594a1
authored
1 month ago
by
Joseph Siddons
Browse files
Options
Download
Plain Diff
Merge branch 'ruff_check' into 'main'
Ruff check See merge request
!17
parents
8292da92
0821384a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
5 deletions
+19
-5
GeoSpatialTools/__init__.py
GeoSpatialTools/__init__.py
+2
-0
GeoSpatialTools/octtree.py
GeoSpatialTools/octtree.py
+8
-3
GeoSpatialTools/quadtree.py
GeoSpatialTools/quadtree.py
+4
-1
GeoSpatialTools/utils.py
GeoSpatialTools/utils.py
+3
-0
pyproject.toml
pyproject.toml
+2
-1
No files found.
GeoSpatialTools/__init__.py
View file @
a7e594a1
"""Tools for fast neighbour look-up on the Earth's surface"""
from
.neighbours
import
find_nearest
from
.distance_metrics
import
haversine
from
.great_circle
import
GreatCircle
...
...
This diff is collapsed.
Click to expand it.
GeoSpatialTools/octtree.py
View file @
a7e594a1
...
...
@@ -75,7 +75,10 @@ class SpaceTimeRecord:
return
None
def
__str__
(
self
)
->
str
:
return
f
"SpaceTimeRecord(x =
{
self
.
lon
}
, y =
{
self
.
lat
}
, datetime =
{
self
.
datetime
}
, uid =
{
self
.
uid
}
)"
return
(
f
"SpaceTimeRecord(x =
{
self
.
lon
}
, y =
{
self
.
lat
}
, "
+
f
"datetime =
{
self
.
datetime
}
, uid =
{
self
.
uid
}
)"
)
def
__eq__
(
self
,
other
:
object
)
->
bool
:
if
not
isinstance
(
other
,
SpaceTimeRecord
):
...
...
@@ -196,10 +199,12 @@ class SpaceTimeRectangle:
@
property
def
time_range
(
self
)
->
datetime
.
timedelta
:
"""The time extent of the Rectangle"""
return
self
.
end
-
self
.
start
@
property
def
centre_datetime
(
self
)
->
datetime
.
datetime
:
"""The midpoint time of the Rectangle"""
return
self
.
start
+
(
self
.
end
-
self
.
start
)
/
2
def
_test_east_west
(
self
,
lon
:
float
)
->
bool
:
...
...
@@ -564,7 +569,7 @@ class OctTree:
)
self
.
divided
=
True
def
insert
(
self
,
point
:
SpaceTimeRecord
)
->
bool
:
def
insert
(
self
,
point
:
SpaceTimeRecord
)
->
bool
:
# noqa: C901
"""
Insert a SpaceTimeRecord into the QuadTree.
...
...
@@ -600,7 +605,7 @@ class OctTree:
return
True
return
False
def
remove
(
self
,
point
:
SpaceTimeRecord
)
->
bool
:
def
remove
(
self
,
point
:
SpaceTimeRecord
)
->
bool
:
# noqa: C901
"""
Remove a SpaceTimeRecord from the OctTree if it is in the OctTree.
...
...
This diff is collapsed.
Click to expand it.
GeoSpatialTools/quadtree.py
View file @
a7e594a1
...
...
@@ -67,7 +67,10 @@ class Record:
return
None
def
__str__
(
self
)
->
str
:
return
f
"Record(lon =
{
self
.
lon
}
, lat =
{
self
.
lat
}
, datetime =
{
self
.
datetime
}
, uid =
{
self
.
uid
}
)"
return
(
f
"Record(lon =
{
self
.
lon
}
, lat =
{
self
.
lat
}
, "
+
f
"datetime =
{
self
.
datetime
}
, uid =
{
self
.
uid
}
)"
)
def
__eq__
(
self
,
other
:
object
)
->
bool
:
if
not
isinstance
(
other
,
Record
):
...
...
This diff is collapsed.
Click to expand it.
GeoSpatialTools/utils.py
View file @
a7e594a1
"""Utility functions. Including Error classes and Warnings."""
class
LatitudeError
(
ValueError
):
"""Error for invalid Latitude Value"""
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
View file @
a7e594a1
...
...
@@ -78,7 +78,8 @@ extend-select = [
ignore
=
[
"D205"
,
# blank-line-after-summary
"D400"
,
# ends-in-period
"D401"
# non-imperative-mood
"D401"
,
# non-imperative-mood
"D105"
# missing docstring in magic method
]
preview
=
true
select
=
[
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment