GithubHelp home page GithubHelp logo

skrushinsky / astro-montenbruck Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 7.0 337 KB

Library of astronomical calculations, based on "Astronomy On The Personal Computer" by O.Montenbruck and T.Phleger .

License: Other

Perl 100.00%
astronomy astronomy-library astronomical-algorithms ephemeris ephemerides

astro-montenbruck's Introduction

Astro::Montenbruck

Overview

Library of astronomical calculations, based on "Astronomy On The Personal Computer" by O.Montenbruck and T.Phleger, Fourth Edition, Springer-Verlag, 2000.

The main purpose of the library is to calculate positions of the Sun, the Moon, and the planets with precision that is approximately the same as that found in astronomical yearbooks. Other modules contain time-related routines, coordinates conversions, calculation of the ecliptic obliquity and nutation, etc. Over time, the range of utility functions will grow.

Partially it overlaps some code which already exists in CPAN and elsewhere. For instance, there is a Perl wrapper for Swiss Ephemeris. Swiss Ephemeris is fast and precise C library. Unfortunately, it lacks portability and convenient license. So, it is not easy for a layman to customize it for her custom application, be it an online lunar calendar, or tool for amateur sky observations.

The present library is an attempt to find a middle-ground between precision on the one hand and compact, well organized code on the other. I tried to follow the best practices of modern Perl programming.

Precision

As the book authors state in Introduction to the 4-th edition, "The errors in the fundamental routines for determining the coordinates of the Sun, the Moon, and the planets amount to about 1″-3″.

Contents

Requirements

  • Perl >= 5.22

Tested on Linux 64-bit, macOS 10.14 and Windows 10 64-bit. There should be no problems at other platforms, as the code is pure Perl.

Perl dependencies are minimal, most of the external modules are part of the standard distribution. DateTime is not really required. It is used only in example scripts and tests, not the library itself.

Installation

To install this module, run the following commands:

$ perl Build.PL
$ ./Build
$ ./Build installdeps
$ ./Build test
$ ./Build install

Documentation

After installing, you can find documentation for this module with the perldoc command from the parent directory of the library:

$ perldoc Astro::Montenbruck
$ perldoc Astro::Montenbruck::Ephemeris

You may also generate local HTML documentation:

$ perl script/createdocs.pl

Documentation files will be installed to docs/ directory.

Scripts

script/ directory contains examples of the library usage. They will be extended over time.

  • planpos.pl — positions of Sun, Moon and the planets
  • riseset.pl — rises and sets of celestial objects
  • phases.pl — lunar phases
  • rst_almanac.pl — rises/sets/transits events for a range of dates
  • solequ.pl — solstices and equinoxes
  • mercury.pl — very simple demo of calculating Mercury position
  • moon_almanac.pl — rises, sets of the Moon, its positions and lunar phase circumstances for a range of dates

Example

To display current planetary positions, type:

$ perl script/planpos.pl

For list of available options. type:

$ perl script/planpos.pl --help

Most of the scripts have --help option for a short list of options and --man for an extended description.

How to contribute

You may contribute to the project by many different ways, starting from refining and correcting its documentation, especially if you are a native English speaker, and ending with improving the code base. Any kind of testing and suggestions are welcome.

You may follow the standard Github procedures or, in case you are not comfortable with them, just send your suggestions to the author by email: krushi at cpan.org.

License And Copyright

Copyright (C) 2010-2022 Sergey Krushinsky

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (1.0). You may obtain a copy of the full license here.

Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package.

The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

astro-montenbruck's People

Contributors

skrushinsky avatar tbrowder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

astro-montenbruck's Issues

Function 'jd2cal' optional named argument 'gregorian' should be named 'julian'

For this user, the name of the argument is counter-intuitive. At first glance it seems that the default value should be true, and the user should enter a false value if an old-style value is desired.

Another option could be to have the same optional named argument as the cal2jd function, 'gregorian_start'.

