Skip to content

Commit

Permalink
Initial port to Go
Browse files Browse the repository at this point in the history
  • Loading branch information
sj14 committed Apr 18, 2021
1 parent 96496f0 commit 1547d87
Show file tree
Hide file tree
Showing 120 changed files with 1,918 additions and 22,339 deletions.
18 changes: 0 additions & 18 deletions .editorconfig

This file was deleted.

1 change: 0 additions & 1 deletion .env

This file was deleted.

Empty file removed .gitattributes
Empty file.
25 changes: 25 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Go
on:
- push
- pull_request
jobs:
build:
name: Test
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: go build -v ./cmd/astral/
- name: Test
run: go test -race ./...
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Simon Kennedy
Wojciech Pietruszeski
Zachary Priddy
Michael Marx
Simon Jürgensmeyer
106 changes: 0 additions & 106 deletions ChangeLog.md

This file was deleted.

6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

44 changes: 0 additions & 44 deletions Makefile

This file was deleted.

75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Astral

![Action](https://github.com/sj14/astral/workflows/Go/badge.svg)
[![GoDoc](https://godoc.org/github.com/sj14/astral?status.png)](https://godoc.org/github.com/sj14/astral)

Calculations for the position of the sun and moon.

This is a Go port of the Python [astral](https://github.com/sffjunkie/astral) package.

The `astral` package provides the means to calculate the following times of the sun:

* dawn
* sunrise
* noon
* midnight
* sunset
* dusk
* daylight
* night
* twilight
* blue hour
* golden hour
* ~~rahukaalam~~ TODO

plus solar azimuth and elevation at a specific latitude/longitude.
It can also calculate the moon phase for a specific date.

## CLI

Besides the package for usage in you own programs, we also provide a tool for showing the data.

### Installation

```text
go get github.com/sj14/astral/cmd/astral
```

### Usage

```text
Usage of astral:
-elev float
elevation of the observer
-format string
time output format according to Go parsing (default "Jan _2 15:04:05")
-lat float
latitude of the observer
-long float
longitude of the observer
-time string
day/time used for the calculation (defaults to current time)
```

### Example

```text
$ astral -lat 51.58 -long 6.52
Sun Apr 18 11:12:45 CEST 2021
Latitude 51.58 Longitude 6.52 Elevation 0
Apr 18 05:55:07 Dawn
Apr 18 05:55:07 Blue Hour Start
Apr 18 06:09:04 Blue Hour End
Apr 18 06:09:04 Golden Hour Start
Apr 18 06:31:44 Sunrise
Apr 18 07:15:56 Golden Hour End
Apr 18 13:33:18 Noon
Apr 18 19:51:24 Golden Hour Start
Apr 18 20:35:45 Sunset
Apr 18 20:58:33 Golden Hour End
Apr 18 20:58:33 Blue Hour Start
Apr 18 21:12:35 Blue Hour End
Apr 18 21:12:35 Dusk
Apr 19 01:33:13 Midnight
Moon Phase: New Moon (5.47788888888889)
```
18 changes: 0 additions & 18 deletions README.rst

This file was deleted.

Loading

0 comments on commit 1547d87

Please sign in to comment.