aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/asttools/astvsun.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /noao/astutil/asttools/astvsun.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/astutil/asttools/astvsun.x')
-rw-r--r--noao/astutil/asttools/astvsun.x38
1 files changed, 38 insertions, 0 deletions
diff --git a/noao/astutil/asttools/astvsun.x b/noao/astutil/asttools/astvsun.x
new file mode 100644
index 00000000..c466ab89
--- /dev/null
+++ b/noao/astutil/asttools/astvsun.x
@@ -0,0 +1,38 @@
+include <math.h>
+
+# The sun's velocity with respect to the local standard of rest is:
+
+define RAVSUN 18. # RA of sun's velocity
+define DECVSUN 30. # DEC of sun's velocity
+define VSUN 20. # VLSR of sun
+define EPOCH 1900. # Epoch of sun's velocity
+
+# AST_VSUN -- Projection of the sun's velocity along the given direction.
+
+procedure ast_vsun (ra, dec, epoch, v)
+
+double ra # Reference right ascension (hours)
+double dec # Reference declination (degrees)
+double epoch # Epoch (years)
+double v # VLSR of sun along reference direction
+
+double ravsun, decvsun, vx, vy, vz, cc, cs, s
+
+begin
+ # Precess VLSR direction to current date.
+ call ast_precess (double (RAVSUN), double (DECVSUN), double (EPOCH),
+ ravsun, decvsun, epoch)
+
+ # Cartisian velocity components of the sun's velocity.
+ vx = VSUN * cos (DEGTORAD (15. * ravsun)) * cos (DEGTORAD (decvsun))
+ vy = VSUN * sin (DEGTORAD (15. * ravsun)) * cos (DEGTORAD (decvsun))
+ vz = VSUN * sin (DEGTORAD (decvsun))
+
+ # Direction cosines along the reference direction.
+ cc = cos (DEGTORAD (dec)) * cos (DEGTORAD (15. * ra))
+ cs = cos (DEGTORAD (dec)) * sin (DEGTORAD (15. * ra))
+ s = sin (DEGTORAD (dec))
+
+ # Project sun's motion along the reference direction.
+ v = -(vx * cc + vy * cs + vz * s)
+end