Sun Position Calculator:
The Sun Position Calculator is a Python library that provides a convenient way to calculate the azimuth and altitude of the sun for a given date, time, and location. It also allows you to determine various sun-related phases such as sunrise, sunset, dawn, dusk, and more based on different angles.
Installation:
You can easily install the library via pip:
pip install sun-position-calculator
Usage:
Example 1: Calculate Sun Position
import math
from sun_position_calculator import SunPositionCalculator
# Replace the latitude and longitude with your desired location
latitude = 37.7749
longitude = -122.4194
# Replace the UNIX timestamp with the desired date and time
unixtime_in_ms = 1679795200000 # Example: 10th May 2023, 12:00 PM (UTC)
# Create an instance of the SunPositionCalculator
calculator = SunPositionCalculator()
# Calculate the sun position
position = calculator.pos(unixtime_in_ms, latitude, longitude)
azimuth = math.degrees(position.azimuth)
altitude = math.degrees(position.altitude)
print(f"Sun Azimuth: {azimuth:.2f} degrees")
print(f"Sun Altitude: {altitude:.2f} degrees")
Example 2: Find Time of Sunrise
from sun_position_calculator import SunPositionCalculator, SunPhase
# Replace the latitude and longitude with your desired location
latitude = 37.7749
longitude = -122.4194
# Replace the UNIX timestamp with the desired date
unixtime_in_ms = 1679795200000 # Example: 10th May 2023, 12:00 PM (UTC)
# Create an instance of the SunPositionCalculator
calculator = SunPositionCalculator()
# Find the time of sunrise at the given location
sunrise_time = calculator.time_at_phase(unixtime_in_ms, SunPhase.sunrise(), latitude, longitude, height=0)
print(f"Sunrise time: {sunrise_time}")
Getting Help:
So you need help.
People can help you, but first help them help you, and don't waste their time.
Provide a complete description of the issue.
If it works on A but not on B and others have to ask you: "so what is different between A and B" you are wasting everyone's time.
"hello", "please" and "thanks" are not swear words.
License:
This library is distributed under the GNU General Public License (GPL) version 3.
You are free to use, modify, and distribute this library under the terms of the GPL v3. However, any derivative work based on this library must also be licensed under the GPL v3, and the source code of the derivative work must be made available to others.
For more details, please refer to the GPL v3 License or see the LICENSE file.
Metadata
Release files for sun-position-calculator 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sun_position_calculator-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sun_position_calculator-1.0.0-py3-none-any.whl |
Release files / sun_position_calculator-1.0.0-py3-none-any.whl
| Download URL | sun_position_calculator-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae247c57bc7dc30866c6a4d67e6f5bd73e540c868fe176f1eaae4bdd38d01e19
|
|
BLAKE2b-256 checksum How to use checksums |
a9d3c5879ea2d8420a71f1c82580f385f225b03812ac012b95abd0bb7c860dd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for sun-position-calculator 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.