Commit c7f9b538 authored by matt24smith's avatar matt24smith
Browse files

bug fix, error handling when modeling vessel trajectories, and updated testing...

bug fix, error handling when modeling vessel trajectories, and updated testing for additional data sources
parent 412c6f89
Pipeline #4969 failed with stages
in 2 minutes and 50 seconds
......@@ -399,6 +399,13 @@ class ApplicationWindow(QMainWindow):
self.set_canvas_boundary(xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax)
return
def get_canvas_markers_xy(self, clear_points=False):
''' return map marker vertices as (x, y) tuples '''
markers = [(xy.x(), xy.y()) for xy in self.toolcoord.pts]
if clear_points:
self.clear_coord()
return markers
def split_feature_over_meridian(self, meridian, geom):
''' '''
adjust = lambda x: ((np.array(x) + 180) % 360) - 180
......
......@@ -136,6 +136,9 @@ def TrackGen(
for rows in rowgen:
assert rows.size > 1 or rows != np.array(
None, dtype=object), 'cannot create track vectors from empty set'
if deduplicate_timestamps:
warnings.warn('timestamps deduplication is deprecated')
dupe_idx = np.append(
......@@ -147,9 +150,7 @@ def TrackGen(
rows[:, mmsi_col].astype(float).astype(int)[1:]))
rows = np.delete(rows, dupe_idx, axis=0)
if rows == np.array(None, dtype=object):
# print(f'warning: skipping empty rows {rows = }')
# continue
if len(rows) == 0 or (len(rows) == 1 and rows[0] is None):
raise ValueError(
'cannot create vector from zero-size track segment')
......
__version__ = "1.0.15"
__version__ = "1.0.16"
......@@ -2,6 +2,12 @@
Changelog
=========
v1.0.16
-------
bug fix, error handling when modeling vessel trajectories, and updated testing for additional data sources
v1.0.15
-------
......
......@@ -58,10 +58,22 @@ def sample_random_polygon(xscale=20, yscale=20):
y = (np.random.random(vertices) * yscale) + (170 *
(np.random.random() - .5))
#return geom
return x, y
def sample_gulfstlawrence_zonegeometry():
gulfstlawrence_bbox_xy = np.array([
(-71.64440346704974, 43.18445256159233),
(-71.2966623933639, 52.344721551389526),
(-51.2146153880073, 51.68484191466307),
(-50.345262703792734, 42.95158299927571),
(-71.64440346704974, 43.18445256159233),
])
z1 = ZoneGeom('gulf st lawrence', *gulfstlawrence_bbox_xy.T)
return z1
def zonegeoms_or_randompoly(randomize=False, count=10):
shapefilepaths = glob_files(zones_dir, '.txt')
if len(shapefilepaths) > 0 and not randomize:
......
......@@ -9,19 +9,26 @@ from aisdb.webdata.merge_data import (
merge_tracks_shoredist,
)
from aisdb.database.sqlfcn_callbacks import in_bbox_time
from aisdb.gis import ZoneGeom, Domain
from tests.create_testing_data import sample_gulfstlawrence_zonegeometry
import numpy as np
def prepare_qry():
z1 = sample_gulfstlawrence_zonegeometry
domain = Domain('gulf domain', geoms={'z1': z1}, cache=False)
start = datetime(2021, 11, 1)
end = datetime(2021, 11, 2)
end = datetime(2021, 11, 7)
rowgen = DBQuery(
start=start,
end=end,
xmin=-60,
xmax=-45,
ymin=40,
ymax=60,
xmin=domain.minX,
xmax=domain.maxX,
ymin=domain.minY,
ymax=domain.maxY,
callback=in_bbox_time,
).gen_qry()
......
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