Skip to main content

Fast and accurate solar position calculations for solar resource assessment

Project description

python versions tests-badge coverage-badge

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.

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

sunwhere-1.4.1.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sunwhere-1.4.1-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

Details for the file sunwhere-1.4.1.tar.gz.

File metadata

  • Download URL: sunwhere-1.4.1.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for sunwhere-1.4.1.tar.gz
Algorithm Hash digest
SHA256 beab84faa0c37d8d5078b03a2d0e91edad5868cd1b457d6a2681e091d5863f40
MD5 01d22c342676d221b9d18564f5bc577a
BLAKE2b-256 bb4bc0b7035b41a005637d84e74dbcb50abe509b3e8574ba4c0cfee35a204d4c

See more details on using hashes here.

File details

Details for the file sunwhere-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: sunwhere-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 59.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for sunwhere-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2efff2132d3b598a6841fc93bef42b5bc95e4d0de98ad06cbaf9d3cc38148fc1
MD5 54afbe6a25f7ad0c3413ccda089892a5
BLAKE2b-256 5b1c7123e79849e46d60e8315c4c28524741adefd4d54ce667acc948e2f8dc76

See more details on using hashes here.

Supported by

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