sun-position-calculator


Namesun-position-calculator JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://notabug.org/alimiracle/sun_position_calculator
SummaryA Python library to calculate the sun's position and phases.
upload_time2023-07-22 07:45:08
maintainer
docs_urlNone
authorAli miracle
requires_python
license
keywords sun position calculator astronomy phases python library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
pip install sun-position-calculator
```

## Usage:

Example 1: Calculate Sun Position

```python
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

```python
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](https://www.gnu.org/licenses/gpl-3.0.en.html).

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](https://www.gnu.org/licenses/gpl-3.0.en.html) or see the [LICENSE](https://github.com/your_username/sun-position-calculator/blob/main/LICENSE) file.



            

Raw data

            {
    "_id": null,
    "home_page": "https://notabug.org/alimiracle/sun_position_calculator",
    "name": "sun-position-calculator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "sun position calculator astronomy phases python library",
    "author": "Ali miracle",
    "author_email": "alimiracle@riseup.net",
    "download_url": "",
    "platform": null,
    "description": "# Sun Position Calculator:\n\nThe 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.\n\n## Installation:\n\nYou can easily install the library via pip:\n\n```bash\npip install sun-position-calculator\n```\n\n## Usage:\n\nExample 1: Calculate Sun Position\n\n```python\nimport math\nfrom sun_position_calculator import SunPositionCalculator\n\n# Replace the latitude and longitude with your desired location\nlatitude = 37.7749\nlongitude = -122.4194\n\n# Replace the UNIX timestamp with the desired date and time\nunixtime_in_ms = 1679795200000  # Example: 10th May 2023, 12:00 PM (UTC)\n\n# Create an instance of the SunPositionCalculator\ncalculator = SunPositionCalculator()\n\n# Calculate the sun position\nposition = calculator.pos(unixtime_in_ms, latitude, longitude)\nazimuth = math.degrees(position.azimuth)\naltitude = math.degrees(position.altitude)\n\nprint(f\"Sun Azimuth: {azimuth:.2f} degrees\")\nprint(f\"Sun Altitude: {altitude:.2f} degrees\")\n```\n\nExample 2: Find Time of Sunrise\n\n```python\nfrom sun_position_calculator import SunPositionCalculator, SunPhase\n\n# Replace the latitude and longitude with your desired location\nlatitude = 37.7749\nlongitude = -122.4194\n\n# Replace the UNIX timestamp with the desired date\nunixtime_in_ms = 1679795200000  # Example: 10th May 2023, 12:00 PM (UTC)\n\n# Create an instance of the SunPositionCalculator\ncalculator = SunPositionCalculator()\n\n# Find the time of sunrise at the given location\nsunrise_time = calculator.time_at_phase(unixtime_in_ms, SunPhase.sunrise(), latitude, longitude, height=0)\n\nprint(f\"Sunrise time: {sunrise_time}\")\n```\n\n## Getting Help:\n\nSo you need help.\n\nPeople can help you, but first help them help you, and don't waste their time.\n\nProvide a complete description of the issue.\n\nIf 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.\n\n\"hello\", \"please\" and \"thanks\" are not swear words.\n\n## License:\n\nThis library is distributed under the [GNU General Public License (GPL) version 3](https://www.gnu.org/licenses/gpl-3.0.en.html).\n\nYou 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.\n\nFor more details, please refer to the [GPL v3 License](https://www.gnu.org/licenses/gpl-3.0.en.html) or see the [LICENSE](https://github.com/your_username/sun-position-calculator/blob/main/LICENSE) file.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python library to calculate the sun's position and phases.",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://notabug.org/alimiracle/sun_position_calculator"
    },
    "split_keywords": [
        "sun",
        "position",
        "calculator",
        "astronomy",
        "phases",
        "python",
        "library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9d3c5879ea2d8420a71f1c82580f385f225b03812ac012b95abd0bb7c860dd4",
                "md5": "7d750463b2ab8ab7844d2e68db2cc51c",
                "sha256": "ae247c57bc7dc30866c6a4d67e6f5bd73e540c868fe176f1eaae4bdd38d01e19"
            },
            "downloads": -1,
            "filename": "sun_position_calculator-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d750463b2ab8ab7844d2e68db2cc51c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17068,
            "upload_time": "2023-07-22T07:45:08",
            "upload_time_iso_8601": "2023-07-22T07:45:08.888089Z",
            "url": "https://files.pythonhosted.org/packages/a9/d3/c5879ea2d8420a71f1c82580f385f225b03812ac012b95abd0bb7c860dd4/sun_position_calculator-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-22 07:45:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sun-position-calculator"
}
        
Elapsed time: 0.22058s