HomeTable of ContentsAPI Reference

API Reference — Downloading files

See Downloading and Using Data Files for an explanation of how Skyfield programs use an instance of the Loader class described below to download and open the data files they need in order to operate.

class skyfield.iokit.Loader(directory, verbose=True, expire=True)

A tool for downloading and opening astronomical data files.

A default Loader that saves data files to the current working directory can be imported directly from the Skyfield API:

from skyfield.api import load

But users can also create a Loader of their own, if there is another directory they want data files saved to, or if they want to specify different options. The directory is created automatically if it does not yet exist:

from skyfield.api import Loader
load = Loader('~/skyfield-data')

The options are:

  • verbose — if set to False, then the loader will not print a progress bar to the screen each time it downloads a file. (If the standard output is not a TTY, then no progress bar is printed in any case.)
  • expire — if set to False, then Skyfield will always use an existing file on disk, instead of expiring files that are out of date and replacing them with newly downloaded copies.
directory

The directory where this loader looks when trying to open a file, and where it downloads files that have not been downloaded yet.

path_of(filename)

Return the path to filename in this loader’s directory.

timescale(delta_t=None)

Open or download three time scale files, returning a Timescale.

This method is how most Skyfield users build a Timescale object, which is necessary for building specific Time objects that name specific moments.

This will open or download the three files that Skyfield needs to measure time. UT1 is tabulated by the United States Naval Observatory files deltat.data and deltat.preds, while UTC is defined by Leap_Second.dat from the International Earth Rotation Service.