4

What's the Perl equivalent of pyephem?

Since pyephem is based on a C library(?), I'm guessing someone's created a Perl version too?

Andrew Walker
  • 40,984
  • 8
  • 62
  • 84
  • 1
    please tell us what you want to do, perhaps there are ways to accomplish them. I doubt there is an exact port as though the module in question is coded in C it is not a wrapper for an external C library. – Joel Berger Feb 02 '13 at 05:32
  • Ultimately, I'm trying to find the time of the next moon/sun rise/set or twilight at a given location for a given time EVEN IF that event doesn't occur in the next 24 hours. For example, sunset in Barrow AK in mid-June will actually occur many weeks later. –  Feb 02 '13 at 05:53

2 Answers2

4

Have you checked out libnova? It's quite powerful. There's a Perl wrapper for that: Astro::Nova.

Quoting the documentation below, one of these could do exactly what you want. The Perl docs are relatively sparse because I didn't want to reproduce the entire library documentation for the wrapper. The functions are mostly similar to how the work in C. Exceptions from that should be documented. The main libnova docs have all the details.

(int $status, Astro::Nova::RstTime $rst) =
  get_object_rst(double JD, Astro::Nova::LnLatPosn observer, Astro::Nova::EquPosn object)
(int $status, Astro::Nova::RstTime $rst) =
  get_object_rst_horizon(double JD, Astro::Nova::LnLatPosn observer,
                         Astro::Nova::EquPosn object, double horizon)
(int $status, Astro::Nova::RstTime $rst) =
  get_object_next_rst(double JD, Astro::Nova::LnLatPosn observer, Astro::Nova::EquPosn object)
(int $status, Astro::Nova::RstTime $rst) =
  get_object_next_rst_horizon(double JD, Astro::Nova::LnLatPosn observer,
                              Astro::Nova::EquPosn object, double horizon)
tsee
  • 5,034
  • 1
  • 19
  • 27
  • It turns out Astro::Nova isn't quite as complete as pyephem. Another workaround is Inline::Python which lets you write Python code directly in Perl. –  Nov 27 '13 at 06:02
1

You might want to start here:

Perl Astro Modules

ennuikiller
  • 46,381
  • 14
  • 112
  • 137
  • 1
    I've looked at many Perl Astro modules, including Astro::Sunrise and Astro::Coord::ECI, but none give me minute-to-minute agreement with NOAA's results (Astro::Sunrise comes close, but can be off by a few minutes AND fails when there is either a sunrise OR a sunset, but not both). –  Feb 02 '13 at 05:24