GreatArc#

class sunpy.coordinates.utils.GreatArc(start, end, center=None, points=None)[source]#

Bases: object

Calculate the properties of a great arc at user-specified points between a start and end point on a sphere.

The coordinates of the great arc are returned with the observation time and coordinate frame of the starting point of the arc.

Parameters:
  • start (SkyCoord) – Start point.

  • end (SkyCoord) – End point.

  • center (SkyCoord) – Center of the sphere.

  • points (None, int, numpy.ndarray) – Number of points along the great arc. If None, the arc is calculated at 100 equally spaced points from start to end. If int, the arc is calculated at “points” equally spaced points from start to end. If a numpy.ndarray is passed, it must be one dimensional and have values >=0 and <=1. The values in this array correspond to parameterized locations along the great arc from zero, denoting the start of the arc, to 1, denoting the end of the arc. Setting this keyword on initializing a GreatArc object sets the locations of the default points along the great arc.

inner_angles : `~astropy.units.Quantity`

Angles of the points along the great arc from the start to end coordinate.

distances : `~astropy.units.Quantity`

Distances of the points along the great arc from the start to end coordinate. The units are defined as those returned after transforming the coordinate system of the start coordinate into its Cartesian equivalent.

coordinates : `~astropy.coordinates.SkyCoord`

Coordinates along the great arc in the coordinate frame of the start point.

References

[1] https://www.mathworks.com/matlabcentral/newsreader/view_thread/277881 [2] https://en.wikipedia.org/wiki/Great-circle_distance#Vector_version

Example

>>> import matplotlib.pyplot as plt
>>> from astropy.coordinates import SkyCoord
>>> import astropy.units as u
>>> from sunpy.coordinates.utils import GreatArc
>>> import sunpy.map
>>> from sunpy.data.sample import AIA_171_IMAGE  
>>> m = sunpy.map.Map(AIA_171_IMAGE)  
>>> a = SkyCoord(600*u.arcsec, -600*u.arcsec, frame=m.coordinate_frame)  
>>> b = SkyCoord(-100*u.arcsec, 800*u.arcsec, frame=m.coordinate_frame)  
>>> great_arc = GreatArc(a, b)  
>>> ax = plt.subplot(projection=m)  
>>> m.plot(axes=ax)  
>>> ax.plot_coord(great_arc.coordinates(), color='c')  
>>> plt.show()  

Methods Summary

coordinates([points])

Calculates the coordinates on the sphere from the start to the end coordinate for all the parameterized points.

distances([points])

Calculates the distance from the start coordinate to the end coordinate on the sphere for all the parameterized points.

inner_angles([points])

Calculates the inner angles for the parameterized points along the arc and returns the value in radians, from the start coordinate to the end.

Methods Documentation

coordinates(points=None)[source]#

Calculates the coordinates on the sphere from the start to the end coordinate for all the parameterized points. Coordinates are returned in the frame of the start coordinate.

Parameters:

points (None, int, numpy.ndarray) – If None, use the default locations of parameterized points along the arc. If int, the arc is calculated at “points” equally spaced points from start to end. If a numpy.ndarray is passed, it must be one dimensional and have values >=0 and <=1. The values in this array correspond to parameterized locations along the great arc from zero, denoting the start of the arc, to 1, denoting the end of the arc.

Returns:

arc (SkyCoord) – Coordinates along the great arc in the coordinate frame of the start point.

distances(points=None)[source]#

Calculates the distance from the start coordinate to the end coordinate on the sphere for all the parameterized points.

Parameters:

points (None, int, numpy.ndarray) – If None, use the default locations of parameterized points along the arc. If int, the arc is calculated at “points” equally spaced points from start to end. If a numpy.ndarray is passed, it must be one dimensional and have values >=0 and <=1. The values in this array correspond to parameterized locations along the great arc from zero, denoting the start of the arc, to 1, denoting the end of the arc.

Returns:

distances (units) – Distances of the points along the great arc from the start to end coordinate. The units are defined as those returned after transforming the coordinate system of the start coordinate into its Cartesian equivalent.

inner_angles(points=None)[source]#

Calculates the inner angles for the parameterized points along the arc and returns the value in radians, from the start coordinate to the end.

Parameters:

points (None, int, numpy.ndarray) – If None, use the default locations of parameterized points along the arc. If int, the arc is calculated at “points” equally spaced points from start to end. If a numpy.ndarray is passed, it must be one dimensional and have values >=0 and <=1. The values in this array correspond to parameterized locations along the great arc from zero, denoting the start of the arc, to 1, denoting the end of the arc.

Returns:

inner_angles (Quantity) – Angles of the points along the great arc from the start to end coordinate.