3
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by emilo35
0

How about you start and we will help?

I am stuck. I don't know how to start. I know that it is related to the longitude and latitude positions and the regions of where it is dark and bright. I do not know what math is behind it though.
Just FYI, this is for a major project I am developing where I will be classifying data according to time of day.

Edited by hmdb: n/a

0

Then you need to define the problem a little better - what is the input, what is the expected output?

0

Then you need to define the problem a little better - what is the input, what is the expected output?

Input:
- The current date which includes the day, month, and the year and hours/minutes/seconds.
- Location's the longitude/latitude.
Output: Morning/Afternoon/Sunset/Night status is returned.

0

Again just to be clear, you want to know the Morning/Night status like 12:00 is noon, 22:00 is night time, or you want to know the light times where you need to consider things like the north poll, where there can be light for days.

0

Again just to be clear, you want to know the Morning/Night status like 12:00 is noon, 22:00 is night time, or you want to know the light times where you need to consider things like the north poll, where there can be light for days.

Well, I need to divide it based on the light times. Morning and night alone are not enough. Different locations have different lengths of sunlight and darkness- I need to consider this if I want it to work in any city.

0

Well, then you will have to provide the formulas to how to calculate such a thing (not the code, just the formulas), and then we will try to implement it into code.

Edited by apines: n/a

0

If you don't have any formulas to start with, I suggest you start off by looking up some things:

- At which latitude is the north/south polar circle (beyond this one there's midnight sun 24 hours a day during a period in summer and dark 24 hours a day during a period in winter)
- When is the first/last day of midnight sun and when is the first/last day of total darkness

This data should be sufficient. Now, since earth is a sphere that is slightly tilted, spinning around its own axis and travelling in a "spherical" path around the sun, I suggest you start off working with some sine patterns.

(Tip: Start by describing the suns motion over the globe with the sum of two sine curves, one with the period of one year, and one with the period of 24 hours.)

Good luck to you!
Emil Olofsson

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.