From a1eb117263ba9e831426017e472ab5bbf9277888 Mon Sep 17 00:00:00 2001 From: Zachary Clement Date: Tue, 30 Jan 2024 19:07:29 -0500 Subject: [PATCH] Ensure longitude is in data columns before type checking --- forest/jasmine/traj2stats.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/forest/jasmine/traj2stats.py b/forest/jasmine/traj2stats.py index 206792ac..2695747c 100644 --- a/forest/jasmine/traj2stats.py +++ b/forest/jasmine/traj2stats.py @@ -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