timotejroiko / sweph

The definitive Swiss Ephemeris bindings for Node.js
Other
93 stars 15 forks source link

sweph.rise_trans returns incorrect value #2

Closed ravivarmapm closed 3 years ago

ravivarmapm commented 3 years ago

The method sweph.rise_trans returns incorrect value.

The below code for calculating Sunrise time for 07/07/21 for Hyderabad, IN returns 2459402.535475984 which seem to be incorrect (by almost 30 minutes) when compared to calculation done using other libraries (listed below). sweph.rise_trans(2459402.2708333335, 0, null, SWEC.SEFLG_SWIEPH, 769, [78.45636, 17.38405, 0], 0, 0); // 2459402.535475984

Using a python library or another Node.js library with the same input values gives correct results. Have verified the correctness of results from these libraries with Sunrise time from few websites.

Using Python Library (https://github.com/astrorigin/pyswisseph) swe.rise_trans(2459402.2708333335, 0, 78.45636, 17.38405, rsmi = 769) // 2459402.514695216

Using Node.js Library (https://github.com/mivion/swisseph)

swisseph.swe_rise_trans(
  2459402.2708333335, 
  0, // Planet,
  "", // Star (empty string for Planet),
  swisseph.SEFLG_SWIEPH, 
  769, // rsmi swisseph.SE_CALC_RISE,
  78.45636, // longitude,
  17.38405, // latitude,
  0, // altitude,
  0, // pressure,
  0, // temperature,
  function (result) {
    console.log("Result: ", result.transitTime); // 2459402.514695169
  });

What am I missing here?

timotejroiko commented 3 years ago

Hello, it looks like a bug. I have found the source of the issue, will fix soon. Thank you for pointing out!

timotejroiko commented 3 years ago

Should be fixed now, in both gpl and agpl versions, can you confirm?

I also released a new swiss ephemeris update thats been pending for a couple weeks.

ravivarmapm commented 3 years ago

Thank you for the quick response.

The issue is now fixed.