equationoftime¶ ↑
- Home
- Code
- RDoc
-
www.rubydoc.info/github/DouglasAllen/gem-equationoftime/master
- Issues
DESCRIPTION:¶ ↑
Calculate Sunrise and Sunset. Now uses native C wrappers. Lots of examples to play with for learning about Eot.
FEATURES/PROBLEMS:¶ ↑
-
Use GeoLatLng class to set coordinates or set them manually.
SYNOPSIS:¶ ↑
start irb¶ ↑
$ irb --simple-prompt
enter Code¶ ↑
require 'eot' eot = Eot.new eot.string_eot # todays eot eot.ajd # was initialized to noon today ei. jd # Try the real AJD eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd.to_f eot.string_eot # nothing changes so... eot.ma_ta_set # recalculate ma and ta after initialization eot.string_eot # should be different than before # check and set a new address geo = GeoLatLng.new geo.addr geo.addr = "houston, tx" # set new location geo.set_coordinates # set new coordinates eot.latitude = geo.lat # set the Eot class attributes eot.longitude = geo.lng # Be shure you have the date set right eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd.to_i eot.ma_ta_set # recalculate ma and ta after initialization eot.sunrise_dt.to_time.localtime("-05:00") # the dates sunrise as DateTime eot.local_noon_dt.to_time.localtime("-05:00") # the dates transit as DateTime eot.sunset_dt.to_time.localtime("-05:00") # the dates sunset as a DateTime eot.ajd += 1 # the days after times can be read eot.ma_ta_set # recalculate ma and ta after jd changes eot.sunrise_dt.to_time.localtime("-05:00") eot.local_noon_dt.to_time.localtime("-05:00") eot.sunset_dt.to_time.localtime("-05:00")
Gem patch:¶ ↑
$ gem install eot
After realizing this name was available I decided to use it. It installs the needed requirements as for some reason gem install equationoftime doesn’t always. Hoe hoe hoe!
REQUIREMENTS:¶ ↑
$ bundle install
INSTALL:¶ ↑
$ bundle exec rake install
Build with DEVKIT¶ ↑
cd to devkit dir and run devkitvars.bat or make a batchfile to start your envirnment with 'run devkitvars' cd to gem-equationoftime dir Rake -T
DEVELOPERS:¶ ↑
After checking out the source, run:
$ bundle exec rake newb
This task will install any missing dependencies, run the tests/specs, and generate the RDoc.
LICENSE:¶ ↑
(The MIT License)
Copyright © 2014
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.