If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Sunrise - Sunset Calculator (Ruby)
5 posts
• Page 1 of 1
Sunrise - Sunset Calculator (Ruby)
So I found this Sunrise - Sunset formula on-line and thought it would be interesting to put it into Ruby, so I did, and it worked (eventually)
Here it is for anyone who's interested:
Here it is for anyone who's interested:
-
DaveyBoy - Posts: 131
- Joined: Wed May 11, 2016 9:18 pm
- Location: Leeds UK
Re: Sunrise - Sunset Calculator (Ruby)
that is cool !
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: Sunrise - Sunset Calculator (Ruby)
Yeah I thought so too. It seems very accurate when compared to on-line calculators. Not too sure about the altitude though . . . I added that myself after a little googling, hope I got it right
-
DaveyBoy - Posts: 131
- Joined: Wed May 11, 2016 9:18 pm
- Location: Leeds UK
Sunrise Sunset Calculator Ruby
The calculated times for sunset/sunrise are 4 hours later than they actually are. I checked the longitude/latitude coordinates for my zip code and they are correct. Any ideas?
-
PrDavid - Posts: 1
- Joined: Mon Feb 20, 2017 3:03 am
Re: Sunrise - Sunset Calculator (Ruby)
Hi PrDavid
I think it may be something to do with this line here:
# 10. convert UT value to local time zone of latitude/longitude
# localT = UT + localOffset + dst
localtr = utr + 0 + dst
localts = uts + 0 + dst
I may be wrong but I think the local offset is the difference between your time zone and 0 deg longitude. this would be 1 hour for every 15 deg. Mine is set to 0 because I'm in the UK. I'll dig out the original formula I found when I get home from work and post it up.
I think it may be something to do with this line here:
# 10. convert UT value to local time zone of latitude/longitude
# localT = UT + localOffset + dst
localtr = utr + 0 + dst
localts = uts + 0 + dst
I may be wrong but I think the local offset is the difference between your time zone and 0 deg longitude. this would be 1 hour for every 15 deg. Mine is set to 0 because I'm in the UK. I'll dig out the original formula I found when I get home from work and post it up.
-
DaveyBoy - Posts: 131
- Joined: Wed May 11, 2016 9:18 pm
- Location: Leeds UK
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 42 guests