Comments (9)
Just to close the loop here - after puzzlement on all sides, the conclusion is that this is indeed a SOFA bug, which will be fixed in the next SOFA release (possibly as a bug-fix release, TBD). It is nice to see how bugs found via astropy continue to help upstream too! Good that you realized things were unexpected, @taldcroft!
from erfa.
This is fixed in SOFA 17a, released today.
from erfa.
I think pre-1972 and per leap seconds, the clocks were allowed to drift; see
Lines 239 to 240 in 55fbff2
I think given that drift, it would be unavoidable to sometimes get 60 seconds (but it would not be a full second).
from erfa.
I thought that while the UTC scale was allowed to drift that the UTC representation of the time was, by definition, always having seconds < 60. In other words there was not yet this idea of letting there be more than 60 UTC seconds in a minute.
But in truth I'm not an expert here, especially on the historical side. Here is a different demonstration of what seems unexpected to me:
In [22]: t
Out[22]: <Time object: scale='utc' format='iso' value=1960-01-03 00:00:00.000>
In [23]: erfa.d2dtf('UTC', 6, t.jd1, t.jd2)
Out[23]: (1960, 1, 3, (0, 0, 0, 0))
In [24]: erfa.d2dtf('UTC', 6, t.jd1, t.jd2 - 20e-12/86400)
Out[24]: (1960, 1, 2, (23, 59, 60, 0))
In [25]: t.jd1
Out[25]: 2436936.0
In [26]: t.jd2
Out[26]: 0.5
Clearly when you subtract 20 picosec from the midnight, the year/mon/day hr/min/sec representation to the nearest microsec should not change at all. Instead it is rounding 59.999999999 to 60.0 but not recognizing that this should then wrap to 1960-01-03 00:00:00.000000.
from erfa.
Doesn't UTC require that a minute can have between 59 and 61 seconds in it? So if there is a leap second added that does mean that the seconds will indicate 60.
See for example https://www.iausofa.org/2021_0125_C/sofa/sofa_ts_c.pdf page 14.
from erfa.
Hmm, I think you are right that there is a bug: the code dealing with times beyond 24 hours considers any jump a leap second, however small:
Lines 121 to 129 in 55fbff2
Here leap
is a boolean for dleap != 0
. My sense is that the comment "is this a leap-second day" tells that the intention is to deal with regular (mini) leap seconds, not ones as small as dleap=1.11022e-16
, which is what I find by inserting a print statement. Especially since this equals 2**-53, suspiciously close to what you get for a rounding error for subtracting 0.5 from something that is just one bit off. (np.finfo(np.float).eps
is 2.220446049250313e-16).
from erfa.
I've sent an e-mail to Patrick Wallace to ask about this...
from erfa.
Great sleuthing @mhvk!
from erfa.
fixed by the update to erfa 1.7.3
from erfa.
Related Issues (20)
- Make a way to use local device's leap second information
- ERFA 1.7 still has version number 1.6!? HOT 2
- Fix README.rst -- update release info HOT 6
- Porting ERFA to different languages - licensing HOT 17
- starpm does not work for moderate proper motion/no parallax case HOT 1
- Update to match SOFA 20200721
- Have links in docs/README to other languages?
- change in header files to make things better for C++? HOT 4
- Update to SOFA 17a HOT 2
- Should macros in erfam.h be considered part of the API? HOT 1
- Auto-update zenodo HOT 1
- why use fmod in calculating Fundamental arguments in eraNut80?
- Wrong result from d2dtf() in pre-1972 UTC
- d2dtf(), dtf2d(), utctai(), dat(): Inexact table and method of detecting jump HOT 13
- proposal: use integer times internally HOT 8
- Single-precision floating-point level rounding errors when using pmsafe HOT 44
- Need to update to SOFA 19 HOT 2
- Check version number consistency on updates
- Question on tai to utc conversion HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erfa.