Skip to main content
`Ctrl`+`K`

# Longitude

class astropy.coordinates.Longitude(angle, unit=None, wrap_angle=None, **kwargs)

  Bases: `Angle`

  Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.

  A `Longitude` object is distinguished from a pure `Angle` by virtue of a `wrap_angle` property. The `wrap_angle` specifies that all angle values represented by the object will be in the range:

      wrap_angle - 360 * u.deg <= angle(s) < wrap_angle

  The default `wrap_angle` is 360 deg. Setting `wrap_angle=180 * u.deg` would instead result in values between -180 and +180 deg. Setting the `wrap_angle` attribute of an existing `Longitude` object will result in re-wrapping the angle values in-place.

  The input angle(s) can be specified either as an array, list, scalar, tuple, string, `Quantity` or another `Angle`.

  The input parser is flexible and supports all of the input formats supported by `Angle`.

  Parameters:
    angle `python:tuple` or astropy:angle-like

      The angle value(s). If a tuple, will be interpreted as `(h, m s)` or `(d, m, s)` depending on `unit`. If a string, it will be interpreted following the rules described for `Angle`.

      If `angle` is a sequence or array of strings, the resulting values will be in the given `unit`, or if `None` is provided, the unit will be taken from the first given value.

    unit astropy:unit-like [:ref: ‘angle’], optional

      The unit of the value specified for the angle. This may be any string that `Unit` understands, but it is better to give an actual unit object. Must be an angular unit.

    wrap_angle astropy:angle-like or `python:None`, optional

      Angle at which to wrap back to `wrap_angle - 360 deg`. If `None` (default), it will be taken to be 360 deg unless `angle` has a `wrap_angle` attribute already (i.e., is a `Longitude`), in which case it will be taken from there.

  Raises:
    `UnitsError`

      If a unit is not provided or it is not an angular unit.

    `TypeError`

      If the angle parameter is an instance of `Latitude`.

  Attributes Summary

  `info` |
  `wrap_angle` |

  Attributes Documentation

  info
  wrap_angle