Skip to main content

python versions tests-badge coverage-badge DOI

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 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
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, lat, lon)
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{sunwhere2024,
  author = {Ruiz-Arias, Jose A.},
  title = {sunwhere: Solar position for solar resource assessment},
  year = {2024},
  url = {https://github.com/jararias/sunwhere}
}

License

CC BY-NC-SA 4.0 — free for non-commercial use with attribution.

Metadata

Release files for sunwhere 1.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sunwhere 1.4.2
File Size Uploaded
sunwhere-1.4.2.tar.gz 47.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sunwhere 1.4.2
File Interpreter ABI Platform
sunwhere-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 106.6 kB

Release files / sunwhere-1.4.2.tar.gz

Download URL sunwhere-1.4.2.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f131982b0b0d12fa1acec76c720b3c350bb140089ca1337cf658aadb134d33bd
BLAKE2b-256 checksum
How to use checksums
2145a6bfea77c018da3a5a28a94572da7f43428feb8f2dd41ad51b39ba84b9fc
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.4.2-py3-none-any.whl

Download URL sunwhere-1.4.2-py3-none-any.whl
Size 59.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ee5425d810fcb3e927a18a4bef3ffd9642d6da576267b8cac47c9a0dc6dfc18
BLAKE2b-256 checksum
How to use checksums
dfbe3098bafe2ec018c3fc795c884762e4a76977d0e495a96dab6c8348238600
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 history Release notifications | RSS feed

1.5.0

2 release files

This release

1.4.2 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page