How to Identify Polar Day and Night Seasons?

In summary, the programmer is trying to confine an error message to a specific latitude and season. He or she does not know the season dates or longitude/timezone. However, they know the latitude, and need to trap the runtime error to determine the appropriate message.
  • #1
simurq
7
0
Hello good people,

I'm using http://www.ecy.wa.gov/programs/eap/models/twilight.zip by Greg Pelletier to calculate sunrise/sunset times at a desired location. However, the sheet formulae return an error message (#NUM) for latitudes above the Arctic/Antarctic Circle since the sun/moon almost never set there depending on latitude and season (summer/winter). Actually, it's because the ACOS function (-1 to 1) used in the sheet for HA sunrise degree calculation fails...

Anyway, what I'm really after is a trap to confine this error message in the program I'm writing so that instead of an error message I could write "Polar Day" or "Polar Night" depending on latitude and season.

So, how can I (programmatically?) know which season is on to get a relevant "polar day/night" message pop up?

Thanks!

Rustam
 
Last edited:
Astronomy news on Phys.org
  • #2
Why not check the latitude value and if it's in the polar range issue your message else call the function that does the computation that with this value.
 
  • #3
Yes, but it's half of the job - the other half is the season of year which I don't actually know. This would further help with determining polar day and polar night depending on season...
 
  • #4
Do you know the season dates or does that vary from year to year?
 
  • #5
That's exactly what I would like to know, Sir! The rest I'll do programmatically...
 
  • #6
Be nice you didn't explain it well, you didn't show any code. Based on your description, I'm trying to provide some effective answers.

How do you run this program? Do you execute it from a shell script or from your own program? How does it return the error?

In languages like Java, methods will throw an exception that the application can capture and write out some message.

If the program runs from a shell script then maybe it returns a program code to the shell that you can query?
 
  • #7
Sorry if I sound rude to you! It's not my intention anyway...

I've developed my app in VBA under MS Excel. And it returns runtime 1004 error failing to properly run the arccos function which, in turn, fails to return a value for latitudes above Arctic circle, that is when the sun almost never sets in summer.

You can also check it from the file in my OP.

So, my intention is to trap the error which is easy if I know the seasons.
 
  • #8
jedishrfu said:
Do you know the season dates or does that vary from year to year?
Oh yes, it does. It also varies by longitude/timezone.
Are the year, longitude and timezone used as arguments?
 
  • #9
Yes, the arguments passed to the function are year, month, day, lat, lon, timezone, and dst (1 if on, 0 if off).

But again, when the sun/moon is below the horizon (never rises), the function returns a #num, runtime error, which I can trap easily. But to do this "nicely" (showing either "polar day" or "polar night" message), I need to know when exactly that season starts / ends...
 
  • #10
simurq said:
But again, when the sun/moon is below the horizon (never rises), the function returns a #num, runtime error, which I can trap easily. But to do this "nicely" (showing either "polar day" or "polar night" message), I need to know when exactly that season starts / ends...
Do you? Cannot you just put the error trap before the arccos function - if the argument is outside the bounds of +1 to -1, you can divert to polar time without attempting the arccos function, and then use the value of the argument (whether over +1 or under -1) in deciding whether it is polar day or night?
 
  • #11
Thanks! I'll try to replicate what you just recommended. I'll come back...
 

1. What causes polar day and night seasons?

Polar day and night seasons are caused by the tilt of the Earth's axis. During the summer solstice, the North Pole is tilted towards the sun, resulting in 24 hours of daylight, while the South Pole experiences 24 hours of darkness. This is reversed during the winter solstice, with the South Pole tilted towards the sun and the North Pole experiencing 24 hours of darkness.

2. How long do polar day and night seasons last?

The length of polar day and night seasons depends on the latitude. At the poles, these seasons last for approximately six months, while at lower latitudes, they may only last for a few days to a few weeks. The length also varies depending on the location within the polar regions.

3. How does the length of polar day and night seasons affect the climate?

The length of polar day and night seasons greatly impacts the climate in polar regions. During polar day, the constant sunlight leads to warmer temperatures, causing melting of ice and snow. This can lead to flooding and other environmental changes. On the other hand, during polar night, the lack of sunlight results in colder temperatures, leading to freezing and the formation of sea ice.

4. Are there any organisms that can survive in polar night conditions?

Yes, there are some organisms that have adapted to survive in the extreme conditions of polar night. This includes certain species of plants, animals, and microorganisms that have developed unique survival strategies such as hibernation, migration, and specialized body structures to withstand the cold and darkness.

5. How do scientists study polar day and night seasons?

Scientists study polar day and night seasons through various methods, including satellite imagery, ground-based observations, and weather and climate models. They also conduct research expeditions to collect data and study the effects of these seasons on the environment and living organisms. Additionally, scientists use historical data to analyze patterns and changes in polar day and night seasons over time.

Similar threads

  • Electrical Engineering
Replies
18
Views
2K
  • Astronomy and Astrophysics
Replies
10
Views
5K
  • Astronomy and Astrophysics
Replies
4
Views
3K
Back
Top