Skip to content

Commit

Permalink
Ensure longitude is in data columns before type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
clementzach committed Jan 31, 2024
1 parent ccf30f7 commit a1eb117
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions forest/jasmine/traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,8 +1661,13 @@ def gps_stats_main(
tz_str, time_start, time_end,
)

if ((data["longitude"].max() > 180)
or (data["longitude"].min() < -180)):
if (
("longitude" in data.columns)
and (
(data["longitude"].max() > 180)
or (data["longitude"].min() < -180)
)
):
logger.info("Reconciled bad longitude data for user %s",
participant_id)
data["longitude"] = (data["longitude"] + 180) % 360 - 180
Expand Down

0 comments on commit a1eb117

Please sign in to comment.