Skip to content

Automatic download of IERS A table for times not covered by IERS B #3275

Closed

Description

@mhvk

It has turned out to be very confusing to users (and us!) that Time cannot calculate the sidereal time for times around now or in the near future. For this purpose, the IERS A table can be used with some handy-work [1], but this could and probably should be automated. One question is the extent to which this should be completely automatic -- the file is not exactly small. Another question is what should happen for times further in the future. Possibly sidereal_time at least could have an option sloppy=True where future leap seconds and earth rotation are ignored.

[1] http://docs.astropy.org/en/latest/time/index.html#transformation-offsets

Activity

  1. mhvk commented on Nov 2, 2015

    @mhvk
    ContributorAuthor

    Some implementation comments: #3274 (comment)

    This would be very important. Neither @taldcroft nor @mhvk feels qualified to do this.

  2. mhvk commented on Nov 2, 2015

    @mhvk
    ContributorAuthor

    The same mechanism could be used for leap seconds (#350), though that is covered generally by erfa updates (but that requires people to be good about point releases).

    See in particular #350 (comment)

  3. eteq commented on Dec 16, 2015

    @eteq
    Member

    A relevant mailing list exchange:

    The short answer here is that it probably should work just the way you're thinking, but that hasn't been implemented yet. See #3275 for some background.

    The longer answer is that it's not entirely clear how often they should be downloaded. In theory it should be downloaded every time, because the IERS A predictions are based on earth-based observations, and so they are updated at irregular intervals (~1 week). For almost all applications, the predictions are more than good enough up to the end of when they're valid (I think that's 21 days, although I can't recall for sure).

    So probably the best solution, and one that would be nice to have in Astropy would be to have the IERS A be cached in a way that expires after maybe a week or so, and is only re-downloaded after that. Unfortunately, that requires some changes to the caching machinery, which we simply haven't had time to do. But certainly anyone is welcome to take a shot at getting this in for Astropy 1.2 - I would love to see it, personally, and might get to it, but I say that about a lot of things...

    Erik T

    On Tue, Dec 1, 2015 at 6:10 PM, Josh Walawender [email protected] wrote:
    Hi all,

    I’m getting some behavior I don’t understand from astropy.time. I’m trying to make a quick tool for printing out the current time in UT, MJD, and sidereal (LMST). When I run it, I get an error on the step of calculating the sidereal time:

    LST_string = now.sidereal_time('mean').to_string(sep=':', precision=1)

    Traceback (most recent call last):
    File "time_example.py", line 20, in
    LST_string = now.sidereal_time('mean').to_string(sep=':', precision=1)
    File "/Users/joshw/anaconda/lib/python2.7/site-packages/astropy/time/core.py", line 523, in sidereal_time
    gst = self._erfa_sidereal_time(available_models[model.upper()])
    File "/Users/joshw/anaconda/lib/python2.7/site-packages/astropy/time/core.py", line 539, in _erfa_sidereal_time
    for jd_part in ('jd1', 'jd2')]
    File "/Users/joshw/anaconda/lib/python2.7/site-packages/astropy/time/core.py", line 704, in getattr
    tm._set_scale(attr)
    File "/Users/joshw/anaconda/lib/python2.7/site-packages/astropy/time/core.py", line 372, in _set_scale
    args.append(get_dt(jd1, jd2))
    File "/Users/joshw/anaconda/lib/python2.7/site-packages/astropy/time/core.py", line 834, in _get_delta_ut1_utc
    delta = iers_table.ut1_utc(jd1, jd2)
    File "/Users/joshw/anaconda/lib/python2.7/site-packages/astropy/utils/iers/iers.py", line 234, in ut1_utc
    raise IndexError('(some) times are outside of range covered '
    IndexError: (some) times are outside of range covered by IERS table.

    When I go ahead and download the IERS table using the tools in astroplan:

    from astroplan import download_IERS_A
    download_IERS_A()

    the code works. But I need to do this download every time I run the code which is time consuming on code that I want to run many times. Shouldn’t this be cached?

    Any idea why the download is needed every time?

    thanks!
    Josh

  4. taldcroft commented on Dec 17, 2015

    @taldcroft
    Member

    As mentioned we're looking for volunteers. But if nobody steps up in the next month or two I will put this on my plate for astropy 1.2 and see if I can put together something that fills this need.

  5. embray commented on Dec 21, 2015

    @embray
    Member

    So probably the best solution, and one that would be nice to have in Astropy would be to have the IERS A be cached in a way that expires after maybe a week or so, and is only re-downloaded after that. Unfortunately, that requires some changes to the caching machinery, which we simply haven't had time to do.

    This aspect would be solved for free if someone worked on #3961. If there are aspects to this specific to IERA data that can be worked on separately, or solved easily in the near term that's fine too. But in general if you want the cache to be updated when it's appropriate to do so #3961 is your answer, not an ad-hoc expiration time.

  6. taldcroft commented on Dec 31, 2015

    @taldcroft
    Member

    @mhvk - I'm having a look at this. I do not have the time or inclination to do #3961, but I think that our problem is much simpler because we have prior knowledge of update cycle for the bulletins.

    My first question is more basic: can we just use IERS-A always? I don't have a full understanding of everything in the A and B bulletins, but it appears that A is a superset of B (at least for how it gets used in astropy). In particular the fact that the B values for UT1_UTC, PM_X, and PM_Y are included in A seems good. If we could always use IERS-A then that would allow significant simplification and take away this distinction which is confusing for non-experts.

  7. taldcroft commented on Dec 31, 2015

    @taldcroft
    Member

    OK, I do now see that the B values start in 1962 vs the A values in 1973. That could be easily handled in a way that is transparent to users.

  8. mhvk commented on Jan 4, 2016

    @mhvk
    ContributorAuthor

    @taldcroft - I think using IERS B values from the IERS A bulletins should be fine (although, annoyingly, I don't think they have the same number of significant digits; I recall finding that, therefore, entries were not strictly identical). The main reason I stuck to IERS B is that I wanted to ensure that by default, one either got a reproducible result or none at all, i.e., I wanted to avoid using predictions without explicit opt-in from the user. Obviously, though, even with IERS A tables, things could be set up to behave that way. Still, my sense would be for our releases to keep providing IERS B, as the one formally approved.

    Overall, I remain a bit torn about the approach. On the one hand, I think you are right that our case is at least partially independent of specific caching mechanisms. Essentially, we have:

    1. If time < iers['MJD'][-1], use current version.
    2. If time < Time.now() - 2 months and a week or so, updated IERS B would suffice, and the update seems guaranteed to work, so no risk of repeated trials at downloading a new version that doesn't improve the situation.
    3. If time < Time.now() + 1 month (or so?), need IERS A.

    This suggests one could one could start with getting 2. to work.

    On the other hand, from a quick look at #3961, it does seem that, really, astropy should just use CacheControl (replacing its own caching mechanism, which I think you have been finding to be somewhat less than robust anyway...) and this would quite trivially solve the present issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions