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; }
int main (int argc, char **argv) { SpiceInt i, nres; SPICEDOUBLE_CELL(cnfine,2); SPICEDOUBLE_CELL(result,2*MAXWIN); SpiceDouble beg,end; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // this will represent the stars position planets[0] = -1; // convert ra and dec to starpos radrec_c(1,atof(argv[1]),atof(argv[2]),starpos); // planets array and count for (i=1; i<argc-2; i++) {planets[i] = atoi(argv[i+2]);} planetcount = argc-2; printf("CONJUNCTIONS FOR %f degrees, planets: %s %s %d %d %d %d %d %d\n",r2d(MAXSEP),argv[1],argv[2],(int)planets[1],(int)planets[2],(int)planets[3],(int)planets[4],(int)planets[5],(int)planets[6]); // TODO: this is for testing only // wninsd_c(unix2et(0),unix2et(2147483647),&cnfine); wninsd_c (-479695089600.+86400*468, 479386728000., &cnfine); // 1 second tolerance (serious overkill, but 1e-6 is default, worse!) gfstol_c(1.); // find under MAXSEP degrees... // TODO: The 90 days below is just for testing, not accurate!!!! gfuds_c(gfq,gfdecrx,"<",MAXSEP,0.,86400.*90,MAXWIN,&cnfine,&result); nres = wncard_c(&result); for (i=0; i<nres; i++) { wnfetd_c(&result,i,&beg,&end); // R = range, M = min printf("R %f %f\n",et2jd(beg),et2jd(end)); findmins(beg,end); } // printf("There are %d results\n",wncard_c(&result)); return 0; }
int main (int argc, char **argv) { SPICEDOUBLE_CELL(cnfine,2); SPICEDOUBLE_CELL(result,2*MAXWIN); furnsh_c("/home/user/BCGIT/ASTRO/standard.tm"); wninsd_c((SYEAR-2000.)*31556952.,(EYEAR-2000.)*31556952.,&cnfine); // all of DE431 // wninsd_c (-479695089600.+86400*468, 479386728000., &cnfine); // 1 second tolerance (serious overkill, but 1e-6 is default, worse!) gfstol_c(1.); // NOTE: putting MAXSEP below is harmless if cond is LOCMIN or something gfuds_c(GFQ,gfdecrx,COND,MAXSEP,0.,86400.,MAXWIN,&cnfine,&result); show_results(LABEL,result,GFQ); return(0); }
int main (int argc, char **argv) { SPICEDOUBLE_CELL(cnfine,2); SPICEDOUBLE_CELL(result,500000); SpiceDouble beg, end, et_start, et_end; char ftime[255]; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // and the limits of DE431 str2et_c("13201 B.C. MAY 07 00:00:41.184", &et_start); str2et_c("17091 MAY 07 00:00:41.184", &et_end); // because I'm using large time intervals... gfstol_c(10.); // sun's x or y position (v[1] = y pos = 0 on equinox) void solarzed (SpiceDouble et, SpiceDouble *value) { SpiceDouble v[3], lt; spkezp_c(10,et,"EQEQDATE","CN+S",399,v,<); *value = v[0]; }
int main( int argc, char **argv ) { SPICEDOUBLE_CELL(result,2*MAXWIN ); SPICEDOUBLE_CELL(resultr,2*MAXWIN ); // TODO: these windows can hold at most one interval????? SPICEDOUBLE_CELL(cnfine,2); SPICEDOUBLE_CELL(cnfiner,2); SpiceInt i,j; // which ephermis's to use furnsh_c( "/home/barrycarter/BCGIT/ASTRO/standard.tm" ); // TOL too small otherwise; this is one second gfstol_c(1.); // SPICE window for all DE431 wninsd_c (-479695089600.+86400*468, 479386728000., &cnfine); // FOR TESTING PURPOSES ONLY!!!! // wninsd_c (-946684800., 2147483647.+946684800., &cnfine); // I send these as: observer b1 b2, thus the odd argv order below // 0.10471975511965977462 radians = 6 degrees gfsep_c(argv[2],"POINT","J2000",argv[3],"POINT","J2000","NONE",argv[1], "<", 0.10471975511965977462,0,86400.,MAXWIN,&cnfine,&result); SpiceInt count = wncard_c(&result); SpiceDouble begtim, endtim, mintim1, mintim2; for (i=0; i<count; i++) { // find the ith result and print it wnfetd_c(&result,i,&begtim,&endtim); printf("%s %s %s 6deg %f %f\n",argv[1],argv[2],argv[3],et2jd(begtim),et2jd(endtim)); // find min separation in this interval // TODO: this is hideous coding (append/remove, must be a better way) appndd_c(begtim,&cnfiner); appndd_c(endtim,&cnfiner); wnvald_c(2,2,&cnfiner); // TODO: use of ABSMIN missed conjunctions, changed to LOCMIN gfsep_c(argv[2],"POINT","J2000",argv[3],"POINT","J2000","NONE",argv[1], "LOCMIN", 0,0,86400.,MAXWIN,&cnfiner,&resultr); SpiceInt count2 = wncard_c(&resultr); for (j=0; j<count2; j++) { wnfetd_c(&resultr,j,&mintim1,&mintim2); // mintim1 and mintim2 should be identical, printing them both anyway printf("%s %s %s min %f %f\n",argv[1],argv[2],argv[3],et2jd(mintim1),et2jd(mintim2)); } removd_c(endtim,&cnfiner); removd_c(begtim,&cnfiner); } }