Coder Social home page Coder Social logo

captn3m0 / suntime Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 11 KB

Crystal library for calculating sunrise and sunset times.

Home Page: https://github.com/captn3m0/suntime

License: MIT License

Crystal 100.00%
crystal-shard noaa sunrise sunset time

suntime's Introduction

suntime

Crystal library for calculating sunrise and sunset times. Uses the algorithm from https://www.esrl.noaa.gov/gmd/grad/solcalc/solareqns.PDF

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      suntime:
        github: captn3m0/suntime
  2. Run shards install

Usage

require "suntime"

# Time is optional, local time is used otherwise
# It returns sunrise/sunset for TODAY, so if you want the next sunset, check accordingly
s = Suntime::Suntime.new(lat,long, time)
# Bangalore
s = Suntime::Suntime.new(12.955800, 77.620979)
s.sunrise
# 2020-05-22 05:52:48.0 +05:30 Local
s.sunset
# 2020-05-22 18:39:43.0 +05:30 Local

You can pass in a different time. The date is used for calculating the sunrise/sunset, and the timezone is used for return formatting.

TODO

  • Implement the Atmospheric Refraction Effect calculation
  • Uncomment true_solar_time after converting it to proper time object

Contributing

  1. Fork it (https://github.com/captn3m0/suntime/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Nemo - creator and maintainer

License

Licensed under the MIT License. See LICENSE file for details.

suntime's People

Contributors

captn3m0 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.