Linting, minor fixes
This commit is contained in:
parent
5e10cefc62
commit
1fc33eb6f4
|
@ -159,18 +159,17 @@ def add_distance_after(filename: str, base_location: dict):
|
|||
with open(filename, "r") as file:
|
||||
data = json.load(file)
|
||||
except FileNotFoundError:
|
||||
print('No file by that name')
|
||||
print("No file by that name")
|
||||
return None
|
||||
|
||||
distance = 'Unknown'
|
||||
distance = "Unknown"
|
||||
|
||||
for dictionary in data:
|
||||
if 'latitude' in dictionary:
|
||||
# dictionary['longitude'] = fix_long(dictionary['longitude'])
|
||||
if "latitude" in dictionary and type(dictionary["latitude"]) == float:
|
||||
distance = calculate_distance(base_location, dictionary)
|
||||
dictionary["distance"] = distance
|
||||
elif 'iperf_full' in dictionary:
|
||||
dictionary['start_distance'] = distance
|
||||
elif "iperf_full" in dictionary:
|
||||
dictionary["start_distance"] = distance
|
||||
|
||||
# Save updated data back to the file
|
||||
with open(filename, "w") as file:
|
||||
|
@ -178,10 +177,15 @@ def add_distance_after(filename: str, base_location: dict):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
filename = '/home/madrigal/repos/range-testing/data/boat_relay_sept_17/test_1758123903_copy.json'
|
||||
filenames = [
|
||||
"/home/madrigal/repos/range-testing/data/boat_relay_sept_18/test_1758215714_copy.json",
|
||||
"/home/madrigal/repos/range-testing/data/boat_relay_sept_18/test_1758217711_copy.json",
|
||||
"/home/madrigal/repos/range-testing/data/boat_relay_sept_18/test_1758219350_copy.json"
|
||||
]
|
||||
base_location = {
|
||||
'latitude': 43.656328,
|
||||
'longitude': -79.307884,
|
||||
'altitude': 80,
|
||||
"latitude": 43.656328,
|
||||
"longitude": -79.307884,
|
||||
"altitude": 80,
|
||||
}
|
||||
add_distance_after(filename=filename, base_location=base_location)
|
||||
for filename in filenames:
|
||||
add_distance_after(filename=filename, base_location=base_location)
|
||||
|
|
Loading…
Reference in New Issue
Block a user