GithubHelp home page GithubHelp logo

suncalcpy's Introduction

SunCalcPy

A Python library for calculating sun/moon times, positions and phases. Includes methods for getting:

  • sunrise
  • sunset
  • moonrise
  • moonset
  • golden hour
  • sun position
  • moon position
  • moon illumination
  • and more!

Installing

pip install suncalcPy

Usage examples:

Get sunrise, sunset, golden hour and other times for San Francisco:
>>> import suncalc
>>> suncalc.getTimes(datetime.now(), 37.7749, -122.4194)
{
   'sunriseEnd': '2017-09-06 06:48:24', 
   'goldenHourEnd': '2017-09-06 07:20:27', 
   'dusk': '2017-09-06 19:59:44', 
   'nightEnd': '2017-09-06 05:15:09', 
   'night': '2017-09-06 21:03:39', 
   'goldenHour': '2017-09-06 18:58:21', 
   'sunset': '2017-09-06 19:33:08', 
   'nauticalDawn': '2017-09-06 05:47:35', 
   'sunsetStart': '2017-09-06 19:30:24', 
   'dawn': '2017-09-06 06:19:04', 
   'nauticalDusk': '2017-09-06 20:31:13', 
   'sunrise': '2017-09-06 06:45:40'
}
Get moon illumination information:
>>> import suncalc
>>> suncalc.getMoonIllumination(datetime.now())
{
   'phase': 0.5198419002220316, 
   'angle': 1.574687975565145, 
   'fraction': 0.9961193570459752
}
Get moonrise/moonset times for San Francisco:
>>> import suncalc
>>> suncalc.getMoonTimes(datetime.now(), 37.7749, -122.4194)
{
   'rise': datetime.datetime(2017, 9, 6, 20, 4, 29, 213367), 
   'set': datetime.datetime(2017, 9, 6, 6, 56, 30, 536332)
}

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.