Skip to main content

A Python library that deals with solar calculations

Project description

Solarflare

The purpose of this code is to provide a set of functions and a class, named Daystar, to facilitate calculations related to the position of the sun in the sky, such as the sunrise and sunset times, the position of the sun in the ecliptic and equatorial coordinates, the sidereal time, and the hour angle. The code imports two standard Python modules, math and datetime, to perform the necessary calculations. The code is intended to be used in formal settings where precise astronomical calculations are required, such as in scientific research or engineering applications. The Daystar class provides a convenient interface for performing multiple calculations related to the position of the sun at a given location, allowing the user to specify the latitude, longitude, and optionally, the height above sea level. You may modify the code and/or create pull requests, but you must grant the same permission to others, and include an MIT license with it.

PLEASE NOTE: THIS HAS BEEN A QUESTION ASKED MANY, MANY TIMES!! IF YOU SEE A SUNSET/RISE TIME THAT LOOKS IMPOSSIBLE, IT IS BECAUSE IT IS IN YOUR LOCAL TIME!!

Documentation

Descriptions of Functions (at solarflare.py)

  • sin(x), cos(x), tan(x), acos(x), asin(x), atan2(y, x): these functions provide trigonometric operations in degrees rather than radians.

  • julian_date(date=datetime.datetime.now()): calculates the Julian date of a given date and time. The Julian date is the number of days since noon (12:00) on January 1, 4713 BCE, in the Julian calendar.

  • mean_anomaly(date=datetime.datetime.now()): calculates the mean anomaly of the Sun for a given date and time. The mean anomaly is the angular distance between the perihelion (the point in the orbit of a planet or other celestial body where it is closest to the Sun) and the current position of the planet or body (in this case earth) in its orbit, measured in degrees.

  • equation(date=datetime.datetime.now()): calculates the equation of center, which is the difference between the true anomaly (the angle between the perihelion and the current position of the planet or body in its orbit, measured at the Sun) and the mean anomaly. This is used in the calculation of the ecliptical coordinates.

  • true_anomaly(date=datetime.datetime.now()): calculates the true anomaly of the Sun for a given date and time, taking into account the equation of center.

  • ecliptical_longitude(date=datetime.datetime.now()): calculates the ecliptical longitude of the Sun for a given date and time. The ecliptical longitude is the angular distance between the vernal equinox (the point on the celestial sphere where the ecliptic intersects the celestial equator, corresponding to the position of the Sun at the spring equinox) and the current position of the Sun in its orbit, measured in degrees.

  • declination(date=datetime.datetime.now()): calculates the declination of the Sun for a given date and time. The declination is the angular distance between the equator and the current position of the Sun in the sky, measured in degrees.

  • right_ascension(date=datetime.datetime.now()): calculates the right ascension of the Sun for a given date and time. The right ascension is the angular distance between the vernal equinox and the current position of the Sun in the sky, measured in degrees.

  • sidereal_time(longitude, time=datetime.datetime.now()): calculates the sidereal time for a given longitude and date and time. The sidereal time is the time elapsed since the vernal equinox, measured in hours.

  • solar_transit(longitude, date=datetime.datetime.now()): calculates the Julian date of the solar transit (the moment when the Sun is at its highest point in the sky) for a given longitude and date and time.

  • suntimes(latitude, longitude, date=datetime.datetime.now()): calculates the Julian dates of sunrise and sunset for a given latitude, longitude, and date and time.

  • sunrise(latitude, longitude, date=datetime.datetime.now()): returns the date and time of sunrise for a given latitude, longitude, and date and time.

  • sunset(latitude, longitude, date=datetime.datetime.now()): returns the date and time of sunset for a given latitude, longitude, and date and time.

  • hour_angle(longitude, date=datetime.datetime.now()): calculates the hour angle of the Sun for a given longitude and date and time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Solarflare-0.0.6.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

Solarflare-0.0.6-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file Solarflare-0.0.6.tar.gz.

File metadata

  • Download URL: Solarflare-0.0.6.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for Solarflare-0.0.6.tar.gz
Algorithm Hash digest
SHA256 d41726ead515ad04e623ada8fd86077e73c5dc777e86be57345fe3d2fbe3e55c
MD5 4929fa8ff6e8bd7bea0acc1462b091d4
BLAKE2b-256 efa81e9574e01917f9bf450dc4e21f0a6a2a2d1b61cc2020802080e0fe046c3f

See more details on using hashes here.

File details

Details for the file Solarflare-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: Solarflare-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for Solarflare-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a45197e6cbdeb7ebd5b3f1e9784aa5f49e3e7edb1a3485cba58a909d80ef3b93
MD5 a6febb29f99a06363a3930346f729456
BLAKE2b-256 d680d37173943278f4d261e320039aec7643e9c770af7ab4a07643fa4a2d1f0a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page