(Note this issue is being filed by a former Perl user who now speaks Raku more fluently and is trying to port the functions to Raku. This user also is a very new user of astronomical calculations, so please forgive me if this issue isn't apprpriate.)

Script riseset.pl throws at one set of args

Installed Perl:

$ perl -v
This is perl 5, version 28, subversion 1 (v5.28.1) built for x86_64-linux-gnu-thread-multi

Try to execute script riseset.pl:

$ perl script/riseset.pl --no-colors --place=30n23 86w28 --date=2022-01-12 --timezone=UTC
Date      :  2022-01-12 UTC
Place     :  30N22, 086W28
Time Zone :  UTC

        rise       transit    set     
Moon    19:06:53   01:20:27   08:13:24   
Sun     12:43:33   17:54:13   23:05:05   
Mercury 13:46:35   19:06:23   00:28:27   
Venus   12:05:30   17:25:48   22:46:14   
Mars    10:36:01   15:39:59   20:43:53   
Jupiter 15:02:45   20:37:40   02:15:38   
Saturn  14:01:31   19:20:32   00:42:59   
Uranus  18:13:00   00:53:59   07:31:02   
Neptune 15:54:01   21:44:48   03:39:25   
Pluto   13:06:06   18:11:43   23:17:21   

Twilight (nautical)

Dawn   :  11:48:07
Use of uninitialized value $title in sprintf at /usr/local/git-private-repos/calendar/myastro/Astro-Montenbruck-1.20/script/../lib/Astro/Montenbruck/Utils/Theme.pm line 46.
Use of uninitialized value $data in pattern match (m//) at /usr/local/git-private-repos/calendar/myastro/Astro-Montenbruck-1.20/script/../lib/Astro/Montenbruck/Utils/Theme.pm line 48.
Use of uninitialized value $data in concatenation (.) or string at /usr/local/git-private-repos/calendar/myastro/Astro-Montenbruck-1.20/script/../lib/Astro/Montenbruck/Utils/Theme.pm line 48.
                    :  
Can't use string ("1") as a subroutine ref while "strict refs" in use at Astro-Montenbruck-1.20/script/riseset.pl line 61.

Version 1.03 has errors building via a downloaded zip file

Following instructions:

$ perl Build.PL
WARNING: the following files are missing in your kit:
                   Meta.json
                   Metalyml
Please inform the author.
...

In spite of the warnings I tried:

$ ./Build
Warning: Build.PL has been altered.  You may need to run 'perl Build.PL' again.
Building Astro::Montenbruck

Then I tried to run riseset_year.pl and seemed to get reasonable data but got warnings about
"useless use of division..." and other errors.

script/riseset.pl: feature requests

Sergey, thank you for such a useful program! It would be helpful if it were enhanced for document and automated production. I have forked this repository and started working on the features listed below in a new, combined script (copied from riseset.pl and planpos.pl) named almanac.pl.

I have completed the features marked with a check. Some features required changes to modules. Even though features may be implemented, and they work for me, there is still tidying up required before submitting a PR.

  • Ready for PR
  • JSON output
  • CSV output (with a separate program, tentatively to be called json2csv.pl)
  • show horizontal az/el for each body at transit
  • show fraction of Moon illumination at transit
  • show Moon crescent angle at transit
  • show time of equinoxes and solstices
  • ability to use decimal lat/lon to ease entries from mapping software (currently only in the Raku driver script)
  • add option to enter place name
  • non-colored output
  • no args upon execution yields short help (mainly execution syntax)
  • warning note (to STDERR) instead of die for interpolating factor outside range (-1..1), allow continued execution with blanks or status instead of interrupting output
  • allow multiple twilight calculations and display for one day
  • add input option for NO interpolation limit [Note 1]
  • send interpolation notices to STDERR with details of its parameters
  • add debug option

Notes

  1. Implemented with an environment variable (INTERP_NOLIMIT) because I couldn't find a way to do it easily (and my Perl foo is not current).

Other comments

My motivation is to produce a daily table of rise/set and other astronmical data for a personalized wall calendar for a particular location. I produce the calendar already, now I'm working on adding these astronomical data to it.

Here are some data on my test run for my location at roughly 30N 86W, CST, for the 365 days in 2020:

  • Number of runs: 1095 (for all three twilights)
  • Number of errors due to interpolation factor absolute value greater than one: 123
  • Maximum interpolation factor error: 1.03641741316612

Changed years and got a slightly larger error so I would need 1.05 to eliminate that set of errors. I'm adding another feature request to the list: optional unlimited interpolation error.

Работа)

Добрый день! Очень заинтересовал ваш профиль, хотел бы позвать вас на собеседование, можете поделиться контактами, как с вами можно связаться?

Code request

@skrushinsky Dear Sergey,

We are looking for a developer with knowledge astrology like you demonstrate in your project. If you are in for a project (participation in a dutch startup!) please respond on this comment so we can have a chat.

Kind regards,
Souabi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.