Comments (8)
hmmm, i'm not understanding the round trip you're doing with the house position, is there any reason for that?
I tested it here like this and i got the correct result:
...
const JD = utc_to_jd(utcDate.year, utcDate.month, utcDate.day, utcDate.hour, utcDate.minute, utcDate.second, constants.SE_GREG_CAL);
const [ JDET, JDUT ] = JD.data; // [ 2443609.9582081484, 2443609.95764303 ]
const calcs = calc_ut(JDUT, planet_id, constants.SEFLG_SWIEPH); // there is no SEFLG_TROPICAL, tropical is default
const deg = calcs.data[0]; // 258.19397969291236
const SPLITTED_POS = split_deg(deg, constants.SE_SPLIT_DEG_ROUND_SEC + constants.SE_SPLIT_DEG_ZODIACAL);
console.log(SPLITTED_POS) // { degree: 18, minute: 11, second: 38, fraction: 0, sign: 8 }
from sweph.
you need the SPEED flag to return speeds:
const calcs = calc_ut(JDUT, planet_id, constants.SEFLG_SWIEPH + constants.SEFLG_SPEED);
from sweph.
works like a charm! thank you
from sweph.
hi @Hrsikesa108 , there should an example on how to get the positions of planets and houses in the beginning of index.d.ts
, which you can also access by hovering the main sweph
export when you import the library.
if you need further assistance, kindly open a new issue, i'm gonna go ahead and close this one.
from sweph.
Hi, could you please double check your Astro.com input?
The position 16 degrees 6 minutes does not seem correct for Neptune for that date.
from sweph.
you're right, I updated the script with the correct Astro.com result, however the results remain different.
from sweph.
You're right, I was unnecessarily complicating the issue! Thanks!
But why the retrograde result is still false instead of true?
PS: the calcs.flag is still 2
const sweph = require('sweph');
const luxon = require('luxon');
const { constants, utc_to_jd, houses, house_pos, calc, calc_ut, split_deg } = sweph;
const { DateTime } = luxon;
sweph.set_ephe_path('ephe');
const planet_name = 'Neptune'
const planet_id = constants.SE_NEPTUNE;
const params = {
year: 1978,
month: 4,
day: 11,
hours: 11,
minutes: 59,
zone: 'Europe/Rome',
// Camposampiero, ITALY, 45n34 11e56
lat: 45.566667,
lon: 11.933333
}
const localDate = DateTime.local(params.year, params.month, params.day, params.hours, params.minutes, { zone: params.zone });
const utcDate = localDate.toUTC();
const JD = utc_to_jd(utcDate.year, utcDate.month, utcDate.day, utcDate.hour, utcDate.minute, utcDate.second, constants.SE_GREG_CAL);
if (JD.flag !== constants.OK) { throw new Error(JD.error); }
const [ JDET, JDUT ] = JD.data;
const HOUSES = houses(JDUT, Number(params.lat), Number(params.lon), 'P');
if (HOUSES.flag !== constants.OK) { throw new Error(HOUSES.flag); }
const armc = HOUSES.data.points[2];
const ECLIPTIC = calc_ut(JDUT, constants.SE_ECL_NUT, 0);
const eps = ECLIPTIC.data[0];
const calcs = calc_ut(JDUT, planet_id, constants.SEFLG_SWIEPH);
// if (calcs.flag !== constants.OK) { throw new Error(JSON.stringify(calcs)); }
const deg = calcs.data[0]; // 258.19397969291236
const xpin = calcs.data.slice(0, 2);
let retrograde;
switch (planet_id) {
case constants.SE_SUN:
case constants.SE_MOON:
retrograde = "Not applicable";
break;
case constants.SE_TRUE_NODE:
retrograde = "Always";
break;
default:
retrograde = (planet_id > 12) ? "Not a planet" : (calcs[3] < 0);
break;
}
const HOUSE_POS = house_pos(armc, params.lat, eps, 'P', xpin);
const SPLITTED_POS = split_deg(deg, constants.SE_SPLIT_DEG_ROUND_SEC + constants.SE_SPLIT_DEG_ZODIACAL);
console.log(``);
console.log(`Planet: ${planet_name}`);
console.log(``);
console.log(`SCRIPT RESULT`);
console.log(`sweph.calc pos = ${deg}`);
console.log(`sweph.split_deg = ${JSON.stringify(SPLITTED_POS)}`);
console.log(`Retrograde = ${retrograde}`);
console.log(`sweph.house_pos num = ${Math.floor(HOUSE_POS.data)}`);
console.log(``);
console.log(`ASTRO.COM BIRTCHART RESULT`);
console.log(`deg = {"degree":18,"minute":11,"second":38,"fraction":0,"sign":8}`);
console.log(`Retrograde = true`);
console.log(``);
from sweph.
Hi timotejroiko sir,
can you give some guidelines how to run this program locally in node and get planetary details in json ?
i found my intrest in learning astrology and was searching in github repos your repo i found and felt lucky.
Thanks sir
from sweph.
Related Issues (18)
- Need help with Angular integration HOT 2
- Wrong info in utc_time_zone() HOT 6
- Wrong sunrise time for negative timezones HOT 9
- Please update ephemeris download links HOT 1
- new feature HOT 1
- Issue in Electron HOT 2
- unable to install on Windows 11 HOT 2
- Astrodienst Dropbox folder is too big to be downloaded HOT 1
- sweph.rise_trans returns incorrect value HOT 3
- SwissEph file 'sepl_18.se1' not found in PATH HOT 2
- Problem when using constants as array indices in TypeScript HOT 10
- A simple example how to build an Astrological Chart HOT 3
- Electronjs HOT 3
- react native compatibility HOT 3
- Error in house_name() method HOT 3
- Please help me out with deployment issue? HOT 16
- Unable to run on Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sweph.