From 4972e87ec23758328e0b795415a2c631be189bf4 Mon Sep 17 00:00:00 2001 From: Zachary Clement Date: Tue, 9 Jan 2024 21:00:05 -0500 Subject: [PATCH] add warning to users requesting OSM summaries, make the transformation keep values the same if within valid range --- forest/jasmine/traj2stats.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/forest/jasmine/traj2stats.py b/forest/jasmine/traj2stats.py index 712fcd76..7ec7d154 100644 --- a/forest/jasmine/traj2stats.py +++ b/forest/jasmine/traj2stats.py @@ -1648,7 +1648,19 @@ def gps_stats_main( or (data["longitude"].min() < -180)): logger.info("Reconciled bad longitude data for user %s", participant_id) - data["longitude"] = data["longitude"] % 360 - 180 + data["longitude"] = (data["longitude"] + 180) % 360 - 180 + if ((places_of_interest is not None) + or (osm_tags is not None)): + logger.warning("Warning: user %s had longitude values " + "outside the valid range [-180, 180] " + "but OSM location summaries were " + "requested. Longitude values outside " + "the valid range may signify that GPS " + "fuzzing was directed to be used in " + "the study setup file. If GPS " + "coordinates were fuzzed, OSM " + "location summaries are meaningless", + participant_id) if data.shape == (0, 0): logger.info("No data available.")