calcelestial calculates positions, rise & set times of celestial bodies
Go to file
Steffen Vogel 97b5185e51 Merge pull request #17 from justinotherguy/master
updated link to blog posting in readme.md
2017-03-03 11:06:31 -04:00
doc updated documentation, added tests, fix Travis 2016-10-27 02:31:06 -04:00
src removed debug info 2017-03-03 11:01:57 -04:00
.gitignore removed autoconf / automaker products from repo. 2016-10-26 17:24:19 -04:00
.travis.yml fix Travis-CI 2016-10-28 00:41:46 -04:00
AUTHORS updated legacy files 2012-12-23 11:25:06 +01:00
COPYING replaced symlinks by their targets 2012-12-23 18:02:58 +01:00
ChangeLog Version bump to 0.4, updated Readme and Changelog 2016-10-27 23:22:03 -04:00
Makefile.am show some output during test 2016-10-28 00:41:46 -04:00
NEWS initial commit 2012-11-22 18:58:01 +01:00
README.md Merge pull request #17 from justinotherguy/master 2017-03-03 11:06:31 -04:00
TODO moved ToDos to GitHub 2016-10-28 00:48:33 -04:00
configure.ac smaller cleanups and version bump to 0.5 2017-03-03 10:45:51 -04:00

README.md

calcelestial Build Status

calcelestial calculates the sun's rise/set times, the solar noon and the daylight time duration.

See manpage calcelestial(1) and the blog entry for more information

Installation

Linux

sudo apt-get install -y libnova-dev libcurl4-openssl-dev libjson-c-dev libdb-dev autoconf make gcc pkg-config
autoreconf -i && ./configure && make install

macOS

brew install curl json-c berkeley-db pkg-config
git clone git://git.code.sf.net/p/libnova/libnova libnova && pushd libnova && autoreconf -if && ./configure && make && sudo make install; popd
autoreconf -i && ./configure && make install

Usage

Usage:
  Calcelestial [options]

Options:
  -p, --object		calc for celestial object: sun, moon, mars, neptune,
			 jupiter, mercury, uranus, saturn, venus or pluto
  -H, --horizon		calc rise/set time with twilight: nautic, civil or astronomical
  -t, --time		calc at given time: YYYY-MM-DD[_HH:MM:SS]
  -m, --moment		calc position at moment of: rise, set, transit
  -n, --next		use rise, set, transit time of tomorrow
  -f, --format		output format: see strftime (3) and calcelestial (1) for more details
  -a, --lat		geographical latitude of observer: -90° to 90°
  -o, --lon		geographical longitude of oberserver: -180° to 180°
  -q, --query		query coordinates using the geonames.org geolocation service
  -l, --local		query local timezone using the geonames.org geolocation service
  -z, --timezone	override system timezone (TZ environment variable)
  -u, --universal	use universial time for parsing and formatting
  -h, --help		show usage help
  -v, --version		show version

Note: A combination of --lat & --lon or --query is required.

The following special tokens are supported in the --format parameter:

  §J	Julian date of observation
  §d	Diameter in arc seconds
  §e	Distance to object in astronomical units
  §r	Equatorial Coordinates: Right Ascension in degrees
  §d	Equatorial Coordinates: Declincation in degrees
  §a	Horizontal Coordinates: Azimuth in degrees
  §h	Horizontal Coordinates: Altitude in degrees
  §A	Latitude in degrees
  §O	Longitude in degrees
  §s	Azimuth direction (N, E, S, W, NE, ...)

Calcelestial is written by Steffen Vogel <post@steffenvogel.de>
Please report bugs to: https://github.com/stv0g/calcelestial/issues

Examples

The simplest variant uses the Unix tool at(1) to schedule a command at a specific event:

echo ~/bin/turn-lights-on | at $(calcelestial -p sun -m set -q Frankfurt -H civil)

The following cronjobs automate this task everyday with updated times:

0 0 * * * echo 'fnctl stop && fnctl fade -c 000000' | at $(calcelestial -m rise -p sun -q Aachen)
0 0 * * * echo 'fnctl start' | at $(calcelestial -m set -p sun -q Frankfurt)

The tool nvram-wakeup, can be used to turn on the system everyday 10 minutes before sunrise in Berlin:

nvram-wakeup -s $(date -d "$(calcelestial -m rise -p sun -q Berlin --format %+)" -10 minutes" +%s)

Or alternatively, the system can be shut down 10 minutes after sunset:

shutdown $(date -d "$(calcelestial -m rise -p sun --lat=50.55 --lon=-6.2 --format %+) +10 minutes" +%H:%M)

The current position of the moon can be estimated with:

calcelestial -p moon -q Aachen -f "az: §a alt: §h"

License

calcelestial is licensed under GPLv3.

Author

calcelestial is written by Steffen Vogel post@steffenvogel.de