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

Fix get_events() timestamp format issue #62

Merged
merged 2 commits into from
Nov 27, 2023
Merged
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
2 changes: 1 addition & 1 deletion ecoscope/io/earthranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def get_events(
)

assert not df.empty
df["time"] = pd.to_datetime(df["time"])
df["time"] = pd.to_datetime(df["time"], format="mixed")

df = gpd.GeoDataFrame(df)
df.loc[~df["geojson"].isna(), "geometry"] = gpd.GeoDataFrame.from_features(
Expand Down
18 changes: 0 additions & 18 deletions tests/test_earthranger_io.py
ericgitonga marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import datetime
import uuid
from tempfile import TemporaryDirectory

import geopandas as gpd
import pandas as pd
import pytest
import pytz
from shapely.geometry import Point

import ecoscope
Expand Down Expand Up @@ -72,27 +70,11 @@ def test_get_subjectgroup_observations(er_io):
assert "groupby_col" in relocations


@pytest.mark.skip(reason="this has been failing since May 2022; will be fixed in a follow-up pull")
def test_get_events(er_events_io):
events = er_events_io.get_events()
assert not events.empty


@pytest.mark.filterwarnings("ignore:All-NaN slice encountered:RuntimeWarning")
@pytest.mark.filterwarnings("ignore:Mean of empty slice:RuntimeWarning")
def test_collar_voltage(er_io):
start_time = pytz.utc.localize(datetime.datetime.now() - datetime.timedelta(days=31))
observations = er_io.get_subjectgroup_observations(
group_name=er_io.GROUP_NAME,
include_subject_details=True,
include_subjectsource_details=True,
include_details="true",
)

with TemporaryDirectory() as output_folder:
ecoscope.plotting.plot.plot_collar_voltage(observations, start_time=start_time, output_folder=output_folder)


def test_das_client_method(er_io):
er_io.pulse()
er_io.get_me()
Expand Down
Loading