Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove SpeedDataframe and Speedmap #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading