Here is my implementation in R of the Astronomer's Almanac algorithm (Joseph J. Michalsky. The astronomical almanac’s algorithm for approximate solar position (1950–2050).
Solar Energy, 40(3):227–235, 1988. ) It's straightforward to translate it in any other language.
Here is my implementation in R of the Astronomer's Almanac algorithm (Joseph J. Michalsky. The astronomical almanac’s algorithm for approximate solar position (1950–2050).
Solar Energy, 40(3):227–235, 1988. ) It's straightforward to translate it in any other language: sunPosition = 60 dayleapdays = 0 & num = 0 & num pi pi - twopi # Latitude to radians lat = elc = elc azel 0.
This is actually closest to what I was looking for. I had been using algorithm from: saao.ac. Za/public-info/sun-moon-stars/sun-index/… and yours seems similar.
Bonus: I never heard of programming languge R before, so I'm also looking at that. – Scott Evernden Nov 3 '08 at 16:49 R is free, from r-project. Org – RBerteig Apr 23 '09 at 1:29 1 +1 for being a lot of code - even though I have no idea if it's right, or what it's doing :) – Ian Boyd Jun 19 '09 at 2:57.
Here's code that uses ephem, a Python package for performing high-precision astronomy computations: #! /usr/bin/env python # -*- coding: utf-8 -*- import datetime import ephem # to install, run `pip install pyephem` o = ephem.Observer() # Los Angeles, Calif. 34°3'N, 118°15'W o.
Lat, o. Long, o. Date = '34:3', '-118:15', datetime.datetime.utcnow() sun = ephem.
Sun(o) print o. Date print sun. Az, sun.
Alt Output 2010/3/29 20:52:25 UTC 205:40:44.9 56:59:27.7 , where: az — azimuth east of north alt — altitude above horizon.
P.J.Naughter's code probably has everything you need and then some... naughter.com/aa.html.
Doing this correctly isn't easy. It depends on the orbit of the Earth, which is probably beyond what you were looking to do. The easiest way to get a completely correct answer is to pull it from JPL Horizons.
Just get the az/el readings once an hour, and linear interpolation. That'll look pretty good visually. If you need to figure it out for a lot of positions on the Earth, get Horizons to give you ECI coordinates (which you can again linearly interpolate between), and then convert the ECI coordinates to az/el.
See Celestrak for information on that conversion. You want the "Orbital Coordinate Systems" articles. Astronomical Algorithms by Meeus is also useful.
The National Renewable Energy Lab has a Solar Position and Intensity Calculator called Solpos. I used it years ago to track sun position to avoid "sunstrikes" against our optical communication systems. See the C source code at: rredc.nrel.gov/solar/codesandalgorithms/... You can test drive the algorithm at: nrel.gov/midc/solpos/solpos.html If you need real precise data, fed from NASA-JPL, check out JPL's HORIZONS data service which has various gateways to the data used by NASA to track celestial bodies.
They have "431015 asteroids, 2966 comets, 168 planetary satellites, 8 planets, the Sun, L1, L2, select spacecraft, and system barycenters". HORIZONS is at http://ssd.jpl.nasa.gov/?horizons.
I use solpos to calculate a sample day ` pdat->longitude = 114.0 + (10.0 / 60.0); pdat->latitude = 22.0 + (15.0 / 60.0); pdat->timezone = 8.0; pdat->year = 2011; pdat->daynum = 19; ` (2011 Jan 19 Hong Kong GMT+8 long:114'10N lat:22'15E) gives: ` sunrise 428.911835 (minutes from midnight) 7.000000 (hour) : 8.911835 (minutes) ` which is a few minutes off, compares with esrl.noaa. Gov/gmd/grad/solcalc and aa.usno.navy. Mil/cgi-bin/aa_rstablew.
Pl (both shows 7:05am). Anything wrong in my input parameters? – ohho Jan 19 at 3:22 And, the result is different, comparing esrl.noaa.Gov/gmd/grad/solcalc with nrel.
Gov/midc/solpos/solpos. Html using testing day: Lat: 22.25E Long: 114.16666N Timzone: 8 Date: 2011 Jan 19 – ohho Jan 19 at 3:41 I believe that each of them use somewhat different formulas and correction factors. I think solpos exists to give best algorithmic estimates, while some of the online services will have more accurate correction factors.
– Toybuilder Jan 26 at 1:25.
You'll not only need the time of day, but also the date. The position of the sun depends on the time of year.
Yeah of course. I shouldn't have said simply "time of day" – Scott Evernden Nov 3 '08 at 1:39.
Practical Astronomy with your Calculator" by Peter Duffett-Smith provides well-illustrated explanations and equations for this sort of thing. From these, its easy to code solutions in whatever language you choose.
PHP actually has some built-in functions that deal with similar tasks: au2.php.net/manual/en/function.date-sun-... Unfortunately, this only tells you the time of sun rise, sun set, twilight, and some other things: not the location of the sun at a particular time. I did find some formulae for this sort of thing here: qarlos.free.fr/navegacion/Sextante/formu... (FYI: Firefox reports this as a dangerous site) kevinboone.com/suntimes.html williams.best.vwh.net/sunrise_sunset_alg... Perhaps you could adapt them to your purposes..?
Firefox reports this as a dangerous site". Probably because of the 5 occurences of the word "sexagesimal"... :-/ – stevenvh Feb 15 '09 at 15:46 sounds kinda hot, don't it? – nickf Feb 27 '09 at 2:01.
If you can get access to IDL (I think trial versions are free) and the astronomy user's library (which is free) questions like this are very easy. Take a look at sunpos.
I'm trying to do a simplified solar position calculator (where all the numbers used have been identified), please see https://gist.github. Com/1278755 and let me know what y'all think!
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.