sky_to_altaz

specsim.transform.sky_to_altaz(sky_coords, observing_model)[source] [edit on github]

Convert sky coordinates to (alt,az) for specified observing conditions.

Transformations between sky coordinates such as RA,DEC and ALT,AZ involve two steps. First, define the atmosphere through which the sky is being observed with a call to create_observing_model(). Next, call this function. For example, to locate Polaris from Kitt Peak, observing at a wavelength of 5400 Angstroms (we expect altitude ~ longitude ~ 32 deg):

>>> where = observatories['KPNO']
>>> when = astropy.time.Time('2001-01-01T00:00:00')
>>> obs_model = create_observing_model(where, when, 5400 * u.Angstrom)
>>> polaris = astropy.coordinates.ICRS(ra=37.95 * u.deg, dec=89.25 * u.deg)
>>> altaz = sky_to_altaz(polaris, obs_model)
>>> print('alt = %.3f deg, az = %.3f deg' %
... (altaz.alt.to(u.deg).value, altaz.az.to(u.deg).value))
alt = 32.466 deg, az = 0.667 deg

The output shape is determined by the usual numpy broadcasting rules applied to the input coordinates and the observing model input parameters.

Setting a pressure value of zero disables the atmospheric refraction model, so that returned coordinates are topocentric. The atmospheric refraction model becomes inaccurate for altitudes below 20 degrees so a UserWarning will be issued to flag this condition.

Parameters:
sky_coordsobject

An object representing one or more sky coordinates that are transformable to an AltAz frame by invoking sky_coords.transform_to(). This argument will usually be an instances of astropy.coordinates.SkyCoord, but instances of astropy.coordinates.AltAz can also be used to isolate the effects of changing the parameters of the atmospheric refraction model.

observing_modelastropy.coordinates.AltAz

The ALT-AZ coordinate frame(s) that specify the observing conditions, normally obtained by calling create_observing_model().

Returns:
astropy.coordinates.AltAz

An array of ALT-AZ coordinates with a shape given by np.broadcast(sky_coords, observing_model).