Skip to main content

Data package for Skyfield

Project description

Data files for Skyfield

Build Status | CircleCI

Rationale

Skyfield is a Python library for astronomical computations. It depends on various data files to accurately compute moon phases, planet positions, etc.

Several issues are raised by these data files:

  • If they're not found in the path of the Loader, they're downloaded at runtime. Depending on the archive you're requesting, some files might be very large, causing a long delay (directly related to your network bandwidth). In the case of a web server app, you'd cause a timeout on client's end.
  • They come mainly from 3 sources: the USNO (US Navy), Paris (Meudon) Observatory, and NASA JPL. If one of them is temporarily unavailable, you couldn't perform any computation.
  • In some countries, or behind some filtering proxies, the USNO is considered as a military website, and thus is blocked.
  • These files have an expiration date (in a more or less distant future). As a consequence, even if the files are already downloaded in the right path, at each runtime you could possibly have to download one or more files before making any computation using them.

Currently known expiration dates

File Date
Leap_Second.dat 2021-07-28
de421.bsp 2053-10-08

Deprecation warning: As of python-skyfield>=1.31, deltat.data and deltat.preds files are not used anymore. They were not maintained anymore, and Brandon Rhodes switched to other source files for ∆T computations.

Goal for this project

  • Providing at least the most common of these assets in Python Package.
  • Make regular releases to refresh the files before they expire.
  • Provide a warning / logging mechanism when the files are about to expire (or when they are outdated) to still allow you to compute things with the loaded assets, but being informed you need to upgrade.

This way, you could install or upgrade this data package via pip.

Once all the files are on your disk space, you can instantiate your skyfield loader pointing at their path, without having to worry about anything.

Usage

Install the packages using:

pip install skyfield skyfield-data

To create a custom Skyfield loader, use the following code:

from skyfield_data import get_skyfield_data_path
from skyfield.api import Loader
load = Loader(get_skyfield_data_path())
planets = load('de421.bsp')  # this command won't download this file
ts = load.timescale()  # this command won't download the IERS + Leap Second files

If you want to make sure that the data files would never be downloaded, you can also use the expire option like this:

load = Loader(get_skyfield_data_path(), expire=False)

Whenever a file contained in the catalog has expired, you're going to receive a warning when loading the skyfield-data path:

>>> from skyfield_data import get_skyfield_data_path
>>> from skyfield.api import Loader
>>> load = Loader(get_skyfield_data_path())
/home/[redacted]/skyfield_data/expirations.py:25: RuntimeWarning: The file de421.bsp has expired. Please upgrade your version of `skyfield-data` or expect computation errors
  RuntimeWarning

By default, the loading isn't blocked, but it's strongly recommended to upgrade to a more recent version, to make sure you're not going to make wrong astronomical computations.

Custom limit

By default, the RuntimeWarning is raised when the file has expired. You may want to be aware of this warning in advance, that is to say a few days or weeks before, in order to eventually upgrade your version of skyfield-data.

In order to trigger this warning, you can use the expiration_limit argument, like this:

>>> from skyfield_data import get_skyfield_data_path
>>> from skyfield.api import Loader
>>> load = Loader(get_skyfield_data_path(expiration_limit=30))
/home/[redacted]/skyfield_data/expirations.py:25: RuntimeWarning: The file de421.bsp would expire in less than 30 days. Please upgrade your version of `skyfield-data` or expect computation errors
  RuntimeWarning

Note: The expiration_limit argument should be a positive integer (or zero).

Developers

We assume that you'll be using a Python3.6+ version for all regular operations.

We're providing a Makefile with basic targets to play around with the toolkit. use make help to get more details.

In order to be able to run the download.py script, we recommend to run it from a virtualenv where you'd have installed the "dev" dependencies, using:

make install-dev

Python compatibility

Important: This project is, and should stay compatible with Python 2.6, 2.7 and Python 3.5+ up to 3.8, to keep the same Python compatibility that skyfield has.

Hacking

Improving or fixing skyfield-data will require you to have at least a virtualenv with tox installed on it.

We'll ask you to add tests along your patch, to make sure that no regression or bug would be introduced by your patch or further ones.

To make a quick'n'dirty test, inside your "tox-ready" virtualenv, run:

make test

to launch the Python 2.7 and Python 3.5+ test jobs.

If you want to test your branch against Python 2.6, you'll have to setup a Python 2.6-ready tox environment, by doing something similar to:

sudo apt install python2.6 python2.6-dev  # dev headers to compile numpy
mkvirtualenv TOX26 --python=`which python2.6`  # You will activate this venv with `workon TOX26`
pip install tox
tox -c tox-py26.ini

Known issues: on Ubuntu, you may be unable to build numpy at this point, due to misplaced C header files in your system. I've had hard times on Ubuntu, but your mileage may vary.

If you don't want to or can't install Python 2.6 requirements, you'll have to rely on the Online CI jobs by Circle-CI.

Online CI with Travis & Circle-CI

The online CI is done by two services:

  • Travis: to run Python 2.7, 3.5+ to 3.8 tests.
  • Circle-CI: dedicated to run the Python 2.6 tests.

If either one of them is failing, your PR won't be merged.

Copyright

Data files

  • de421.bsp is provided by the Jet Propulsion Laboratory,
  • Leap_Second.dat is provided by the International Earth Rotation and Reference Systems Service.

Software

This Python Package code is published under the terms of the MIT license. See the COPYING file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skyfield-data-2.0.0.tar.gz (16.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skyfield_data-2.0.0-py2.py3-none-any.whl (16.0 MB view details)

Uploaded Python 2Python 3

File details

Details for the file skyfield-data-2.0.0.tar.gz.

File metadata

  • Download URL: skyfield-data-2.0.0.tar.gz
  • Upload date:
  • Size: 16.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for skyfield-data-2.0.0.tar.gz
Algorithm Hash digest
SHA256 98f63b44a433d455857fc05fc71fe54c03fd4799dc8516cc2b0d509bea67263b
MD5 2a33854d4461da764f47d43366e6b7d9
BLAKE2b-256 a48755806153f4cb33a9b919bf5c31827e4037270481e07fe7c4585b0f5867d5

See more details on using hashes here.

File details

Details for the file skyfield_data-2.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: skyfield_data-2.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.0 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for skyfield_data-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 10363e7c1b9ca901ab34ef28450e92e0bf2ccf962eb12e2546c1f3aca48c4006
MD5 38528f86fc55e66432c0d25d10ad9cda
BLAKE2b-256 1222dcd3eca8ef5ef523c83c1cb8085638285b656254b718b590e88f6b050684

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page