Skip to content

Commit

Permalink
make astroplan look for the next sunrise/sunset from the given time i…
Browse files Browse the repository at this point in the history
…n get_daynight_ratio
  • Loading branch information
atmorling committed May 17, 2024
1 parent 29f6fda commit 0e1ca74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ecoscope/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def get_daynight_ratio(self, n_grid_points=150) -> pd.Series:
.sun_rise_time(
astropy.time.Time(night_day_df.segment_start),
n_grid_points=n_grid_points,
which="next",
)
.datetime,
utc=True,
Expand All @@ -435,6 +436,7 @@ def get_daynight_ratio(self, n_grid_points=150) -> pd.Series:
.sun_set_time(
astropy.time.Time(day_night_df.segment_start),
n_grid_points=n_grid_points,
which="next",
)
.datetime,
utc=True,
Expand Down
4 changes: 1 addition & 3 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,12 @@ def test_sampling(movebank_relocations):
gpd.testing.assert_geodataframe_equal(downsampled_relocs_int, expected_downsample_int, check_less_precise=True)


@pytest.mark.skip(reason="Skipped pending rework https://github.com/wildlife-dynamics/ecoscope/issues/152")
@pytest.mark.filterwarnings("ignore:Target with index", 'ignore: ERFA function "utctai"')
def test_daynight_ratio(movebank_relocations):
trajectory = ecoscope.base.Trajectory.from_relocations(movebank_relocations)
expected = pd.Series(
[
2.212816,
0.638830,
0.656435,
],
index=pd.Index(["Habiba", "Salif Keita"], name="groupby_col"),
)
Expand Down

0 comments on commit 0e1ca74

Please sign in to comment.