Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error with Sunrise.pm

Status
Not open for further replies.

clarissa1996

Technical User
Jan 31, 2002
78
0
0
CH
Hi all,

I use the perl module Sunrise.pm. All works perfectly.
But I have a problem with a single date (this is very strange !!).

The following perl script:

($sunrise, $sunset) = sunrise(2005, 3, 20, -7.4, 46.9, 0, 0, -6);

... generate the following error:

Sun never sets!!

(Note: $sunrise and $sunset = 00:37)

Input parameters seems me correct.
Longitude and latitude are of the city of Bern (Switzerland).

I appreciate very much if someone can help me.

Best Regards.

Clarissa
 
Aaah! Where the sun never sets...

Could it be this?

Eastern longitude is entered as a positive number
Western longitude is entered as a negative number
Northern latitude is entered as a positive number
Southern latitude is entered as a negative number

FNL
 
Hi Effennel,

thanks for your help.
I have inserted the correct sign (+7.4).
The error is disappears but the sunrise and sunset values for 3/20/2005 are not calculated correctly.

3/19/2005 Sunrise: 06:06, Sunset: 19:10
3/20/2005 Sunrise: 06:49, Sunset: 18:26
3/21/2005 Sunrise: 05:59, Sunset: 19:16

Another question:
-7.4 +46.9 is somewhere north of Spain.
Why the program do not works correctly for this place ?

Thanks in advance. Clarissa
 
Clarissa,

What about other dates?

Regarding the other Q?:
This is how I understand the + and - in front of the (latitude,longitude):

Greenwich
|
(+,-) | (+,+)
|
----------------------------------------- equator
|
(-,-) | (-,+)
|

So I think north of Spain in (+,+)...

FNL
 
Hi Effennel,

Question 1:
Until now I have found the error only for date 3/20/2005. Also for latitude=0 and longitude=0 the values of sunrise and sunset for the dates 19-20-21 March 2005 are not "linear". The problem is always day 3/20/2005.
Maybe you can calculate the sunrise/sunset for your latutine/longitudine for the days 19-20-21 March 2005 and report the results.

Question 2:
Switzerland is east of Greenwich (+,+).
Spain is west of Greenwich (+,-).
... However it remains the problem that with some (good) coordinates the program returns an error


Best Regards.

Clarissa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top