Skip to content

Commit

Permalink
remove SpeedDataframe and Speedmap (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
atmorling authored Dec 19, 2024
1 parent 1637847 commit a370d57
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 148 deletions.
1 change: 0 additions & 1 deletion ecoscope/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
__all__ = [
"ecograph",
"speed",
"UD",
"astronomy",
"classifier",
Expand Down
100 changes: 0 additions & 100 deletions ecoscope/analysis/speed.py

This file was deleted.

39 changes: 1 addition & 38 deletions ecoscope/mapping/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

try:
import matplotlib as mpl
from ecoscope.analysis.speed import SpeedDataFrame
from lonboard import Map
from lonboard.types.layer import PathLayerKwargs, PolygonLayerKwargs, ScatterplotLayerKwargs
from lonboard._geoarrow.ops.bbox import Bbox
from lonboard._viewport import compute_view, bbox_to_zoom_level
from lonboard._viz import viz_layer
from lonboard.colormap import apply_categorical_cmap
from lonboard._layer import (
BaseLayer,
BitmapLayer,
Expand All @@ -46,42 +44,7 @@
)


class EcoMapMixin:
def add_speedmap(
self,
trajectory: gpd.GeoDataFrame,
classification_method: str = "equal_interval",
num_classes: int = 6,
speed_colors: List = None,
bins: List = None,
legend: bool = True,
):

speed_df = SpeedDataFrame.from_trajectory(
trajectory=trajectory,
classification_method=classification_method,
num_classes=num_classes,
speed_colors=speed_colors,
bins=bins,
)

colors = speed_df["speed_colour"].to_list()
rgb = []
for i, color in enumerate(colors):
color = color.strip("#")
rgb.append(list(int(color[i : i + 2], 16) for i in (0, 2, 4)))

cmap = apply_categorical_cmap(values=speed_df.index.to_series(), cmap=rgb)
path_kwargs = {"get_color": cmap, "pickable": False}
self.add_gdf(speed_df, path_kwargs=path_kwargs)

if legend:
self.add_legend(labels=speed_df.label.to_list(), colors=speed_df.speed_colour.to_list())

return speed_df


class EcoMap(EcoMapMixin, Map):
class EcoMap(Map):
def __init__(self, static=False, default_widgets=True, *args, **kwargs):

kwargs["height"] = kwargs.get("height", 600)
Expand Down
9 changes: 0 additions & 9 deletions tests/test_speed.py

This file was deleted.

0 comments on commit a370d57

Please sign in to comment.