Conversation
96dfe77 to
5d859f8
Compare
5d859f8 to
408a137
Compare
|
Finally got this to pass the tests - the problem with not having done anything with |
|
This PR works for me; I will put an updated liberfa with that patch to our experimental release to play with astropy 4rc. |
|
They are defined in |
|
p.s Great to hear that tests pass, though!!!! |
Ah, I somehow missed that file in my patch. Sorry for confusion. |
|
Thanks for this, @mhvk! (and @olebole for the testing) I agree we need a release with this, but I'm a bit concerned about the prospect of including this in erfa before we've had a chance to have users exposed to it. What I would like to do is have a release that's clearly flagged as experimental which we might roll back if there's serious issues. @olebole - is there any practical path that would allow us to include a "temporary fork" in debian? Or do the version number requirements mean we are stuck with just following the standard release process? If it's going to be a substantial extra pain to do this, it's not worth it, but just wanted to ask how we might do it before committing to a "normal" release with this. |
|
@eteq - your comment makes me realize we really need to document the non-sofa extras... As a start, shall I use this PR to add a much longer comment in |
|
@eteq while this is technically possible (I could just create a patches version including the changes, as I already did on experimental, I am a bit afraid that this just moves the risk to Debian: |
|
(not all of erfaextras since we have some of the version stuff there, but just that it's a clear wall around where the user should look carefully for experimental things) |
|
Hmm, it still has the danger that I have to maintain an |
|
@olebole - the extra routines in But I think @eteq's suggestion is in fact to bundle those extra routines in I do hope that eventually we can provide a formal routine with |
|
@mhvk OK, I misunderstood the structure here. However, it is not clear to me how I should handle changes in |
src/erfadatextra.c
Outdated
| #include "erfaextra.h" | ||
|
|
||
| static eraLEAPSECOND *changes; | ||
| static int NDAT = 0; |
There was a problem hiding this comment.
Maybe this should be initialized with -1 (and tested for -1 in eraDatInit)? It may be an exotic case, but someone may want to switch off leap seconds at all by providing an empty list. I see no formal reason why this should be excluded.
There was a problem hiding this comment.
I agree it seems logical that one should be able to pass in NDAT=0, but a quick inspection of dat.c shows that for that case all calls with return error code -5.... Of course, even with just one no-op entry, you'd get warnings about dates being too far in the future, etc.
Overall, my sense is that it is best to keep this handle as simple as possible; that said, the least I can do is to use any NDAT <= 0 to initialize the table.
|
@olebole - I think we are indeed on the hook at being ultra-careful with changing the infrastructure here, and also ensuring that we get a bit better following SOFA so that packages that rely on sofa/erfa have up-to-date leap seconds even without our astropy work-arounds. |
|
@mhvk, I have no problem if there is a confirmation that the API will not change. Since Astropy 4.0 is going to be an LTS release, I need to maintain its work with Erfa for quite some time, so I think this interface must be somehow stable. That's why I am worried about the statement that these functions are "experimental". |
|
@olebole - indeed, we need to maintain an Of course, it probably is good to make this explicit! I'll do so. |
610a415 to
424ecc5
Compare
424ecc5 to
e42736d
Compare
|
@mhvk Thank you very much for your patience and the confirmation! I am happy with this solution. It is always great to see when doubts are taken seriously, even when they may look a bit insisting. That is a real pleasure to cooperate! |
|
Hello! In checking things that are holding up astropy 4.0 (astropy/astropy#9654), I ended up here. What is the timeline to get this merged and a new release? Thanks! |
|
I think this is ready to go in - @eteq, would you like a last look? |
eteq
left a comment
There was a problem hiding this comment.
This LGTM except that at this point I think we want tests. Working on that now.
|
Yes, indeed, tests would be good... In principle, if you're willing to test from python using numpy, you could grab the relevant parts of astropy/astropy#9329. Though likely a quick C routine is easier, knowing that fairly stringest tests are done in astropy... Eventually, it may still be easiest to move Anyway, let me know if I can help. |
|
@mhvk - I just pushed up some commits adding a couple of testing functions. However, the last one ( |
src/t_erfa_c_extra.c
Outdated
| eraLEAPSECOND new_leapsecond[1] = {{ 2050, 5, 35. }}; | ||
|
|
||
| count_init = eraGetLeapSeconds(&leapseconds_init); | ||
| eraSetLeapSeconds(&new_leapsecond, 1); |
There was a problem hiding this comment.
@eteq - eraSetLeapSeconds replaces the whole leap second table, so the expected number of leap seconds here is 1.
There was a problem hiding this comment.
Aha, that was the trouble! (that and an incorrect variable)
|
Alright, this is looking good now. I'm going to merge this and crank through an ERFA release shortly. Thanks @mhvk |
This builds on #49 to allow accessing and replacing the leap second table, using the implementation we ended up using in astropy.
@eteq - I fear we do have to ship with this, noting this is experimental... But I think it is the right building block to add a way of updating leap seconds inside
erfahere.@olebole - if you can, could you check that this PR does make an external liberfa work with astropy 4.0?