资源简介
把GNSSLogger获取到的原始数据文件转换为rinex格式的数据文件。
代码片段和文件信息
#!/usr/bin/env python
“““
Tool to convert from logfile of GPS-measurements to RINEX format
“““
import argparse
import datetime
import math
import sys
# Define constants
SPEED_OF_LIGHT = 299792458.0; # [m/s]
GPS_L1_FREQ = 154.0 * 10.23e6
GPS_L1_WAVELENGTH = SPEED_OF_LIGHT / GPS_L1_FREQ
GPS_WEEKSECS = 604800 # Number of seconds in a week
NS_TO_S = 1.0e-9
NS_TO_M = NS_TO_S * SPEED_OF_LIGHT # Constant to transform from nanoseconds to meters
# Origin of the GPS time scale
GPSTIME = datetime.datetime(1980 1 6)
# Flags to check wether the measurement is correct or not
# https://developer.android.com/reference/android/location/GnssMeasurement.html#getState()
STATE_CODE_LOCK = int(0x00000001)
STATE_TOW_DECODED = int(0x00000008)
# Constellation types
CONSTELLATION_GPS = 1
CONSTELLATION_SBAS = 2
CONSTELLATION_GLONASS = 3
CONSTELLATION_QZSS = 4
CONSTELLATION_BEIDOU = 5
CONSTELLATION_UNKNOWN = 0
def get_raw_field_descr_from_header(file_handler):
“““
Get the raw field descriptors of the GNSS Logger log. These field descriptors
will be later used to identify the data.
This method advances the file pointer past the line where the raw fields
are described
“““
for line in file_handler:
# Check if the line is the line containing the field descriptors of the
# “Raw“ lines
if line.startswith(“# Raw“):
return [f.strip() for f in line[2:].strip().split(‘‘)[1:]]
def check_state(state):
“““
Checks if measurement is valid or not based on the Sync bits
“““
if (state & STATE_CODE_LOCK) == 0:
raise Exception(“State [ 0x{0:2x} {0:8b} ] has STATE_CODE_LOCK [ 0x{1:2x} {1:8b} ] not valid“.format(state STATE_CODE_LOCK))
if (state & STATE_TOW_DECODED) == 0:
raise Exception(“State [ 0x{0:2x} {0:8b} ] has STATE_TOW_DECODED [ 0x{1:2x} {1:8b} ] not valid“.format(state STATE_TOW_DECODED))
return True
def check_rinex_field(name value size):
“““
Checks if the field is of proper length and if not it issues a
warning message and returns a sanitized (cropeed) version of the
field
“““
if value is None:
return “UNKN“
if (len(value) > size):
sys.stderr.write(“The ‘{0}‘ field [ {1} ] is too long [ {2} ]. Cropping to {3} characters\n“.format(name value len(value) size))
return value[0:size]
return value
def rinex_header(runby=None marker=None observer=None agency=None
receiver=None rxtype=None version=‘Android OS >7.0‘
antenna=None anttype=‘internal‘
approx_position=[000] antenna_hen=[0.0 0.0 0.0]):
“““
Print RINEX header as a string
The fields are the ones specified in the RINEX format definition that can
be found at:
https://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt
“““
VERSION = 2.11
TYPE = ‘OBSERVATION DATA‘
SATSYS = ‘M (MIXED)‘
# Version line
h = “{0:9.2f} {1:<
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-08-29 06:36 android_rinex-master\
文件 1312 2017-08-29 06:36 android_rinex-master\LICENSE
文件 2452 2017-08-29 06:36 android_rinex-master\README.md
文件 17224 2017-08-29 06:36 android_rinex-master\android_to_rinex.py
目录 0 2017-08-29 06:36 android_rinex-master\data\
文件 5373110 2017-08-29 06:36 android_rinex-master\data\pseudoranges_log_2017_07_17_13_46_25.txt
- 上一篇:基于JSP的会议管理系统
- 下一篇:Android平台OCR工具TessTwo工程
评论
共有 条评论