4

How to account for observer elevation when calculating sunrise/sunset?

Calculating sunrise/set for any lat/longitude is no problem, but how to account for elevation instead of sea-level??? I've run out of combinations to try, and having spent over three days on this am putting my hand up for help

I'm using the excellent public domain C source by Paul Schlyter which seems to be the most common. It DOES let you set "altitude which the Sun should cross", eg -12 for nautical twilight or -35/60 etc, but I'm not sure how to modify that to account for observer elevation above sea level.

For example, Quito in Ecuador is one of the highest cities at 2850m above sea level.
Lat+Lon: -78.46784, -0.18065
Timezone: -5
Elev: 2850m

Using Casio's calculator (http://keisan.casio.com/exec/system/1224686065), one of the few I've found that does account for elevation, it returns the following (Date=Jan 1 2017):
Sunrise=6:14 Sunset=18:22 Elevation=0m <- i can already get this
Sunrise=6:05 Sunset=18:30 Elevation=2850m <- but how can i get this?

I'm able to get the first one (elev=0) by setting Altitude=-35/60 (-0.58333) UpperLimb=1.0 But how to get the second?

I'm using the following function:

int sunriset( int year, int month, int day, double lon, double lat,
                  double altit, int upper_limb, double *trise, double *tset )
/*************************************************************/
/* altit = the altitude which the Sun should cross           */
/*         Set to -35/60 degrees for rise/set, -6 degrees    */
/*         for civil, -12 degrees for nautical and -18       */
/*         degrees for astronomical twilight.                */
/* upper_limb: non-zero -> upper limb, zero -> center        */
/*         Set to non-zero (e.g. 1) when computing rise/set  */
/*         times, and to zero when computing start/end of    */
/*         twilight.                                         */
/**************************************************************/

SUNRISE.C (i've made this READY-TO-RUN EXAMPLE): with hard-coded Quito lat/long/etc: https://pastebin.com/XSWR2Hby Compile: gcc sunrise.c -o sunrise.exe

Stephen J
  • 41
  • 3
  • The last paragraph in [this section](https://en.wikipedia.org/wiki/Sunrise_equation#Hour_angle) ? – Stanislav Kralin Jul 07 '17 at 08:36
  • That's what I thought but I had already tried every combination from those examples, eg. alt = -0.8333 + -0.5536
    alt = -0.8333 - -1.388
    alt = -0.8333 + -101.378
    alt = -0.8333 - (0.347 * Sqr(meters))
    etc
    – Stephen J Jul 07 '17 at 08:38
  • their example is also confusing, as the displayed algorithm seems to use both Division and Square Root? but their example only uses Division!? – Stephen J Jul 07 '17 at 08:44
  • The problem seems to be related to the calculation algorithm only. No language issue. You might think about removing C language tag. – Gerhardh Jul 07 '17 at 08:54

1 Answers1

0

Assuming a non-elevated surrounding, i.e. on a mountain, not on a large plateau, you could first calculate the circle that is formed by all points that touch the tangents to the surface of the Earth that go through the point of interest (Quito) and then find the earliest sunrise and the latest sunset on this circle. If the sun shines on any part of this circle, it will also shine at the point of interest.

On a plateau, I don't think you need to do anything (and if Quito is on a plateau this means that Casio is wrong) as the right thing to do would be to make the calculations for an Earth with a larger radius or diameter but there is no variable for this in Paul's code. Presumably, the effect of the size of the planet is too small to be relevant and the sun rays reaching Earth are assumed to be parallel (which they are not).

Joachim Wagner
  • 860
  • 7
  • 16