GNSSpy-Project / gnsspy

Python Toolkit for GNSS Data
MIT License
179 stars 74 forks source link

Fraction of second of the observation time is truncated when rinex is read #21

Open AGTM19 opened 1 year ago

AGTM19 commented 1 year ago

First of all: Thank you for providing this library!

In the file readFile.py lines 503-508 are the conversion of the date-string to a datetime.datetime object. The fraction of the second is truncated there. However, with real receiver data, it cannot be assumed that the observation is actually done at a full second. This yields the error that a observation at second 14.996000 will end up as 14.0000000. I suggest to change the existing code:

            epoch = datetime.datetime(year = int(epoch_year), 
                                    month = int(epoch_month),
                                    day = int(epoch_day),
                                    hour = int(epoch_hour),
                                    minute = int(epoch_minute),
                                    second = int(float(epoch_second)))

To something like:

            epoch_second_float = float(epoch_second)
            epoch_second_int = int(epoch_second_float)
            epoch = datetime.datetime(year = int(epoch_year),
                                    month = int(epoch_month),
                                    day = int(epoch_day),
                                    hour = int(epoch_hour),
                                    minute = int(epoch_minute),
                                    second = epoch_second_int,
                                    microsecond = int(1000000 * (epoch_second_float - epoch_second_int)))