Closed prideout closed 2 years ago
Hi Philip. Welcome to the Astronomy Engine project! It sounds like you are wanting to calculate the time of sunrise. The SearchAltitude called with a -6 degree altitude will find the beginning of civil twilight, which will be earlier than sunrise. The most accurate sunrise can be found by calling the SearchRiseSet function, which corrects for atmospheric refraction and the angular diameter of the Sun. If you use SearchRiseSet, you should get the right answer within a minute or two.
Don
On Jul 6, 2022, at 9:15 PM, Philip Rideout @.***> wrote:
Thank you for the wonderful library Don! This is interesting: according to timeanddate.com and a Google search for "sunrise", tomorrow's civil sunrise in San Jose CA will occur at 5:53 am PDT. However the astronomy library is reporting 5:24 am PDT.
I tried this with both the C library and the JS library. Here's my TypeScript test...maybe I'm doing something wrong?
import * as astro from './astronomy.js';
const height = 0; const latitude = 37.2580565; // San Jose, CA const longitude = -121.9359228; // San Jose, CA const observer = new astro.Observer(latitude, longitude, height);
// To find civil dawn, pass +1 for
direction
and -6 foraltitude
. const direction = +1; const altitude = -6;const limitDays = 1;
// Start searching from July 6 @ 9:00 pm. Note that I live in San Jose. const date = new Date(2022, 6, 6, 21, 0, 0);
const time = astro.SearchAltitude(astro.Body.Sun, observer, direction, date, limitDays, altitude)!.date;
console.info(time); This prints:
Thu Jul 07 2022 05:23:41 GMT-0700 (Pacific Daylight Time) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
Ah, yes this works perfectly, thanks Don! Somehow I missed the existence of SearchRiseSet. :)
The documentation generator for JavaScript isn’t sorting the functions alphabetically like it is supposed to. So no wonder you didn’t see that function! I will fix that.
In the meantime, you could look at the Python documentation for a shorter list of function names, then come back to the JavaScript documentation to read about how it works in JavaScript.
Thank you for the wonderful library Don! This is interesting: according to
timeanddate.com
and a Google search for "sunrise", tomorrow's civil sunrise in San Jose CA will occur at 5:53 am PDT. However the astronomy library is reporting 5:24 am PDT.I tried this with both the C library and the JS library. Here's my TypeScript test...maybe I'm doing something wrong?
This prints: