sunwhere. Solar position calculation for solar resource assessment
sunwhere is a Python library designed for fast and accurate calculations of solar position for solar resource applications 🌞.
sunwhere provides solar zenith and azimuth angles, sun-earth distance correction factor, and secondary parameters such as solar declination, equation of time, and many more. It's optimized for typical workflows in solar energy research and engineering.
It is optimized for three common use cases that cover most practical scenarios:
-
sites() - Multiple arbitrary locations with common time grid
-
regular_grid() - Lat-lon regular grids (ideal for spatio-temporal data)
-
transect() - Moving observers (satellites, aircraft, ships)
Installation
pip install sunwhere
or using uv:
uv add sunwhere
Quick examples
import pandas as pd
import sunwhere
lat, lon = 36.9369, -3.7943
times = pd.date_range("2026-06-02", periods=24*60, freq="min", tz="Europe/Madrid")
solpos = sunwhere.sites(times, lat, lon, site_names=("Jayena",))
solar_zenith = solpos.zenith # xarray's dataarray with dims (time, site)
solar_zenith = solpos.zenith.sel(site="Jayena").to_pandas() # pandas series
solar_azimuth = solpos.azimuth # degrees in [-180, 180], zero south, negative before noon
The time coordinate of the outputs is always naive UTC, even if the input times are timezone-aware.
import numpy as np
import pandas as pd
import sunwhere
lats = np.arange(30, 60.1, 0.5)
lons = np.arange(-10, 50.1, 0.5)
times = pd.date_range("2026-06-02", periods=24, freq="h", tz="Europe/Madrid")
solpos = sunwhere.regular_grid(times, lats, lons)
solar_zenith = solpos.zenith # xarray's dataarray with dims (time, lat, lon)
Documentation
Full documentation — installation guide, user guide, quick reference, and API reference — is available at:
https://jararias.github.io/sunwhere/
Citation
If you use sunwhere in your research, please cite:
@software{sunwhere,
author = {Ruiz-Arias, Jose A.},
title = {sunwhere: Solar position for solar resource assessment},
doi = {10.5281/zenodo.21975084},
url = {https://github.com/jararias/sunwhere}
}
The DOI 10.5281/zenodo.21975084 always resolves to the latest version. Each release also has its own version-specific DOI, listed on Zenodo.
License
sunwhere is distributed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license (CC BY-NC-SA 4.0):
- Free for research, teaching and other non-commercial use, with attribution.
- Commercial use is not permitted under this license. For commercial use, contact the author.
- Derivative works must be distributed under the same license.
Metadata
Release files for sunwhere 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sunwhere-1.5.0.tar.gz | 48.2 kB | Without provenance | Details for sunwhere-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sunwhere-1.5.0-py3-none-any.whl | Python 3 | none | any | Details for sunwhere-1.5.0-py3-none-any.whl |
Total release size: 109.6 kB
Release files / sunwhere-1.5.0.tar.gz
| Download URL | sunwhere-1.5.0.tar.gz |
|---|---|
| Size | 48.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b2a193740d76145d4d776ded4e101f79c3b86942c6d958d9372c566509e59cc
|
|
BLAKE2b-256 checksum How to use checksums |
2d93d60f30fc6d3bd8b82165b7a6d2f819e9e622e0dcb5634888ef31b1722c80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sunwhere-1.5.0-py3-none-any.whl
| Download URL | sunwhere-1.5.0-py3-none-any.whl |
|---|---|
| Size | 61.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fde921966c296bd984fb8f0baebb4e426d86944919a8b3861cf21e901918b34
|
|
BLAKE2b-256 checksum How to use checksums |
e863db7edd72b8ad48ba5627018794af462fee0efc7eb300a8c73bfbf0e9f8e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sunwhere 1.5.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.