int main (int argc, char **argv) { SPICEDOUBLE_CELL (result, 2*MAXWIN); SPICEDOUBLE_CELL (cnfine, 2); // various formats SpiceChar begstr[TIMLEN], classic[100], terse[100]; SpiceDouble beg,end,*array; SpiceInt count,i,j,house; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // 1 second tolerance (serious overkill, but 1e-6 is default, worse!) gfstol_c(1.); // 1 year window wninsd_c(year2et(atof(argv[1])), year2et(atof(argv[2])), &cnfine); // TODO: figure out how to compute sizeof(iplanets) properly, this is hack for (j=0; j<sizeof(iplanets)/4; j++) { gplanet = iplanets[j]; gfuds_c (gfq, gfdecrx, "=", 0., 0., 86400., MAXWIN, &cnfine, &result); count = wncard_c(&result); for (i=0; i<count; i++) { // find the time of event (beg == end in this case) wnfetd_c (&result, i, &beg, &end); // find ecliptic longitude (and if its increasing/decreasing) array = geom_info(gplanet, beg, FRAME, 399); // pretty print the time timout_c (beg, TIMFMT, TIMLEN, begstr); house = rint(array[11]*dpr_c()/30); if (array[17] < 0) {house--;} house = (house+12)%12; // the classic form sprintf(classic, "%s %s ENTERS %s %s", begstr, planet2str(gplanet, ""), houses[house], array[17]<0?"RETROGRADE":"PROGRADE"); sprintf(terse, "%lld %s%s%s", (long long) floor(beg+0.5), planet2str(gplanet, "TERSE"), house2str(house, "TERSE"), array[17]<0?"-":"+"); printf("%s %s\n", classic, terse); } } return(0); }
int main( int argc, char **argv ) { SpiceInt i,count,j; SPICEDOUBLE_CELL(result, 2*MAXWIN); SPICEDOUBLE_CELL(cnfine,2); char stime[255]; SpiceDouble beg, end, ang; // fill the static planets array for (i=1; i<argc; i++) {planets[i] = atoi(argv[i]);} planetcount = argc-1; // 1 second tolerance (serious overkill, but 1e-6 is default, worse!) gfstol_c(1.); furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // DE431 limits wninsd_c (-479695089600.+86400*468, 479386728000., &cnfine); // 1970 to 2038 (all "Unix time") for testing // wninsd_c(unix2et(0),unix2et(2147483647),&cnfine); gfuds_c(gfq,gfdecrx,"LOCMIN",0.,0.,86400.,MAXWIN,&cnfine,&result); count = wncard_c(&result); for (i=0; i<count; i++) { // we don't use 'end' but need to pass it wnfetd_c(&result,i,&beg,&end); // find the angle at this time gfq(beg,&ang); // format time nicely timout_c(beg, "ERA YYYY##-MM-DD HR:MN:SC ::MCAL",255,stime); // print et and separation as degree printf("%f %f",beg,ang*dpr_c()); // print out the planets involved (redundant, but useful) for (j=1; j<argc; j++) {printf(" %s",argv[j]);} printf(" %s\n",stime); } return 0; }
static VALUE dpr(VALUE self) { return DBL2NUM(dpr_c()); }