Revision: 9d9d49f709
Author: Enrico Spinielli <
enrico.s...@gmail.com>
Date: Sat Nov 21 10:11:20 2009
Log: Added refraction (and used un sunset/rise)
http://code.google.com/p/pycalcal/source/detail?r=9d9d49f709
Added:
/dates5.errata.csv
/errata20091115.pdf
/errata20091119.pdf
Deleted:
/errata.pdf
Modified:
/
calendrica-3.0.errata.cl
/pycalcal.nw
=======================================
--- /dev/null
+++ /dates5.errata.csv Sat Nov 21 10:11:20 2009
@@ -0,0 +1,33 @@
+-214193,-214174.61455324
+-61387,-61383.00369678
+25469,25495.80654398
+49217,49238.50056637
+171307,171318.43494824
+210155,210180.69009031
+253427,253442.85563555
+369740,369763.73905276
+400085,400091.57126664
+434355,434376.57199131
+452605,452627.18657202
+470160,470167.57372410
+473837,473858.84880459
+507850,507878.66389345
+524156,524179.24479278
+544676,544702.75236117
+567118,567146.51239052
+569477,569479.20254523
+601716,601727.03344093
+613424,613449.76206532
+626596,626620.36971599
+645554,645579.07669134
+664224,664242.88668371
+671401,671418.97051052
+694799,694807.56336115
+704424,704433.49117744
+708842,708863.59699655
+709409,709424.40492600
+709580,709602.08268338
+727274,727291.20939231
+728714,728737.44767496
+744313,744329.57317982
+764652,764676.19131746
=======================================
--- /dev/null
+++ /errata20091115.pdf Sat Nov 21 10:11:20 2009
Binary file, no diff available.
=======================================
--- /dev/null
+++ /errata20091119.pdf Sat Nov 21 10:11:20 2009
Binary file, no diff available.
=======================================
--- /errata.pdf Thu Nov 19 08:41:18 2009
+++ /dev/null
Binary file, no diff available.
=======================================
--- /
calendrica-3.0.errata.cl Fri Nov 20 08:24:51 2009
+++ /
calendrica-3.0.errata.cl Sat Nov 21 10:11:20 2009
@@ -437,7 +437,22 @@
(day (- date-prime moon (if (and early (not long)) -2 -1))))
(hebrew-date year month day)))
-
+;; new (Errata '12:58pm, November 19, 2009')
+;; could be used for sunrise/sunset
+(defun refraction (tee location)
+ ;; TYPE (moment location) -> angle
+ ;; Angle correction due to refraction calculated at time $tee$ and
$location$.
+ ;; The time parameter $tee$ is not being used here, but could be used in
a more
+ ;; refined calculation that takes average atmospheric conditions into
account.
+ (let* ((h (max (mt 0) (elevation location)))
+ (cap-R (mt 6.372d6)) ; Radius of Earth.
+ (dip ; Depression of visible horizon.
+ (arccos-degrees (/ cap-R (+ cap-R h)))))
+ (+ (angle 0 50 0) dip (* (secs 19) (sqrt h)))))
+
+;; new (Errata '12:58pm, November 19, 2009')
+(observed-lunar-altitude ()
+())
;;;============================= History
=======================================
;; 2009/11/19 Enrico Spinielli
;; Extracted changes/enhancements from
@@ -447,4 +462,10 @@
;; 2009/11/20 Enrico Spinielli
;; Re-organised so history goes at the end
;; Completed nth-new-moon data lists
+;;
+;; 2009/11/21 Enrico Spinielli
+;; Added refraction and (signature of) observed-lunar-altitude from
+;; Errata '12:88pm, November 19, 2009' from
+;;
http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/errata.shtml
+;; Completed nth-new-moon data lists
;;;=============================================================================
=======================================
--- /pycalcal.nw Fri Nov 20 08:24:51 2009
+++ /pycalcal.nw Sat Nov 21 10:11:20 2009
@@ -3554,25 +3554,34 @@
else:
return standard_from_local(result, location)
-# see lines 2997-3007 in
calendrica-3.0.cl
-def `sunrise(date, location):
- """Return Standard time of sunrise on fixed date 'date' at
- location 'location'."""
from math import sqrt
h = max(mt(0), elevation(location))
cap_R = mt(6.372E6)
dip = arccos_degrees(cap_R / (cap_R + h))
alpha = angle(0, 50, 0) + dip + secs(19) * sqrt(h)
+
+
+# see lines 440-451 in
calendrica-3.0.errata.cl
+def `refraction(tee, location):
+ """Return refraction angle at location 'location' and time 'tee'."""
+ from math import sqrt
+ h = max(mt(0), elevation(location))
+ cap_R = mt(6.372E6)
+ dip = arccos_degrees(cap_R / (cap_R + h))
+ return angle(0, 50, 0) + dip + secs(19) * sqrt(h)
+
+# see lines 2997-3007 in
calendrica-3.0.cl
+def `sunrise(date, location):
+ """Return Standard time of sunrise on fixed date 'date' at
+ location 'location'."""
+ alpha = refraction(date, location)
return dawn(date, location, alpha)
# see lines 3009-3019 in
calendrica-3.0.cl
def `sunset(date, location):
"""Return standard time of sunset on fixed date 'date' at
location 'location'."""
- h = max(mt(0), elevation(location))
- cap_R = mt(6.372E6)
- dip = arccos_degrees(cap_R / (cap_R + h))
- alpha = angle(0, 50, 0) + dip + secs(19) * sqrt(h)
+ alpha = refraction(date, location)
return dusk(date, location, alpha)
def `urbana_sunset(gdate):
@@ -7165,10 +7174,17 @@
self.sl.append(float(row[1]))
self.nse.append(float(row[2]))
self.ll.append(float(row[3]))
- self.nnm.append(float(row[4]))
+ #self.nnm.append(float(row[4])) # read from errata file
self.dip.append(row[5])
self.sij.append(row[9])
+ reader1 = csv.reader(open("dates5.errata.csv", "rU"),
+ delimiter=',',
+ quoting=csv.QUOTE_NONE)
+
+ for row in reader1:
+ self.nnm.append(float(row[1]))
+
class `AppendixCTable5TestCase(AppendixCTable5TestCaseBase,
unittest.TestCase):