| 1 |
.. doctest-skip-all |
| 2 |
|
| 3 |
.. _precision: |
| 4 |
|
| 5 |
************************************************************** |
| 6 |
Why is my target above/below the horizon at the rise/set time? |
| 7 |
************************************************************** |
| 8 |
|
| 9 |
Rise/set/meridian transit calculations in `astroplan` are designed to be fast |
| 10 |
while achieving a precision comparable to what can be predicted given the |
| 11 |
affects of the changing atmosphere. As a result, there may be some |
| 12 |
counter-intuitive behavior in `astroplan` methods like |
| 13 |
`astroplan.Observer.target_rise_time`, `astroplan.Observer.target_set_time` and |
| 14 |
`astroplan.Observer.target_meridian_transit_time`, that can lead to small |
| 15 |
changes in the numerical values of these computed timed (of order seconds). |
| 16 |
|
| 17 |
For example, to calculate the rise time of Sirius, you might write:: |
| 18 |
|
| 19 |
from astroplan import Observer, FixedTarget |
| 20 |
from astropy.time import Time |
| 21 |
|
| 22 |
# Set up observer, target, and time |
| 23 |
keck = Observer.at_site("Keck") |
| 24 |
sirius = FixedTarget.from_name("Sirius") |
| 25 |
time = Time('2010-05-11 06:00:00') |
| 26 |
|
| 27 |
# Find rise time of Sirius at Keck nearest to `time` |
| 28 |
rise_time = keck.target_rise_time(time, sirius) |
| 29 |
|
| 30 |
You might expect the altitude of Sirius to be zero degrees at ``rise_time``, |
| 31 |
i.e. Sirius will be on the horizon, but this is not the case:: |
| 32 |
|
| 33 |
>>> altitude_at_rise = keck.altaz(rise_time, sirius).alt |
| 34 |
>>> print(altitude_at_rise.to('arcsec')) |
| 35 |
2.70185arcsec |
| 36 |
|
| 37 |
The altitude that you compute on your machine may be different from the number |
| 38 |
above by a small amount – for a detailed explanation on where the difference |
| 39 |
arises from, see :doc:`iers`. The rise and set time methods use the following |
| 40 |
approximation: |
| 41 |
|
| 42 |
* A time series of altitudes for the target is computed at times near ``time`` |
| 43 |
|
| 44 |
* The two times when the target is nearest to the horizon are identified, and a |
| 45 |
linear interpolation is done between those times to find the horizon-crossing |
| 46 |
|
| 47 |
This method has a precision of a few arcseconds, so your targets may be slightly |
| 48 |
above or below the horizon at their rise or set times. |
| 49 |
|
| 50 |
*********************************** |
| 51 |
How are sunrise and sunset defined? |
| 52 |
*********************************** |
| 53 |
|
| 54 |
By default, `~astroplan.Observer.sun_set_time` will compute an approximation |
| 55 |
to the moment when the center of the solar disk is on the horizon. This differs |
| 56 |
slightly from the conventional definition used by USNO, for example, which |
| 57 |
returns the time when the solar disk center is at -0.8333 degrees altitude to |
| 58 |
account for the solar radius and atmospheric refraction. If you want to |
| 59 |
accurately reproduce the sun rise and set times computed by USNO, |
| 60 |
you can call `~astroplan.Observer.sun_set_time` with the keyword argument |
| 61 |
``horizon=-0.8333*u.deg``, like so:: |
| 62 |
|
| 63 |
>>> from astroplan import Observer |
| 64 |
>>> from astropy.time import Time |
| 65 |
>>> import astropy.units as u |
| 66 |
|
| 67 |
>>> mmt = Observer.at_site('mmt', pressure=0*u.bar) |
| 68 |
|
| 69 |
>>> # USNO time from the MMTO Almanac: |
| 70 |
>>> # http://www.mmto.org/sites/default/files/almanac_2019.pdf |
| 71 |
>>> usno_sunset = Time('2019-01-01 00:31') |
| 72 |
|
| 73 |
>>> # Compute equivalent time with astroplan |
| 74 |
>>> astroplan_sunset = mmt.sun_set_time(usno_sunset - 10*u.min, |
| 75 |
... horizon=-0.8333*u.deg, which='next') |
| 76 |
|
| 77 |
>>> abs(usno_sunset - astroplan_sunset) < 1 * u.min |
| 78 |
True |