Skip to content

do some basic astro calculations related to moon and sun

Notifications You must be signed in to change notification settings

triole/astrocalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Astrocalc build test

Synopsis

A command line tool to do simple astro calculations. Different output formats are supported.

Howto

Http server use

Run astrocalc -s to spin up server. Do stuff like...

curl http://localhost:8080?loc=london

curl http://localhost:8080?lat=51.5073509&lon=-0.1277583

Command line use

Run for example astrocalc london or astrocalc 51.507 -0.127

Data output example

{
  "time": "2024-09-01T10:34:54.166370333+02:00",
  "location": {
    "lat": 51.5073509,
    "lon": -0.1277583,
    "name": "London"
  },
  "sun": {
    "light": {
      "dawn": "2024-09-01T04:40:05.100157952Z",
      "dusk": "2024-09-01T19:23:50.837085952Z",
      "golden_hour": "2024-09-01T18:04:21.184260352Z",
      "golden_hour_end": "2024-09-01T05:59:34.752983296Z",
      "nadir": "2024-09-01T00:01:57.968621824Z",
      "nautical_dawn": "2024-09-01T03:57:18.178896896Z",
      "nautical_dusk": "2024-09-01T20:06:37.758346752Z",
      "night": "2024-09-01T20:53:50.73799168Z",
      "night_end": "2024-09-01T03:10:05.199251968Z",
      "solar_noon": "2024-09-01T12:01:57.968621824Z",
      "sunrise": "2024-09-01T05:14:57.656500224Z",
      "sunrise_end": "2024-09-01T05:18:29.378023424Z",
      "sunset": "2024-09-01T18:48:58.280743424Z",
      "sunset_start": "2024-09-01T18:45:26.559220224Z"
    },
    "position": {
      "altitude": 0.5180177725094327,
      "azimuth": -1.100788368879874
    }
  },
  "moon": {
    "light": {
      "always_down": false,
      "always_up": false,
      "rise": "2024-09-01T04:00:00+02:00",
      "set": "2024-09-01T20:00:00+02:00"
    },
    "position": {
      "altitude": 0.81738638265308,
      "azimuth": -0.9305146132357468,
      "distance": 398068.5939872828,
      "parallactic_angle": -0.5540484171960416
    },
    "illumination": {
      "angle": 2.1114360879257674,
      "fraction": 0.026634652557527283,
      "phase": 0.9478180102947805
    }
  }
}

Help

Usage: astrocalc [<location> ...] [flags]

simple astronomical calculation

Arguments:
  [<location> ...]    location to use

Flags:
  -h, --help             Show context-sensitive help.
  -s, --server           run web server, http instead of command line use
  -p, --port=8080        web web server port
  -f, --format="json"    output format, can be: json, toml, yaml
  -V, --version-flag     display version

About

do some basic astro calculations related to moon and sun

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages