Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Astropy with stations that don't have an internet connection #154

Closed
Tracked by #153
dostuffthatmatters opened this issue Feb 17, 2023 · 3 comments · Fixed by #166
Closed
Tracked by #153

Issue with Astropy with stations that don't have an internet connection #154

dostuffthatmatters opened this issue Feb 17, 2023 · 3 comments · Fixed by #166
Assignees
Labels
scope:camtracker status:implemented has been implemented in some dev branch

Comments

@dostuffthatmatters
Copy link
Member

Happening on stations, that don't have internet.

2023-02-15 00:00:07.681125 UTC+0 - main - EXCEPTION - ValueError occured: Traceback (most recent call last):

  File "C:\Users\CEA P-Saclay\Documents\pyra\pyra-4.0.6\packages\core\main.py", line 116, in run
    m.run(config)

  File "C:\Users\CEA P-Saclay\Documents\pyra\pyra-4.0.6\packages\core\modules\opus_measurement.py", line 78, in run
    self.automated_process_handling()

  File "C:\Users\CEA P-Saclay\Documents\pyra\pyra-4.0.6\packages\core\modules\opus_measurement.py", line 276, in automated_process_handling
    if not self.low_sun_angle_present():

  File "C:\Users\CEA P-Saclay\Documents\pyra\pyra-4.0.6\packages\core\modules\opus_measurement.py", line 265, in low_sun_angle_present
    sun_angle_is_low: bool = utils.Astronomy.get_current_sun_elevation().is_within_bounds(

  File "C:\Users\CEA P-Saclay\Documents\pyra\pyra-4.0.6\packages\core\utils\astronomy.py", line 23, in get_current_sun_elevation
    sun_angle_deg = sun.transform_to(altaz).alt

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\coordinates\sky_coordinate.py", line 675, in transform_to
    new_coord = trans(self.frame, generic_frame)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\coordinates\transformations.py", line 1479, in __call__
    curr_coord = t(curr_coord, curr_toframe)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\coordinates\transformations.py", line 1079, in __call__
    return supcall(fromcoord, toframe)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\coordinates\builtin_frames\icrs_observed_transforms.py", line 30, in icrs_to_observed
    astrom = erfa_astrom.get().apco(observed_frame)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\coordinates\erfa_astrom.py", line 53, in apco
    era = erfa.era00(*get_jd12(obstime, 'ut1'))

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\coordinates\builtin_frames\utils.py", line 118, in get_jd12
    newtime = getattr(time, scale)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\time\core.py", line 1336, in __getattr__
    tm._set_scale(attr)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\time\core.py", line 584, in _set_scale
    args.append(get_dt(jd1, jd2))

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\time\core.py", line 2051, in _get_delta_ut1_utc
    delta = iers_table.ut1_utc(jd1, jd2)

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\utils\iers\iers.py", line 281, in ut1_utc
    return self._interpolate(jd1, jd2, ['UT1_UTC'],

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\utils\iers\iers.py", line 414, in _interpolate
    self._check_interpolate_indices(i1, i, np.max(mjd))

  File "C:\Users\CEA P-Saclay\AppData\Local\Programs\Python\Python310\lib\site-packages\astropy\utils\iers\iers.py", line 712, in _check_interpolate_indices
    raise ValueError(INTERPOLATE_ERROR.format(auto_max_age))

ValueError: interpolating from IERS_Auto using predictive values that are more
than 30.0 days old.

Normally you should not see this error because this class
automatically downloads the latest IERS-A table.  Perhaps you are
offline?  If you understand what you are doing then this error can be
suppressed by setting the auto_max_age configuration variable to
``None``:

  from astropy.utils.iers import conf
  conf.auto_max_age = None
@dostuffthatmatters
Copy link
Member Author

Here is the relevant section in the Astropy documentation: https://docs.astropy.org/en/stable/utils/iers.html#working-offline

@dostuffthatmatters dostuffthatmatters added status:in-progress is being work on in some dev branch and removed status:planned is assigned to a specific milestone labels Feb 17, 2023
@dostuffthatmatters
Copy link
Member Author

dostuffthatmatters commented Feb 19, 2023

We could also switch to https://github.com/arthur-e/suntransit since we don't need a high precision. https://arthur-e.github.io/suntransit/#__init__.sunrise_sunset does exactly what we want it to do.

Or https://github.com/sffjunkie/astral that also has the function we want: https://sffjunkie.github.io/astral/package.html#astral.sun.time_at_elevation

@dostuffthatmatters
Copy link
Member Author

I finally have an update on this:

We should use the skyfield library (https://github.com/skyfielders/python-skyfield/) and pick a suitable astronomical dataset from this list: https://ssd.jpl.nasa.gov/planets/eph_export.html

The later datasets (DE440, etc.) are probably bigger since they cover more years, so we should pick an earlier one that covers enough years into the future without being too big and include that in the repository (hence, the release).

dostuffthatmatters added a commit that referenced this issue May 2, 2023
improve astronomy class
dostuffthatmatters added a commit that referenced this issue May 2, 2023
improve the way of passing the config to the astronomy class
dostuffthatmatters added a commit that referenced this issue May 2, 2023
use skyfield instead of astropy
dostuffthatmatters added a commit that referenced this issue May 2, 2023
add astronomical dataset to repository
remove astropy dependency
dostuffthatmatters added a commit that referenced this issue May 2, 2023
test astronomy class
dostuffthatmatters added a commit that referenced this issue May 2, 2023
debug mypy things, close #154
dostuffthatmatters added a commit that referenced this issue May 3, 2023
improve astronomy class
dostuffthatmatters added a commit that referenced this issue May 3, 2023
improve the way of passing the config to the astronomy class
dostuffthatmatters added a commit that referenced this issue May 3, 2023
use skyfield instead of astropy
dostuffthatmatters added a commit that referenced this issue May 3, 2023
add astronomical dataset to repository
remove astropy dependency
dostuffthatmatters added a commit that referenced this issue May 3, 2023
test astronomy class
dostuffthatmatters added a commit that referenced this issue May 3, 2023
debug mypy things, close #154
@dostuffthatmatters dostuffthatmatters mentioned this issue May 3, 2023
11 tasks
dostuffthatmatters added a commit that referenced this issue May 3, 2023
improve astronomy class
dostuffthatmatters added a commit that referenced this issue May 3, 2023
improve the way of passing the config to the astronomy class
dostuffthatmatters added a commit that referenced this issue May 3, 2023
use skyfield instead of astropy
dostuffthatmatters added a commit that referenced this issue May 3, 2023
add astronomical dataset to repository
remove astropy dependency
dostuffthatmatters added a commit that referenced this issue May 3, 2023
test astronomy class
dostuffthatmatters added a commit that referenced this issue May 3, 2023
debug mypy things, close #154
dostuffthatmatters added a commit that referenced this issue May 9, 2023
improve astronomy class
dostuffthatmatters added a commit that referenced this issue May 9, 2023
improve the way of passing the config to the astronomy class
dostuffthatmatters added a commit that referenced this issue May 9, 2023
use skyfield instead of astropy
dostuffthatmatters added a commit that referenced this issue May 9, 2023
add astronomical dataset to repository
remove astropy dependency
dostuffthatmatters added a commit that referenced this issue May 9, 2023
test astronomy class
@dostuffthatmatters dostuffthatmatters added status:implemented has been implemented in some dev branch and removed status:in-progress is being work on in some dev branch labels May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:camtracker status:implemented has been implemented in some dev branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant