;ELC ;;; compiled by jwz@thalidomide on Mon Jan 3 17:53:18 1994 ;;; from file /th/jwz/emacs19/lisp/calendar/solar.el ;;; emacs version 19.9 Lucid (beta12). ;;; bytecomp version 2.22; 22-dec-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (byte-code "!!!!" [fboundp atan require lisp-float-type error "Solar calculations impossible since floating point is unavailable." cal-dst] 2) (defvar calendar-time-display-form '(12-hours ":" minutes am-pm (if time-zone " (") time-zone (if time-zone ")")) "\ *The pseudo-pattern that governs the way a time of day is formatted. A pseudo-pattern is a list of expressions that can involve the keywords `12-hours', `24-hours', and `minutes', all numbers in string form, and `am-pm' and `time-zone', both alphabetic strings. For example, the form '(24-hours \":\" minutes (if time-zone \" (\") time-zone (if time-zone \")\")) would give military-style times like `21:07 (UTC)'.") (defvar calendar-latitude nil "\ *Latitude of `calendar-location-name' in degrees, + north, - south. For example, 40.7 for New York City. It may not be a good idea to set this in advance for your site; if there may be users running Emacs at your site who are physically located elsewhere, they would get the wrong value and might not know how to override it.") (defvar calendar-longitude nil "\ *Longitude of `calendar-location-name' in degrees, + east, - west. For example, -74.0 for New York City. It may not be a good idea to set this in advance for your site; if there may be users running Emacs at your site who are physically located elsewhere, they would get the wrong value and might not know how to override it.") (defvar calendar-location-name '(let ((float-output-format "%.1f")) (format "%s%s, %s%s" (abs calendar-latitude) (if (> calendar-latitude 0) "N" "S") (abs calendar-longitude) (if (> calendar-longitude 0) "E" "W"))) "\ *Expression evaluating to name of `calendar-longitude', calendar-latitude'. Default value is just the latitude, longitude pair.") (defvar solar-n-hemi-seasons '("Vernal Equinox" "Summer Solstice" "Autumnal Equinox" "Winter Solstice") "\ List of season changes for the northern hemisphere.") (defvar solar-s-hemi-seasons '("Autumnal Equinox" "Winter Solstice" "Vernal Equinox" "Summer Solstice") "\ List of season changes for the southern hemisphere.") (fset 'solar-setup #[nil " ! !?!" [beep calendar-longitude solar-get-number "Enter longitude (decimal fraction; + east, - west): " calendar-latitude "Enter latitude (decimal fraction; + north, - south): " calendar-time-zone "Enter difference from Coordinated Universal Time (in minutes): "] 2 "\ Prompt user for latitude, longitude, and time zone."]) (fset 'solar-get-number #[(prompt) " \"˜? !)" [read-string prompt "" x string-to-int] 4 "\ Return a number from the minibuffer, prompting with PROMPT. Returns nil if nothing was entered."]) (byte-code "MMM" [solar-sin-degrees #[(x) " _!" [sin x 0.0174532925199433] 3] solar-cosine-degrees #[(x) " _!" [cos x 0.0174532925199433] 3] solar-tangent-degrees #[(x) " _!" [tan x 0.0174532925199433] 3]] 2) (fset 'solar-xy-to-quadrant #[(x y) "V\nVÇć\nVŇƇ" [x 0 y 1 4 2 3] 2 "\ Determines the quadrant of the point X, Y."]) (fset 'solar-degrees-to-quadrant #[(angle) "\n\"\"T" [floor mod angle 360 90] 4 "\ Determines the quadrant of ANGLE."]) (fset 'solar-arctan #[(x quad) " !_ Ś \\ ǚ \\ Ț \\ )" [atan x 57.29577951308232 deg quad 2 180 3 4 360] 2 "\ Arctangent of X in quadrant QUAD."]) (byte-code "MM" [solar-arccos #[(x) "\n_Z! \n\n \"\")" [sqrt 1 x y solar-arctan solar-xy-to-quadrant] 5] solar-arcsin #[(y) "\n_Z!\n \n\"\")" [sqrt 1 y x solar-arctan solar-xy-to-quadrant] 5]] 2) (defconst solar-earth-inclination 23.441884 "\ Inclination of earth's equator to its solar orbit in degrees.") (defconst solar-cos-inclination (solar-cosine-degrees solar-earth-inclination) "\ Cosine of earth's inclination.") (defconst solar-sin-inclination (solar-sin-degrees solar-earth-inclination) "\ Sine of earth's inclination.") (defconst solar-earth-orbit-eccentricity 0.016718 "\ Eccentricity of orbit of the earth around the sun.") (byte-code "MM" [solar-degrees-to-hours (macro . #[(deg) " E" [/ deg 15] 3]) solar-hours-to-days (macro . #[(hour) " E" [/ hour 24] 3])] 2) (fset 'solar-longitude-of-sun #[(day) "_Z !_ \\!_\\\\\\\")" [day 0.9856 3.289 mean-anomaly mod solar-sin-degrees 1.916 0.02 282.634 360] 6 "\ Longitude of the sun at DAY in the year."]) (fset 'solar-right-ascension #[(longitude) " !_ !\"ť" [solar-arctan solar-cos-inclination solar-tangent-degrees longitude solar-degrees-to-quadrant 15] 4 "\ Right ascension of the sun, given its LONGITUDE."]) (fset 'solar-declination #[(longitude) " !_!" [solar-arcsin solar-sin-inclination solar-sin-degrees longitude] 4 "\ Declination of the sun, given its LONGITUDE."]) (fset 'solar-sunrise #[(date) "@A@AA@\n S_\\ V _\\ɥZ ǦU ˦U ̦U T ,ϥZХ\\!!!!!!_Z!!_!X!Zϥ!!\\_\\Z\"%ϥZ&\\*." [date month day year 31 day-of-year 2 4 23 10 0 100 400 6 calendar-longitude 15 24 approx-sunrise solar-longitude-of-sun solar-longitude-of-sun-at-sunrise solar-right-ascension solar-right-ascension-at-sunrise solar-declination solar-declination-at-sunrise solar-cosine-degrees 90.83333333333333 solar-sin-degrees calendar-latitude cos-local-sunrise abs 1 360 solar-arccos local-sunrise mod 0.06571 6.622 local-mean-sunrise calendar-time-zone 60.0] 5 "\ Calculates the *standard* time of sunrise for Gregorian DATE for location given by `calendar-latitude' and `calendar-longitude'. Returns a decimal fraction of hours. Returns nil if the sun does not rise at that location on that day."]) (fset 'solar-sunset #[(date) "@A@AA@\n S_\\ V _\\ɥZ ǦU ˦U ̦U T ,ϥZХ\\!!!!!!_Z!!_!X!ϥ  \\_\\Z\"$ϥZ%\\*." [date month day year 31 day-of-year 2 4 23 10 0 100 400 18 calendar-longitude 15 24 approx-sunset solar-longitude-of-sun solar-longitude-of-sun-at-sunset solar-right-ascension solar-right-ascension-at-sunset solar-declination solar-declination-at-sunset solar-cosine-degrees 90.83333333333333 solar-sin-degrees calendar-latitude cos-local-sunset abs 1 solar-arccos local-sunset mod 0.06571 6.622 local-mean-sunset calendar-time-zone 60.0] 5 "\ Calculates the *standard* time of sunset for Gregorian DATE for location given by `calendar-latitude' and `calendar-longitude'. Returns a decimal fractions of hours. Returns nil if the sun does not set at that location on that day."]) (fset 'solar-time-string #[(time date &optional style) "AA@ _!AA@S@A@AA@S_\\ V _\\ͥZ ˦U ϦU ЦU T  , _ ˥ ϥ[ Х\\\\\\\\) ҥ\\!AA@S!@!A@!AA@S_\\ V _\\ͥZ ˦U ϦU ЦU T  , _ ˥ ϥ[ Х\\\\\\\\)ץ\\!AA@S!@!A@!AA@S_\\ V _\\ͥZ ˦U ϦU ЦU T  , _ ˥ ϥ[ Х\\\\\\\\)Zܥ\\=?=WXWWWXX?W!\"#$ !\\ĥ% Ħ\"(%\\T\",%Y/%\"%1#. " [date year round time 60 prior-years month day 31 day-of-year 2 4 23 10 0 100 400 365 1440.0 rounded-abs-date calendar-daylight-savings-starts eval calendar-daylight-savings-starts-time 1440.0 dst-starts calendar-daylight-savings-ends calendar-daylight-savings-ends-time calendar-daylight-time-offset 1440.0 dst-ends style standard daylight dst calendar-daylight-time-zone-name calendar-standard-time-zone-name time-zone 24-hours format "%02d" minutes "%d" 11 12 12-hours "pm" "am" am-pm mapconcat calendar-time-display-form ""] 7 "\ Printable form for decimal fraction *standard* TIME on DATE. Optional parameter STYLE forces the time to be standard time when its value is 'standard and daylight savings time (if available) when its value is 'daylight. Format used is given by `calendar-time-display-form'. Converted to daylight savings time according to `calendar-daylight-savings-starts', `calendar-daylight-savings-ends', `calendar-daylight-savings-starts-time', `calendar-daylight-savings-ends-time', and `calendar-daylight-savings-offset'."]) (fset 'solar-sunrise-sunset #[(date) " ! ! \"P \"P !$*" [solar-sunrise date solar-sunset set rise format "%s, %s at %s" "Sunrise " solar-time-string "No sunrise" "sunset " "no sunset" eval calendar-location-name] 7 "\ String giving local times of sunrise and sunset on Gregorian DATE."]) (fset 'solar-apparent-longitude-of-sun #[(date) "AA@S@A@AA@ \nS_\\\nV\n_\\ʥZ ȦU ̦U ͦUT, _ ȥ ̥[ ͥ\\\\\\\\) \nS_\\\nV\n_\\ʥZ ȦU ̦U ͦUT, _ ȥ ̥[ ͥ\\\\\\\\)Zӥ___\\\\______\\\\\\___\\\\!__\\\\!__!_\\\\&&\\'_\\*'*!_\\\\." [date prior-years month day year 31 day-of-year 2 4 23 10 0 100 400 365 1899 1 0.5 1900 36525 time 36000.76892 0.0003025 279.69668 l 35999.04975 -0.00015 -3.3e-06 358.47583 m -0.004789 -1.4e-05 1.91946 solar-sin-degrees -0.0001 0.020094 3 0.000293 c L -1934.142 259.18 omega -0.00479 -0.00569] 8 "\ Apparent longitude of the sun on Gregorian DATE."]) (fset 'solar-ephemeris-correction #[(year) "Z¥_ __\\\\)" [year 1900 100.0 T 1.2053 0.4992 0.41] 5 "\ Difference in minutes between Ephemeris time and UTC in YEAR. Value is only an approximation."]) (fset 'solar-equinoxes/solstices #[(k year) "_\\ EV!\"_Z!_@A@\\ EU@A@ѥ !ӥ[\\\\ E+" [k 3 21 year nil 1000 correction app date 1e-05 mod solar-apparent-longitude-of-sun 360 solar-sin-degrees 90 58 calendar-time-zone 1440.0 solar-ephemeris-correction 1440.0] 5 "\ Date of equinox/solstice K for YEAR. K=0, spring equinox; K=1, summer solstice; K=2, fall equinox; K=3, winter solstice. Accurate to within several minutes."]) (fset 'sunrise-sunset #[(&optional arg) "W\n W !W\n!W !W\n \n!\nVѪ ! VӪ%)\nW U֪ W \" \"WWW \"!!#!##%!'%G X%!!#Q!'.彩!!. " [arg 16 calendar-latitude calendar-longitude calendar-time-zone solar-setup solar-get-number "Enter longitude (decimal fraction; + east, - west): " "Enter latitude (decimal fraction; + north, - south): " "Enter difference from Coordinated Universal Time (in minutes): " calendar-location-name "%.1f" float-output-format format "%s%s, %s%s" abs 0 "N" "S" "E" "W" calendar-standard-time-zone-name "UTC" "UTC%dmin" "UTC+%dmin" calendar-daylight-savings-starts calendar-daylight-savings-ends 4 calendar-current-date calendar-read-date date calendar-date-string t date-string solar-sunrise-sunset time-string "%s: %s" msg one-window-p one-window screen-width message "*temp*" princ "\n" substitute-command-keys pop-up-windows "Type \\[delete-other-windows] to remove temp window." "Type \\[switch-to-buffer] RET to remove temp window." "Type \\[switch-to-buffer-other-window] RET to restore old contents of temp window."] 7 "\ Local time of sunrise and sunset for today. Accurate to +/- 2 minutes. If called with an optional prefix argument, prompts for date. If called with an optional double prefix argument, prompts for longitude, latitude, time zone, and date. This function is suitable for execution in a .emacs file." "p"]) (fset 'calendar-sunrise-sunset #[nil " \n !!!" [calendar-latitude calendar-longitude calendar-time-zone solar-setup message solar-sunrise-sunset calendar-cursor-to-date error "Cursor is not on a date!"] 4 "\ Local time of sunrise and sunset for date under cursor. Accurate to +/- 2 minutes." nil]) (fset 'diary-sunrise-sunset #[nil " \n !" [calendar-latitude calendar-longitude calendar-time-zone solar-setup solar-sunrise-sunset date] 2 "\ Local time of sunrise and sunset as a diary entry. Accurate to +/- 2 minutes."]) (fset 'diary-sabbath-candles #[nil " \n AA@S @ A@ AA@S_\\\nV\n_\\ΥZ\n̦UЦUѦU\nT\n\n, _ ̥ Х[ ѥ\\\\\\\\)ӦU !Z \"\"*" [calendar-latitude calendar-longitude calendar-time-zone solar-setup date prior-years month day year 31 day-of-year 2 4 23 10 0 100 400 365 7 5 solar-sunset sunset 0.3 light format "%s Sabbath candle lighting" solar-time-string] 7 "\ Local time of candle lighting diary entry--applies if date is a Friday. No diary entry if there is no sunset on that date."]) (fset 'solar-equinoxes-solstices #[nil " \n_ ŦUǪ ŦUƪ\\\\\\\nĦT\nĥ)        ťS\n\"A@!Z_W@!AA@E8\"#. DC" [displayed-month displayed-year y m 12 3 1 -1 2 0 macro-y calendar-time-zone calendar-standard-time-zone-name "UTC" calendar-daylight-savings-starts calendar-daylight-savings-ends k solar-equinoxes/solstices date day truncate 24 time calendar-latitude s-hemi format "%s %s" solar-s-hemi-seasons solar-n-hemi-seasons solar-time-string] 8 "\ Date and time of equinoxes and solstices, if visible in the calendar window. Requires floating point."]) (provide 'solar)