pytroll / pygac

A python package to read and calibrate NOAA and Metop AVHRR GAC and LAC data
https://pygac.readthedocs.org/
GNU General Public License v3.0
20 stars 25 forks source link

Reduce rounding error in POD reader adjust clock drift #80

Closed carloshorn closed 3 years ago

carloshorn commented 4 years ago

The following lines introduce a larger rounding error than necessary: https://github.com/pytroll/pygac/blob/5c59f2be9437ad7bfc0005038f45f8416d10828d/pygac/pod_reader.py#L436-L437

Here, self.utcs is an array of type 'datetime64[ms]', and offset is an array of floating point numbers giving seconds, which requires a conversion to a time delta. However, the conversion to 'timedelta64[s]' strips of the fraction of seconds. In order to stay at the same precision level, the conversion to a time delta should be changed to (1000*offsets).astype('timedelta64[ms]').