diff --git a/ecoscope/io/earthranger.py b/ecoscope/io/earthranger.py index 1f559d87..91e2e9a5 100644 --- a/ecoscope/io/earthranger.py +++ b/ecoscope/io/earthranger.py @@ -714,7 +714,7 @@ def get_patrol_observations(self, patrols_df, include_patrol_details=False, **kw try: observation = self.get_subject_observations( - subject_ids=[subject_id], since=patrol_start_time, until=patrol_end_time + subject_ids=[subject_id], since=patrol_start_time, until=patrol_end_time, **kwargs ) if include_patrol_details: observation["patrol_id"] = patrol["id"] @@ -738,7 +738,8 @@ def get_patrol_observations(self, patrols_df, include_patrol_details=False, **kw ] ) ) - observations.append(observation) + if len(observation) > 0: + observations.append(observation) except Exception as e: print( f"Getting observations for subject_id={subject_id} start_time={patrol_start_time}" diff --git a/ecoscope/version.py b/ecoscope/version.py index daa50c7c..aa56ed40 100644 --- a/ecoscope/version.py +++ b/ecoscope/version.py @@ -1 +1 @@ -__version__ = "1.4.2" +__version__ = "1.4.3" diff --git a/notebooks/01. IO/EarthRanger_IO.ipynb b/notebooks/01. IO/EarthRanger_IO.ipynb index dc8641a9..934a839c 100644 --- a/notebooks/01. IO/EarthRanger_IO.ipynb +++ b/notebooks/01. IO/EarthRanger_IO.ipynb @@ -614,8 +614,9 @@ "source": [ "patrol_df = er_io.get_patrols()\n", "\n", - "relocs = er_io.get_observations_for_patrols(\n", + "relocs = er_io.get_patrol_observations(\n", " patrol_df,\n", + " include_patrol_details=True,\n", " include_source_details=True,\n", " include_subject_details=True,\n", " include_subjectsource_details=True,\n", diff --git a/tests/test_earthranger_io.py b/tests/test_earthranger_io.py index ceeb8e82..a585d563 100644 --- a/tests/test_earthranger_io.py +++ b/tests/test_earthranger_io.py @@ -207,9 +207,9 @@ def test_patch_event(er_io): pd.testing.assert_frame_equal(result, updated_event) -def test_get_observation_for_patrol(er_io): +def test_get_patrol_observations(er_io): patrols = er_io.get_patrols() - observations = er_io.get_observations_for_patrols( + observations = er_io.get_patrol_observations( patrols, include_source_details=False, include_subject_details=False,