I wrote this program:
#!/usr/bin/perl
use Astro::Nova qw(get_solar_equ_coords get_lunar_equ_coords get_hrz_from_equ
get_solar_rst_horizon get_timet_from_julian
get_julian_from_timet get_lunar_rst get_lunar_phase);
$observer = Astro::Nova::LnLatPosn->new("lng"=>0,"lat"=>89.5);
for $i (2456623..2456624) {
print "DAY: $i\n";
($status,$rst) = get_lunar_rst($i, $observer);
print "STATUS: $status\n";
$rst->get_transit();
$rise = $rst->get_rise();
print "RISE: $rise\n";
$set = $rst->get_set();
print "SET: $set\n\n";
}
and got these results:
DAY: 2456623
STATUS: 1
RISE: 5.5664193588601e-309
SET: 1.55254159695923e-267
DAY: 2456624
STATUS: -1
RISE: 1.9634470382202e-153
SET: 2.26294632209635e+137
In other words, the moon goes from circumpolar (always up) to below the horizon without ever actually rising or setting.
I realize that 89.5 degrees is sort of a corner case, but why shouldn't this code work?
As a note http://aa.usno.navy.mil/data/docs/RS_OneYear.php shows there is a moonset in this interval (JD 2456623 = 2013-11-26 12:00:00):
Another oddness: if I comment out the "$rst->get_transit();" line, I get these results:
DAY: 2456623
STATUS: 1
RISE: 5.5664193588601e-309
SET: 1.14372958360957e-268
DAY: 2456624
STATUS: -1
RISE: 6.80740365931403e+199
SET: 4.81766816905579e+151
The rise/set are still bizarre (which is fine since status is -1), but they are different. I always assumed get_lunar_rst() returned a fixed structure, but apparently not? The very act of checking the transit time alters the structure?
EDIT: OK, I ran the program twice without changing it at all and got:
DAY: 2456623
STATUS: 1
RISE: 5.5664193588601e-309
SET: 2.99352717623831e-264
DAY: 2456624
STATUS: -1
RISE: 1.9634470382202e-153
SET: 2.26294632209635e+137
DAY: 2456623
STATUS: 1
RISE: 5.5664193588601e-309
SET: 3.04770606791278e-262
DAY: 2456624
STATUS: -1
RISE: 1.9634470382202e-153
SET: 2.26294632209635e+137
In other words, the 2456623 set changes for no reason.
I've contacted the authors of libnova, who have confirmed this is a bug and are working to correct it.
libnova incorrectly assumes bodies are circumpolar if they are above the horizon when due north. This is untrue: https://astronomy.stackexchange.com/q/963
I've written a fix which doesn't assume this, but may still be inaccurate if a body's declination is non-unimodal: https://astronomy.stackexchange.com/questions/962/is-lunar-elevation-at-a-given-location-for-a-given-day-unimodal