aboutsummaryrefslogtreecommitdiff
path: root/noao/obsutil/src/pairmass/airmass.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/obsutil/src/pairmass/airmass.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/obsutil/src/pairmass/airmass.x')
-rw-r--r--noao/obsutil/src/pairmass/airmass.x23
1 files changed, 23 insertions, 0 deletions
diff --git a/noao/obsutil/src/pairmass/airmass.x b/noao/obsutil/src/pairmass/airmass.x
new file mode 100644
index 00000000..8e9c585d
--- /dev/null
+++ b/noao/obsutil/src/pairmass/airmass.x
@@ -0,0 +1,23 @@
+include <math.h>
+
+# AIRMASS -- Compute airmass from DEC, LATITUDE and HA
+
+# Airmass formulation from Allen "Astrophysical Quantities" 1973 p.125,133.
+# and John Ball's book on Algorithms for the HP-45
+
+double procedure airmass (ha, dec, lat)
+
+double ha, dec, lat, cos_zd, x
+
+define SCALE 750.0d0 # Atmospheric scale height
+
+begin
+ if (IS_INDEFD (ha) || IS_INDEFD (dec) || IS_INDEFD (lat))
+ call error (1, "Can't determine airmass")
+
+ cos_zd = sin(DEGTORAD(lat)) * sin(DEGTORAD(dec)) +
+ cos(DEGTORAD(lat)) * cos(DEGTORAD(dec)) * cos(DEGTORAD(ha*15.))
+ x = SCALE * cos_zd
+
+ return (sqrt (x**2 + 2*SCALE + 1) - x)
+end