Skip to content

Instantly share code, notes, and snippets.

@JamesHagerman
Created July 8, 2015 04:59
Show Gist options
  • Save JamesHagerman/48324ecc6a50f2334f3a to your computer and use it in GitHub Desktop.
Save JamesHagerman/48324ecc6a50f2334f3a to your computer and use it in GitHub Desktop.
node astro
var assert = require ('assert');
var fs = require ('fs');
var swisseph = require('swisseph');
var date = {year: 1985, month: 1, day: 19, hour: 17, minute: 46};
var julday = swisseph.swe_julday(date.year, date.month, date.day, date.hour, swisseph.SE_GREG_CAL);
var geo = {lat: 38.833333, long: -104.816667}
console.log("Day: " + julday);
var flag = swisseph.SEFLG_SPEED | swisseph.SEFLG_MOSEPH;
swisseph.swe_julday(date.year, date.month, date.day, date.hour, swisseph.SE_GREG_CAL, function (julday_ut) {
// assert.equal (julday_ut, 2455927.5);
console.log ('Julian UT day for date:', julday_ut);
// Sun position
swisseph.swe_calc_ut (julday_ut, swisseph.SE_SUN, flag, function (body) {
assert (!body.error, body.error);
console.log ('Sun position:', body);
// Sun Houses position:
swisseph.swe_houses(julday_ut, geo.lat, geo.long, 'K', body.longitude, body.latitude, function(result){
assert(!result.error, result.error);
console.log('Sun house position: ', result);
});
});
// Moon position
swisseph.swe_calc_ut (julday_ut, swisseph.SE_MOON, flag, function (body) {
assert (!body.error, body.error);
console.log ('Moon position:', body);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment