evandhoffman/Sunrise-Display — Issue #1: Data is wrong, dawg
Author: evandhoffman
Created: 2012-02-01 22:58:09+00:00
State: open

Something's wrong with the algorithm currently. Doesn't match either Navy or the source R code. Not sure why.

π = 3.141592653589793
Position: {name=JFK Airport, latitude=40.64465, longitude=-73.78296, elevationMeters=0.0}
Date	Elevation	Azimuth
2012-01-01 00:00:00 EST	-71.94287100387437	359.62214552067263
2012-01-01 01:00:00 EST	-67.96655649256681	38.878782342843344
2012-01-01 02:00:00 EST	-59.038330874247556	62.8099061556782
2012-01-01 03:00:00 EST	-48.319026218133686	77.58983789595509
2012-01-01 04:00:00 EST	-37.030913991131776	88.43927946881588
2012-01-01 05:00:00 EST	-25.67096712048309	97.66656312358863
2012-01-01 06:00:00 EST	-14.531978703693792	106.40764143629032
2012-01-01 07:00:00 EST	-3.870869394816249	115.36722327878226
2012-01-01 08:00:00 EST	6.016635965494761	125.09581921230979
2012-01-01 09:00:00 EST	14.746838962613772	136.07881538410015
2012-01-01 10:00:00 EST	21.818310954179488	148.69486986416345
2012-01-01 11:00:00 EST	26.635156693401235	163.02936202199064
2012-01-01 12:00:00 EST	28.641086759898727	178.61373933049018
2012-01-01 13:00:00 EST	27.555507622243596	194.40468979667548
2012-01-01 14:00:00 EST	23.53328514776676	209.26116577665653
2012-01-01 15:00:00 EST	17.074200395050934	222.52539693062243
2012-01-01 16:00:00 EST	8.785549097452277	234.15033554187406
2012-01-01 17:00:00 EST	-0.7898395606799057	244.471190079855
2012-01-01 18:00:00 EST	-11.22286639714363	253.98413002392823
2012-01-01 19:00:00 EST	-22.175158837273646	263.2713429960092
2012-01-01 20:00:00 EST	-33.34572686826823	273.06681460498584
2012-01-01 21:00:00 EST	-44.386856438277796	284.4855518081309
2012-01-01 22:00:00 EST	-54.73161089866399	299.5476583405333
2012-01-01 23:00:00 EST	-63.16693733345077	321.9781092716754

Output from original R code:

> hours <- data.frame(hour = c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23))
> sunPos <- sunPosition(year = 2012, month = 1, day = 1, hour = hours$hour+5, min = 0, sec = 0, lat = 40.64465, long = -73.78296)
> cbind(hours, sunPos) hour elevation azimuth
1 0 -72.399533 1.287028
2 1 -68.134832 41.063418
3 2 -58.991992 64.725733
4 3 -48.168918 79.294914
5 4 -36.851419 90.060158
6 5 -25.523095 99.293705
7 6 -14.478121 108.107422
8 7 -3.983145 117.190782
9 8 5.651250 127.076177
10 9 14.026013 138.213084
11 10 20.634581 150.909765
12 11 24.904787 165.147185
13 12 26.346506 180.373540
14 13 24.766601 195.574675
15 14 20.375925 209.749670
16 15 13.673156 222.373292
17 16 5.229842 233.447143
18 17 -4.452064 243.289625
19 18 -14.978113 252.354957
20 19 -26.040530 261.181200
21 20 -37.372605 270.471433
22 21 -48.674753 281.372724
23 22 -59.443619 296.249610
24 23 -68.428207 320.576155

From Navy: http://aa.usno.navy.mil/data/docs/AltAz.php

Astronomical Applications Dept.
U.S. Naval Observatory
Washington, DC 20392-5420

JFK AIRPORT
o , o ,
W 73 46, N40 38

Altitude and Azimuth of the Sun
Jan 1, 2012
Zone: 5h West of Greenwich

Altitude Azimuth
(E of N)

h m o o
07:00 -4.0 117.2
08:00 5.8 127.1
09:00 14.1 138.2
10:00 20.7 150.9
11:00 25.0 165.2
12:00 26.4 180.4
13:00 24.8 195.6
14:00 20.4 209.8
15:00 13.7 222.4
16:00 5.4 233.5
17:00 -4.5 243.3