44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
|
import pyproj
|
||
|
import pandas as pd
|
||
|
|
||
|
"""
|
||
|
input:
|
||
|
ecef_file:输入文件路径
|
||
|
format: 0:tow
|
||
|
1:ecef_x
|
||
|
2:ecef_y
|
||
|
3:ecef_z
|
||
|
output:
|
||
|
ouputpath:输出文件路径
|
||
|
format: 0:tow
|
||
|
1:lat
|
||
|
2:lon
|
||
|
"""
|
||
|
|
||
|
ecef_file = "/Users/wakanda_shaw/Library/Mobile Documents/com~apple~CloudDocs/GNSS文献/LG69T/2022630/630_3/PVT.csv"
|
||
|
output_path = "./llh.csv"
|
||
|
|
||
|
ecef = pd.read_csv(ecef_file)
|
||
|
|
||
|
transformer = pyproj.Transformer.from_crs(
|
||
|
{"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'},
|
||
|
{"proj":'latlong', "ellps":'WGS84', "datum":'WGS84'},
|
||
|
)
|
||
|
|
||
|
lat = []
|
||
|
lon = []
|
||
|
tow = []
|
||
|
|
||
|
for i in range(len(ecef)):
|
||
|
x = ecef.iloc[i,1]
|
||
|
y = ecef.iloc[i,2]
|
||
|
z = ecef.iloc[i,3]
|
||
|
time = ecef.iloc[i,0]
|
||
|
lon1, lat1, alt1 = transformer.transform(x,y,z,radians=False)
|
||
|
lat.append(lat1)
|
||
|
lon.append(lon1)
|
||
|
tow.append(time)
|
||
|
|
||
|
csv = pd.DataFrame([tow,lat,lon]).T
|
||
|
csv.to_csv(output_path,index=None,header=False,float_format='%.10f')
|