How to use the gpstime.UTCFromGps function in gpstime

To help you get started, we’ve selected a few gpstime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dshean / sfm_tools / px4_dflog_gps2utc.py View on Github external
#Deal with fact that field names are different for GPS and CAM records: 'GPS_Week' vs 'CAM_GPSWeek'
if any('CAM' in s for s in x.dtype.names):
    week = 'CAM_GPSWeek'
    time = 'CAM_GPSTime'
    lat = 'CAM_Lat'
    lon = 'CAM_Lng'
    alt = 'CAM_Alt'
else:
    week = 'GPS_Week'
    time = 'GPS_TimeMS'
    lat = 'GPS_Lat'
    lon = 'GPS_Lng'
    alt = 'GPS_Alt'
    
#Note: Need to fix gpstime UTCFromGps function to work with np arrays
utc = [gpstime.UTCFromGps(z[0], z[1]) for z in zip(x[week], x[time]/1000.)]
#Note: gpsbabel needs the ISO format, otherwise can't handle sub-second
utc_dt = np.array([datetime(*t).isoformat() for t in utc])
y = np.array([utc_dt, x[lat], x[lon], x[alt]])

hdr = 'DateTime,Lat,Lon,Elev'
#np.savetxt(out_fn, y.T, delimiter=',', fmt='%s,%0.8f,%0.8f,%0.2f', header=hdr, comments='')
np.savetxt(out_fn, y.T, delimiter=',', fmt='%s', header=hdr, comments='')

gpstime

GPS-aware datetime module

GPL-3.0
Latest version published 6 months ago

Package Health Score

58 / 100
Full package analysis