Пример #1
0
def get_sun_L0(time='now'):
    """
    Return the L0 angle for the Sun at a specified time, which is the Carrington longitude of the
    Sun-disk center as seen from Earth.

    .. warning::
       Due to apparent disagreement between published references, the returned L0 may be inaccurate
       by up to ~2 arcmin, which translates in the worst case to a shift of ~0.5 arcsec in
       helioprojective coordinates for an observer at 1 AU.  Until this is resolved, be cautious
       with analysis that depends critically on absolute (as opposed to relative) values of
       Carrington longitude.

    Parameters
    ----------
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~astropy.coordinates.Longitude`
        The Carrington longitude
    """
    obstime = _astropy_time(time)

    # Calculate the longitude due to the Sun's rotation relative to the stars
    # A sidereal rotation is defined to be exactly 25.38 days
    sidereal_lon = Longitude(
        (obstime.jd - _time_first_rotation.jd) / 25.38 * 360 * u.deg)

    # Calculate the longitude of the Earth in de-tilted HCRS
    lon_obstime = get_earth(obstime).hcrs.cartesian.transform(_SUN_DETILT_MATRIX) \
                  .represent_as(SphericalRepresentation).lon.to('deg')

    return Longitude(lon_obstime - _lon_first_rotation - sidereal_lon)
Пример #2
0
def get_sun_L0(time='now'):
    """
    Return the L0 angle for the Sun at a specified time, which is the Carrington longitude of the
    Sun-disk center as seen from Earth.

    .. warning::
       Due to apparent disagreement between published references, the returned L0 may be inaccurate
       by up to ~2 arcmin, which translates in the worst case to a shift of ~0.5 arcsec in
       helioprojective coordinates for an observer at 1 AU.  Until this is resolved, be cautious
       with analysis that depends critically on absolute (as opposed to relative) values of
       Carrington longitude.

    Parameters
    ----------
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~astropy.coordinates.Longitude`
        The Carrington longitude
    """
    obstime = _astropy_time(time)

    # Calculate the longitude due to the Sun's rotation relative to the stars
    # A sidereal rotation is defined to be exactly 25.38 days
    sidereal_lon = Longitude((obstime.jd - _time_first_rotation.jd) / 25.38 * 360*u.deg)

    # Calculate the longitude of the Earth in de-tilted HCRS
    lon_obstime = get_earth(obstime).hcrs.cartesian.transform(_SUN_DETILT_MATRIX) \
                  .represent_as(SphericalRepresentation).lon.to('deg')

    return Longitude(lon_obstime - _lon_first_rotation - sidereal_lon)
Пример #3
0
def get_sun_P(time='now'):
    """
    Return the position (P) angle for the Sun at a specified time, which is the angle between
    geocentric north and solar north as seen from Earth, measured eastward from geocentric north.
    The range of P is +/-26.3 degrees.

    Parameters
    ----------
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~astropy.coordinates.Angle`
        The position angle
    """
    obstime = _astropy_time(time)

    # Define the frame where its Z axis is aligned with geocentric north
    geocentric = PrecessedGeocentric(equinox=obstime, obstime=obstime)

    return _sun_north_angle_to_z(geocentric)
Пример #4
0
def get_sun_P(time='now'):
    """
    Return the position (P) angle for the Sun at a specified time, which is the angle between
    geocentric north and solar north as seen from Earth, measured eastward from geocentric north.
    The range of P is +/-26.3 degrees.

    Parameters
    ----------
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~astropy.coordinates.Angle`
        The position angle
    """
    obstime = _astropy_time(time)

    # Define the frame where its Z axis is aligned with geocentric north
    geocentric = PrecessedGeocentric(equinox=obstime, obstime=obstime)

    return _sun_north_angle_to_z(geocentric)
Пример #5
0
def get_body_heliographic_stonyhurst(body, time='now'):
    """
    Return a `~sunpy.coordinates.frames.HeliographicStonyhurst` frame for the location of a
    solar-system body at a specified time.

    Parameters
    ----------
    body : `str`
        The solar-system body for which to calculate positions
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~sunpy.coordinates.frames.HeliographicStonyhurst`
        Location of the solar-system body in the `~sunpy.coordinates.HeliographicStonyhurst` frame
    """
    obstime = _astropy_time(time)

    body_icrs = ICRS(get_body_barycentric(body, obstime))
    body_hgs = body_icrs.transform_to(HGS(obstime=obstime))

    return body_hgs
Пример #6
0
def get_body_heliographic_stonyhurst(body, time='now'):
    """
    Return a `~sunpy.coordinates.frames.HeliographicStonyhurst` frame for the location of a
    solar-system body at a specified time.

    Parameters
    ----------
    body : `str`
        The solar-system body for which to calculate positions
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~sunpy.coordinates.frames.HeliographicStonyhurst`
        Location of the solar-system body in the `~sunpy.coordinates.HeliographicStonyhurst` frame
    """
    obstime = _astropy_time(time)

    body_icrs = ICRS(get_body_barycentric(body, obstime))
    body_hgs = body_icrs.transform_to(HGS(obstime=obstime))

    return body_hgs
Пример #7
0
def get_sun_orientation(location, time='now'):
    """
    Return the orientation angle for the Sun from a specified Earth location and time.  The
    orientation angle is the angle between local zenith and solar north, measured eastward from
    local zenith.

    Parameters
    ----------
    location : `~astropy.coordinates.EarthLocation`
        Observer location on Earth
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~astropy.coordinates.Angle`
        The orientation of the Sun
    """
    obstime = _astropy_time(time)

    # Define the frame where its Z axis is aligned with local zenith
    local_frame = AltAz(obstime=obstime, location=location)

    return _sun_north_angle_to_z(local_frame)
Пример #8
0
def get_sun_orientation(location, time='now'):
    """
    Return the orientation angle for the Sun from a specified Earth location and time.  The
    orientation angle is the angle between local zenith and solar north, measured eastward from
    local zenith.

    Parameters
    ----------
    location : `~astropy.coordinates.EarthLocation`
        Observer location on Earth
    time : various
        Time to use as `~astropy.time.Time` or in a parse_time-compatible format

    Returns
    -------
    out : `~astropy.coordinates.Angle`
        The orientation of the Sun
    """
    obstime = _astropy_time(time)

    # Define the frame where its Z axis is aligned with local zenith
    local_frame = AltAz(obstime=obstime, location=location)

    return _sun_north_angle_to_z(local_frame)