-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On how the library is to be used #73
Comments
Hi. I've just discovered this library myself and was asking myself the same question. But first I ran into several problems installing it:
Then installing the package finally worked. But to get back to your question: When you install the library it executes a C++ build which generates this file: The But not just some constants are added. Also this strange Executing the code from the README: var swisseph = require("swisseph");
var date = { year: 2015, month: 1, day: 1, hour: 0 };
var julday = swisseph.swe_julday(date.year, date.month, date.day, date.hour, swisseph.SE_GREG_CAL);
console.log(julday); Gives me: |
I think I now understand what the "calc" function does. It looks like it takes a data object (called options) and extends it with missing/converted data. So to answer your question: You don't have to use it. To me it looks like a test function, because it calls "swe_close" at the end which releases all resources (open files and allocated memory) used by the Swiss Ephemeris DLL. Example (TypeScript code): import swisseph from "swisseph";
var ret = swisseph.calc(
{
date: {
gregorian: { terrestrial: { year: 2021, month: 9, day: 17, hour: 21 } },
},
body: {
id: 1,
position: {
longitude: 47,
latitude: 16,
},
},
observer: {
geographic: {
longitude: 47,
latitude: 16,
height: 2,
},
},
},
(result) => {
console.log(result);
}
);
console.log(ret); Output:
|
Hey guys,
All examples refer to functions from the Swiss Ephemeris library API (like
swe_calc_ut()
) but in the main file of this library/lib/swisseph.js
there is thatcalc()
function for which I can't find any documentation. Is that function meant to be used at all? It seems to produce results that are very close to the examples like/examples/planets.js
but are not exactly equal.I'm still trying to figure out how to properly use the library so any help would be appreciated.
Thanks
The text was updated successfully, but these errors were encountered: