readgssi.gps (ingest GPS info)

Reads GPS information from DZG files.


Deprecated since version 0.0.12.

This function returns the NMEA message variables shared by both RMC and GGA.


msg (pynmea2.nmea.NMEASentence) – A pynmea2 sentence object.

Return type

datetime.datetime, float, float

readgssi.gps.pause_correct(header, dzg_file, threshold=0.25, verbose=False)

This is a streamlined way of removing pauses from DZG files and re-assigning trace values. GSSI controllers have a bug in which GPS sentences are collected with increasing trace numbers even though radar trace collection is stopped. This results in a misalignment between GPS and radar traces of the same number. This function attempts to realign the trace numbering in the GPS file by identifying stops via a calculated velocity field.

Disclaimer: this function will identify and remove ALL pauses longer than 3 epochs and renumber the traces accordingly. Obviously this can have unintended consequences if the radar controller remains collecting data during these periods. Please be extremely cautious and only use this functionality on files you know have radar pauses that are accompanied by movement pauses. A backup of the original DZG file is made each time this function is run on a file, which means that if you make a mistake, you can simply copy the DZG backup (.DZG.bak) and overwrite the output (.DZG).

Any time you are working with original files, it is always good to have a “working” and “raw” copy of your data. Experimental functionality in readgssi cannot be held responsible for its actions in modifying data. You are responsible for keeping a raw backup of your data just in case.

A detailed explanation of each step taken by this function is available in the code comments.

  • header (dict) – File header produced by readgssi.dzt.readdzt()

  • dzg_file (str) – DZG GPS file (the original .DZG, not the backup)

  • threshold (float) – Numerical velocities threshold, under which will be considered a “pause”

  • verbose (bool) – Verbose, defaults to False

Return type

corrected, de-paused GPS data (pandas.DataFrame)

readgssi.gps.readdzg(fi, frmt, header, verbose=False)

A parser to extract gps data from DZG file format. DZG contains raw NMEA sentences, which should include at least RMC and GGA.

NMEA RMC sentence string format: $xxRMC,UTC hhmmss,status,lat DDmm.sss,lon DDDmm.sss,SOG,COG,date ddmmyy,checksum *xx

NMEA GGA sentence string format: $xxGGA,UTC hhmmss.s,lat DDmm.sss,lon DDDmm.sss,fix qual,numsats,hdop,mamsl,wgs84 geoid ht,fix age,dgps sta.,checksum *xx

Shared message variables between GGA and RMC: timestamp, latitude, and longitude

RMC contains a datestamp which makes it preferable, but this parser will read either.

  • fi (str) – File containing gps information

  • frmt (str) – GPS information format (‘dzg’ = DZG file containing gps sentence strings (see below); ‘csv’ = comma separated file with: lat,lon,elev,time)

  • header (dict) – File header produced by readgssi.dzt.readdzt()

  • verbose (bool) – Verbose, defaults to False

Return type

GPS data (pandas.DataFrame)

The dataframe contains the following fields: * datetimeutc (datetime.datetime) * trace (int trace number) * longitude (float) * latitude (float) * altitude (float) * velocity (float) * sec_elapsed (float) * meters (float meters traveled)