Skyfield: Home • Table of Contents • API Reference
When you ask positions to return distances, velocities, or angles, they return instances of the following classes.
skyfield.units.
Distance
(au=None, km=None, m=None)¶A distance, stored internally as au and available in other units.
You can initialize a Distance
by providing a single float or a
float array as either an au=
, km=
, or m=
parameter.
au
¶The distance in astronomical units.
km
¶The distance in kilometers.
m
¶The distance in meters.
length
()¶Compute the length when this is an x,y,z vector.
The Euclidean vector length of this vector is returned as a new
Distance
object.
>>> from skyfield.api import Distance
>>> d = Distance(au=[1, 1, 0])
>>> d.length()
<Distance 1.41421 au>
light_seconds
()¶Return the length of this vector in light seconds.
to
(unit)¶Convert this distance to the given AstroPy unit.
skyfield.units.
Velocity
(au_per_d=None, km_per_s=None)¶A velocity, stored internally as au/day and available in other units.
You can initialize a Velocity
by providing a float or float
array to its au_per_d=
parameter.
au_per_d
¶The velocity in astronomical units per day.
km_per_s
¶The velocity in kilometers per second.
to
(unit)¶Convert this velocity to the given AstroPy unit.
skyfield.units.
Angle
(angle=None, radians=None, degrees=None, hours=None, preference=None, signed=False)¶degrees
¶The angle in degrees (360° in a circle).
hours
¶The angle in hours (24 hours in a circle).
radians
¶The angle in radians (𝜏 = 2𝜋 in a circle)
arcminutes
()¶Return the angle in arcminutes.
arcseconds
()¶Return the angle in arcseconds.
mas
()¶Return the angle in milliarcseconds.
hms
(warn=True)¶Convert to a tuple (hours, minutes, seconds).
All three quantities will have the same sign as the angle itself.
signed_hms
(warn=True)¶Convert to a tuple (sign, hours, minutes, seconds).
The sign
will be either +1 or -1, and the other quantities
will all be positive.
hstr
(places=2, warn=True)¶Convert to a string like 12h 07m 30.00s
.
dms
(warn=True)¶Convert to a tuple (degrees, minutes, seconds).
All three quantities will have the same sign as the angle itself.
signed_dms
(warn=True)¶Convert to a tuple (sign, degrees, minutes, seconds).
The sign
will be either +1 or -1, and the other quantities
will all be positive.
dstr
(places=1, warn=True)¶Convert to a string like 181deg 52' 30.0"
.
to
(unit)¶Convert this angle to the given AstroPy unit.