https://github.com/klausbrunner/gosolarpos
Package gosolarpos contains functions to find topocentric solar coordinates, i.e. the sun’s position on the sky at a given date, latitude, and longitude (and other parameters).
https://github.com/klausbrunner/gosolarpos
golang solar sun
Last synced: 4 months ago
JSON representation
Package gosolarpos contains functions to find topocentric solar coordinates, i.e. the sun’s position on the sky at a given date, latitude, and longitude (and other parameters).
- Host: GitHub
- URL: https://github.com/klausbrunner/gosolarpos
- Owner: klausbrunner
- License: mit
- Created: 2015-07-01T15:12:31.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-03-22T06:59:35.000Z (about 3 years ago)
- Last Synced: 2024-06-20T15:07:23.245Z (almost 2 years ago)
- Topics: golang, solar, sun
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
gosolarpos
==========

Package gosolarpos contains functions to find topocentric solar coordinates, i.e. the sun’s position on the sky at a given date, latitude, and longitude (and other parameters).
This is a partial Golang port of https://github.com/klausbrunner/solarpositioning. Currently, only the [Grena/ENEA](http://dx.doi.org/10.1016/j.solener.2012.01.024) #3 algorithm is included - which should be fine for most applications, and preferable to many of the unattributed sun position calculation snippets floating around the Web.
Usage
-----
To use this module:
```Go
import (
"github.com/klausbrunner/gosolarpos"
)
azimuthDegrees, zenithDegrees := gosolarpos.Grena3(time.Now(),
52.521667, // latitude (degrees)
13.413333, // longitude (degrees)
68, // Delta T (s) - if unknown, use EstimateDeltaT()
1000, // air pressure (hPa)
20) // air temperature (°C)
println(azimuthDegrees, zenithDegrees)
```
A simple CLI is also available:
```console
$ cd cmd/sol
$ go install
$ sol --lat 48.266667 --lon -116.566667
using current time: 2023-01-22 09:46:27.86356 +0100 CET m=+0.000386917
estimating delta-T: 70.81
using standard sea-level pressure: 1013.25 hPa
azimuth: 23.252482° zenith: 149.786614°
```