Skyfield: Home • Table of Contents • API Reference
Skyfield has only a single binary dependency, the NumPy vector library, and is designed to install cleanly with a single invocation of the standard Python package tool:
pip install skyfield
This should install Skyfield, NumPy,
and the small collection of pure-Python astronomy libraries
that Skyfield depends on.
If you lack
pip and need to install each dependency by hand,
setup.py file for the full list.
If trying to install Skyfield gives you errors about NumPy, there are several other ways to get NumPy installed:
You can download and run an official NumPy installer.
You can try to get the plain
pip-powered install working
by giving your system a functioning C compiler
that matches the compiler used to build Python.
On Windows with Python 2.7, try installing the free
Visual Studio Express 2008.
Mac users should install the “Xcode Command Line Tools”
pip the superpower of being able to build and install
binary Python dependencies like NumPy.
Read the Changelog below to learn about recent fixes, changes,
and improvements to Skyfield.
You can protect your project from any abrupt API changes
by pinning a specific version of Skyfield
setup.py or install instructions:
By preventing Skyfield from getting accidentally upgraded until you are ready to advance the version number yourself, you can avoid being blindsided by improvements that take place between now and the eventual 1.0 version. If you find any problems or would like to suggest an improvement, simply create an issue on the project’s GitHub page:
If Skyfield has proven useful in your research, the project welcomes your citation to bring it to the attention of other academics who might benefit from it.
http:in this URL to match papers already using it as an identifier): http://rhodesmill.org/skyfield/
finals2000A.allfor updated ∆T and leap seconds. The USNO is no longer updating the files
deltat.predsthat previous versions of Skyfield used, and the
cddis.nasa.govserver from which they were fetched will discontinue anonymous FTP on 2020 October 31. See UT1 and downloading IERS data. #452 #464
CometEls.txtnow includes the
referencecolumn, so users can tell which orbit is most recent if there are several orbits for a single comet. (For example, the file currently lists two C/2020 F3 (NEOWISE) orbits.) The comet examples in the documentation now build a dataframe that only includes the most recent orbit for each comet. #463
download()make it simple to download a fresh copy of a file if the copy on disk is older than you would like.
strftime()Skyfield methods now support the
%jday-of-year format code.
print()statement was stranded in
Timeobject, if manually instantiated without a Julian date fraction, now provides a fraction array with dimensions that match the Julian date argument. #458
hip_main.dat.gzHipparcos catalog file, the old URL now returns a 404 error. As an emergency fix, this version of Skyfield switches to their uncompressed
hip_main.dat. Hopefully they don’t compress it again and break the new URL! A more permanent solution is discussed at: #454
skyfield.named_starsthat broke because the Hipparcos catalog is no longer compressed; hopefully no one was using them.
Time()objects now offer support for the Julian calendar that’s used by historians for dates preceding the adoption of the Gregorian calendar in 1582. See Ancient and modern dates if you want to turn on Julian dates in your application. #450
compute_calendar_date()which lets the caller choose the Julian calendar for ancient dates instead of always using the proleptic Gregorian calendar. This should be particularly useful for historians.
J()that builds a time array from an array of floating point years. #436
strftimemethods for the non-UTC timescales (#443). All four of them support
%ffor microseconds, and provide a reasonable default format string for callers who don’t wish to concoct their own:
planetary_magnitude()can now return magnitudes for Uranus without raising an exception. The routine does not yet take into account whether the observer is facing the equator or poles of Uranus, so the magnitude predicted for the planet will only be accurate to within about 0.1 magnitudes.
timescale()is called (unless the
builtin=Trueparameter is provided). To make Skyfield less fragile going forward:
timescale()method now defaults to
builtin=True, telling it to use the ∆T and leap second files that ship with Skyfield internally. To download new ∆T files from NASA and the leap second file from the International Earth Rotation Service, specify
load(). Skyfield is now much simpler: if a file with the correct name exists, Skyfield uses it. See UT1 and downloading IERS data if you still want your application to check the age of your timescale files and automatically download new ones.
ICRF.separation_from()method now officially supports the combination of an array of positions with a single reference position! Its previous support for that combination was, alas, accidental, and was broken with the 1.23 release. #414 #424
planetary_magnitude()routine has been added with support for several planets. #210
utctimezone that Skyfield returns in Python datetimes is now either the Python Standard Library’s own UTC object, if it supplies one, or else is defined by Skyfield itself. Skyfield no longer silently tries importing the whole
pytzpackage merely to use its UTC object — which also means that the timezone returned by Skyfield longer offers the non-standard
parse_star_names()to load Stellarium star names and constellation lines. Constellation lines are featured in a new example script Drawing a finder chart for comet NEOWISE that produces a finder chart for comet C/2020 F3 NEOWISE.
utc()to accept a Python
datetime.dateobject as its argument. #409
Timescaleclass, to better advertise the ability to build a Skyfield time from a Python
datetime— an ability that was previously overloaded into the
yearparameter of the
utc()method (where it is still supported for backwards compatibility, but no longer documented).
is_behind_earth()to determine whether a celestial object is blocked from an Earth satellite’s view by the Earth itself.
rough_periodsearch parameter with the conceptually simpler
step_daysparameter, and updated the instructions in Searching for the dates of astronomical events to match.
tle_file()import method less strict about Earth satellite names: any text on the line before two lines of TLE data is now saved as the satellite name. A parameter
skip_names=Trueturns this off if, for particular TLE files, this leads to unwanted text being saved.
build_url()that returns the URL from which Skyfield will download a file. #382
close()to support applications that need to do fine-grained resource management or whose testing framework check for dangling open files. #374
Module not founderror when importing
jplephem.exceptionsif a user had an old “jplephem” version already installed. #386
is_sunlit()to determine whether Earth satellites in orbit are in Earth’s shadow or not, thanks to a pull request from Jesse Coffey.
position_of_radec()to replace the poorly designed
Timeobjects now have microsecond internal accuracy, so round trips to and from Python datetimes should now preserve all the microsecond digits.
utc_strftime()method now rounds to the nearest minute or second if it sees that either minutes or seconds are the smallest unit of time in the format string.
t.utccan now be accessed by the attribute names
SSL: CERTIFICATE_VERIFY_FAILEDerrors that some users encounter when downloading timescale files, Skyfield has taken the risk of switching away from your system’s SSL certificates to the certificate bundle from the
itrf_xyz()method that returns their raw ITRF coordinates. #354
load.tle()in favor of a simple list returned by the new
find_discrete()routine no longer returns extraneous values in its second return value if no changes of state were found. #339 #351
sgp4Python library that, when possible, uses the fast official C++ implementation of SGP4.
find_events()Earth satellite method that finds the times at which a satellite rises, culminates, and sets.
utc_strftime()method so it does not report that every day in all of recorded history is a Monday. #335
oppositions_conjunctions()for finding the dates when a planet is at opposition and conjunction with the sun.
position_angle_of()for computing astronomical position angles.
Loaderpointed at a Windows directory for which Python’s
os.makedirs()function returned a spurious error. #283
reverse_terra()routine can now be given an
iterations=0argument if the caller wants geocentric latitude and longitude.
load.timescale(builtin=True)to use time scale files that Skyfield carries internally, instead of downloading them. Note that the time scale files distributed with any given version of Skyfield will gradually fall out of date.
from_dataframe()now correctly pulls stellar parallax data from the dataframe if available. #266
find_discrete()was generating empty arrays of search dates, upsetting the astronomy code, if the start and end dates were very close together. #240
deltat.preds, whose change in format caused Skyfield to start throwing an exception for new users. #236
cirs_radec()have been contributed which provide support for rotating a position into the Celestial Intermediate Reference System (CIRS). #192
load()routine have been fixed. #193 #194
tle()now accept not just URLs but also plain local file paths; they correctly re-download a remote file if “reload=True” is specified; and they allow specifying a different local “filename=” than the one at the end of the URL.
subpoint()method now normalizes the longitude values it returns into the range −180° to 180° #182 and returns an actual elevation instead of zero. #185
ITRF_position_velocity_error()method that returns raw ITRF coordinates for users interested in them. #85
subpoint()method that computes the latitude and longitude of the point beneath that body.
Timescaletime constructor methods now accept arrays.
deltat.preds, since the file has gone out of date at the USNO site.
Starto be initialized with a tuple that breaks units into minutes and seconds (broke in version 1.2).
~now means “your home directory”.
EarthSatellite()instead of having it trying to load one itself.
topos()method in favor of vector addition.
satellite()method in favor of vector addition.
geometry_of()method in favor of vector subtraction.
observe()method of an observer on the Earth’s surface now correctly accounts for the way that the Earth’s gravity will deflect the apparent position of objects that are not exactly overhead, bringing Skyfield’s agreement with the Naval Observatory’s NOVAS library to within half a milliarcsecond.
tt_calendar()method no longer raises a
TypeErrorwhen its value is an array.
Timearray now produces a more compact string that only mentions the start and end of the time period.
api.load()call no longer attempts to animate a progress bar if the user is running it under IDLE, which would try to accumulate the updates as a single long line that eventually hangs the window.
ICRF.separation_from()computes the angular separation between two positions.
Timeobjects and other unrelated objects so that it no longer raises an exception.
Timescale object with methods
tdb() for building time objects, along with a
load.timescale() method for building a new
load method downloads ∆T and leap second data from official data
sources and makes sure the files are kept up to date. This replaces
all former techniques for building and specifying dates and times.
Time and switched from
as the typical variable used for time in the documentation.
Deprecated timescale keyword arguments like
utc=(…) for both the
Time constructor and also for all methods that take time as
an argument, including
Users who want to specify a target directory when downloading a file will now create their own loader object, instead of having to specify a special keyword argument for every download:
load = api.Loader('~/ephemeris-files') load('de421.bsp')
Users can now supply a target
directory when downloading a file:
Fix: removed inadvertent dependency on the Pandas library.
load() was raising a
PermissionError on Windows after a
successful download when it tried to rename the new file.
delta_tif the user does not supply their own
delta_t=keyword when specifying a date. This should make altitude and azimuth angles much more precise.
Skyfield has dropped the 16-megabyte JPL ephemeris DE421 as an install
dependency, since users might choose another ephemeris, or might not
need one at all. You now ask for a SPICE ephemeris to be downloaded
at runtime with a call like
planets = load('de421.bsp').
Planets are no longer offered as magic attributes, but are looked up
through the square bracket operator. So instead of typing
planets.mars you should now type
planets['mars']. You can run
print(planets) to learn which bodies an ephemeris supports.
Per IAU 2012 Resolution B2, Skyfield now uses lowercase au for the
astronomical unit, and defines it as exactly 149 597 870 700 meters.
While this API change is awkward for existing users, I wanted to make
the change while Skyfield is still pre-1.0. If this breaks a program
that you already have running, please remember that a quick
skyfield==0.4 will get you up and running again until
you have time to edit your code and turn
a.hoursare now attributes instead of method calls.