0

I have data exported from a minimax GPS files. The GPS time exported appears to be in GPS seconds of week format and recorded every ~ 0.1 seconds.

 data <- structure(c(243.32, 243.33, 243.34, 243.35, 243.36, 243.37, 243.38, 
                    243.39, 243.4, 243.41, 243.42, 243.43, 243.44, 243.45, 243.46, 
                    243.47, 243.48, 243.49, 243.5, 243.51, 243.52, 243.53, 243.54, 
                    243.55, 243.56, 243.57, 243.58, 243.59, 243.6, 243.61, 243.62, 
                    243.63, 243.64, 243.65, 243.66, 243.67, 243.68, 243.69, 243.7, 
                    243.71, 243.72, 243.73, 243.74, 243.75, 243.76, 243.77, 243.78, 
                    243.79, 243.8, 243.81, 243.82, 243.83, 243.84, 243.85, 243.86, 
                    243.87, 243.88, 243.89, 243.9, 243.91, 243.92, 243.93, 243.94, 
                    243.95, 243.96, 243.97, 243.98, 243.99, 244, 244.01, 244.02, 
                    244.03, 244.04, 244.05, 244.06, 244.07, 244.08, 244.09, 244.1, 
                    244.11, 244.12, 244.13, 244.14, 244.15, 244.16, 244.17, 244.18, 
                    244.19, 244.2, 244.21, 244.22, 244.23, 244.24, 244.25, 244.26, 
                    244.27, 244.28, 244.29, 244.3, 244.31, 244.32, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 
                    18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, 18.2, NA, 
                    NA, NA, NA, NA, NA, NA, 165350.6, NA, NA, NA, NA, NA, NA, NA, 
                    NA, NA, 165350.7, NA, NA, NA, NA, NA, NA, NA, NA, NA, 165350.8, 
                    NA, NA, NA, NA, NA, NA, NA, NA, NA, 165350.9, NA, NA, NA, NA, 
                    NA, NA, NA, NA, NA, 165351, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
                    165351.1, NA, NA, NA, NA, NA, NA, NA, NA, NA, 165351.2, NA, NA, 
                    NA, NA, NA, NA, NA, NA, NA, 165351.3, NA, NA, NA, NA, NA, NA, 
                    NA, NA, NA, 165351.4, NA, NA, NA, NA, NA, NA, NA, NA, NA, 165351.5, 
                    NA, NA, NA), .Dim = c(101L, 3L), .Dimnames = list(NULL, c("Time", 
                                                                              "StRate", "GPStime")))

I need to match up the GPS time from this file with GPS time on another file which is in UTC format %Y/%m/%d %H:%M:%S. I am able to convert the gps time in the code above to UTC format using an online calculator, by putting in GPS week and GPS seconds of week. What I am wondering is if there is a quick way to convert GPS seconds of the week to UTC time in R, as I have many different files from different weeks
Thanks

wattss
  • 61
  • 5
  • Can you add data using `dput` ? – Ronak Shah May 26 '20 at 04:33
  • @RonakShah updated questions. – wattss May 26 '20 at 07:00
  • Are you looking for `as.POSIXct(data[, 3], origin = '1970-01-01', tz = 'UTC')` ? – Ronak Shah May 26 '20 at 07:06
  • Can you show what would be your expected output? – Ronak Shah May 26 '20 at 07:38
  • The date returned is not the date the session was completed on. `"1970-01-02 21:55:50 UTC" ` is what is returned, when it should be `"2019-05-06 21:55:50 UTC"` . @RonakShah – wattss May 26 '20 at 07:45
  • How do you know the date is supposed to be `"2019-05-06"` ? Do you need `as.POSIXct(data[, 3], origin = '2019-05-05', tz = 'UTC')` – Ronak Shah May 26 '20 at 07:47
  • The program I use for the gps file has the date of the session e.g. 07May19. However when I export all the gps data into a csv file, the `GPStime` only gives the GPS seconds of the week. I can manually look up the GPS week for a session and use the GPS time in seconds in an online calculator to get GPS time in UTC. [link](https://www.labsat.co.uk/index.php/en/gps-time-calculator). But this seems a tedious process. @RonakShah – wattss May 26 '20 at 08:07
  • hmm...I don't get the formula of how `GPStime` is used to convert UTC time even using the online calculator. – Ronak Shah May 26 '20 at 08:57
  • Yes me either. If I had a formula then I would be able to use it, and change the GPS week depending on the session. But I can't seem to find a formula anywhere that uses GPS week and GPS seconds of week to calculate UTC time. – wattss May 26 '20 at 09:05

0 Answers0