149 cxdouble exptime, cxdouble latitude)
152 const cxchar*
const fctid =
"giraffe_compute_airmass";
157 const cxdouble weights[] = {1. / 6., 2. / 3., 1. / 6.};
165 const cxdouble airmass_upper_limit = 10.;
169 cxdouble hourangle = 0.;
170 cxdouble airmass = 0.;
177 hourangle = lst * SEC_TO_DEG - alpha;
185 if (hourangle < -180.) {
189 if (hourangle > 180.) {
199 latitude *= DEG_TO_RAD;
200 hourangle *= DEG_TO_RAD;
211 z = _giraffe_compute_zdistance(hourangle, delta, latitude);
213 if (fabs(z) < TINY) {
214 cpl_msg_debug(fctid,
"Airmass computation failed. Object is "
215 "below the horizon.");
219 airmass = _giraffe_compute_airmass_young(z);
223 const cxint nweights = CX_N_ELEMENTS(weights);
227 cxdouble timestep = exptime / (nweights - 1) * SEC_TO_DEG *
231 airmass *= weights[0];
233 for (i = 1; i < nweights; i++) {
235 z = _giraffe_compute_zdistance(hourangle + i * timestep,
238 if (fabs(z) < TINY) {
240 cpl_msg_debug(fctid,
"Airmass computation failed. Object "
241 "is below the horizon.");
246 airmass += weights[i] * _giraffe_compute_airmass_young(z);
253 if (airmass > airmass_upper_limit) {
254 cpl_msg_debug(fctid,
"Airmass larger than %f", airmass_upper_limit);
cxdouble giraffe_compute_airmass(cxdouble alpha, cxdouble delta, cxdouble lst, cxdouble exptime, cxdouble latitude)
Compute the airmass for a given pointing direction and observing site.