Skip to content

Worked example bugs #70

@kiranshila

Description

@kiranshila

So, I'm trying to follow the readme on getting az/el for a sidereal source with the new methods and am running into some issues.

I'm trying

#include "novas.h"
#include "solarsystem.h"
#include <stdio.h>

int main(void) {
  cat_entry star;
  object source;
  observer obs;
  novas_timespec t_obs;
  sky_pos apparent;
  novas_frame obs_frame;
  double az, el;

  novas_debug(NOVAS_DEBUG_EXTRA);

  make_cat_entry("Antares", "FK4", 1, 16.43894213, -26.323094, -12.11, -23.30, 5.89, -3.4, &star);
  transform_cat(CHANGE_EPOCH, NOVAS_JD_B1950, &star, NOVAS_JD_J2000, "FK5", &star);
  transform_cat(CHANGE_J2000_TO_ICRS, 0.0, &star, 0.0, "ICRS", &star);
  make_cat_object(&star, &source);

  make_observer_on_surface(-50.7374, -60.0982, 60.0, 0.0, 0.0, &obs);
  novas_set_time(NOVAS_TAI, 2460570.659259, 37, 0.114, &t_obs);

  novas_make_frame(NOVAS_FULL_ACCURACY, &obs, &t_obs, 0.0, 0.0, &obs_frame);

  novas_sky_pos(&source, &obs_frame, NOVAS_CIRS, &apparent);
  novas_app_to_hor(&obs_frame, NOVAS_CIRS, apparent.ra, apparent.dec, novas_standard_refraction, &az, &el);

  printf("AZ: %f, EL: %f", az, el);
}

But novas_make_frame fails due to a call in planetary ephemeris.

  ERROR! earth_sun_calc_hp: low-precision calculation is not currently allowed as a substitute [=> 3]
       @ ephemeris:planet [=> 13]
       @ novas_create_frame [=> 23]

If I'm understanding this correctly - with all the default Makefile options, linking against solsys3 - there is no "high performance" planet model, so that's why we get this error. Switching the accuracy to NOVAS_REDUCED_ACCURACY results in numbers that look about right (although I was going to cross check with SLALIB or something). But this means all the other calculations are in reduced accuracy, not just the planet ephemeris stuff. I will only ever point at sidereal objects, so I wish I could elid all the planet stuff, to be honest.

Trying one other thing, letting the "lower performance" solsys stuff take the place of the _hp routine with

  enable_earth_sun_hp(1);

results in some other error

  ERROR! earth_sun_calc: invalid or unsupported planet number: 5 [=> 2]
       @ earth_sun_calc_hp [=> 2]
       @ ephemeris:planet [=> 12]
       @ light_time2 [=> 22]

  ERROR! earth_sun_calc: invalid or unsupported planet number: 6 [=> 2]
       @ earth_sun_calc_hp [=> 2]
       @ ephemeris:planet [=> 12]
       @ light_time2 [=> 22]
       @ obs_planets [=> 12]
       @ novas_change_observer [=> 12]
       @ novas_create_frame [=> 52]

Which I suppose all points to the fact that solsys3 doesn't seem by default compatible with the novas_make_frame infrastructure, but I'm not sure how those errors didn't pop up in the reduced accuracy version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions