# include "addstar.h"

static int AirmassQuality = FALSE;

void SetAirmassQuality (int quality) {
  AirmassQuality = quality;
}

float airmass (float secz_image, double ra, double dec, double st, double latitude) {

  double hour, cosz, secz;
  double rdec, rlat;

  if (!AirmassQuality) return (secz_image);

  /*** make this optional? we may not have ST... ***/
  /* ra, dec, latitude in dec deg; st in dec hours */

  /* hour : hour angle in degrees */
  rdec = RAD_DEG*dec;
  rlat = RAD_DEG*latitude;
  hour = 15.0*st - ra;
  cosz = sin (rdec) * sin (rlat) + cos (rdec) * cos (RAD_DEG*hour) * cos (rlat);
  secz = 1.000 / cosz;
  return (secz);
}
