数据
1453132356.600000 34.0342694493 108.755911045 587.800293 1453132357.960000 34.0344383177 108.755909682 587.673778 1453132358.520000 34.0345050891 108.755905295 587.568409 1453132359.160000 34.0345823584 108.755898876 587.587611 1453132359.560000 34.0346306268 108.755897244 587.612678 1453132360.200000 34.0347072511 108.755895617 587.583863 1453132360.840000 34.0347838932 108.755894644 587.438686 1453132361.400000 34.034850341 108.755894968 587.336082 1453132362.040000 34.0349259665 108.755895105 587.321752 1453132362.600000 34.0349939502 108.755895669 587.300844 1453132363.160000 34.0350612885 108.755896463 587.323285 1453132363.720000 34.0351295704 108.755895922 587.301819
API_TXT_GNSS.py
import csv # 读取数据到字典 def Read_GNSS_TXT(file_path): data_dict = {} with open(file_path, 'r') as file: reader = csv.reader(file, delimiter=' ') for row in reader: if row: # 检查行是否为空 timestamp = float(row[0]) latitude = float(row[1]) longitude = float(row[2]) altitude = float(row[3]) data_dict[timestamp] = (latitude, longitude, altitude) return data_dict # 根据时间戳查找数据 def find_data_by_timestamp(data_dict, target_timestamp): return data_dict.get(target_timestamp, None) # 示例 file_path = '/home/dongdong/2project/0data/NWPU/FHY_config/FHY_gps.txt' # 替换为实际文件路径 GNSS_LIST = Read_GNSS_TXT(file_path) # 查找特定时间戳 target_timestamp = 1453132359.160000 # 替换为你要查找的时间戳 result = find_data_by_timestamp(GNSS_LIST, target_timestamp) if result: print(f"数据: 时间戳={target_timestamp}, 纬度={result[0]}, 经度={result[1]}, 高度={result[2]}") else: print("没有找到对应的时间戳数据。")
标签:puthon,timestamp,gnss,result,file,txt,data,row From: https://www.cnblogs.com/gooutlook/p/18400646