예제 #1
0
int main (int argc, char **argv) {

  SpiceDouble lt;
  SpiceDouble ang;
  SpiceDouble v[3];
  SpiceDouble pos[3];
  int i;
  furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm");

  //  spkezp_c(299,0,"ITRF93","LT+S",399,v,&lt);
  //  printf("POS: %f,%f,%f\n",v[0],v[1],v[2]);

  //  exit(0);


  // abq roughly
  georec_c (-106.5*rpd_c(), 35.05*rpd_c(), 1.609344, 6378.137, 
	    (6378.137-6356.7523)/6378.137, pos);

  for (i=0; i<=86400; i+=3600) {
    // pos of sun from IAU_EARTH
    spkezp_c(10,i,"ITRF93","LT+S",399,v,&lt);

    printf("POS(%d): %f,%f,%f\n",i,v[0],v[1],v[2]);

    // angle between abq vector and sun vector (0 = zenith)
    ang = vsep_c (v,pos);

    //    printf("%d %f\n",i,r2d(ang));
  }

  return 0;

}
예제 #2
0
void gfq ( SpiceDouble et, SpiceDouble *value ) {

  // max separation between all non-0 planets in planets
  int i,j;
  SpiceDouble sep, lt, max=0.;
  SpiceDouble position[planetcount+1][3];
  // TODO: why do I need a temp var here?
  SpiceDouble temp[3];

  // compute positions
  for (i=1; i<=planetcount; i++) {
    spkezp_c(planets[i], et, "J2000", "LT+S", 10, temp, &lt);
    // copy from temp var (argh!)
    for (j=0; j<=2; j++) {position[i][j] = temp[j];}
  }


  // and now the angle diffs (keep only min)
  for (i=1; i<=planetcount; i++) {
    for (j=i+1; j<=planetcount; j++) {
      sep = vsep_c(position[i],position[j]);
      if (sep>max) {max=sep;}
    }
  }

  *value=max;
  return;
}
예제 #3
0
void gfq4 (SpiceDouble et, SpiceDouble *value) {
  SpiceDouble v[3], lt;

  // angular distance between Mars (for now) + globally defined curstar vector
  spkezp_c(4,et,"J2000","NONE",399,v,&lt);

  *value = vsep_c(v,curstar);
}
예제 #4
0
void gfq2 (SpiceDouble et, SpiceDouble *value) {
  SpiceDouble v[3], lt;
  spkezp_c(1,et,"J2000","NONE",0,v,&lt);

  sprintf(s,"%f %f %f",v[0],v[1],v[2]);

  *value = vnorm_c(v);
}
예제 #5
0
void gfq5 (SpiceDouble et, SpiceDouble *value) {
  SpiceDouble u[3], v[3], lt;
  spkezp_c(10,et,REF,"NONE",601,u,&lt);
  spkezp_c( 5,et,REF,"NONE",601,v,&lt);

  // set global variable "s" to extra data, caller not required to use it

  // This is really ugly; if global variable 'extra' is set, print out
  // extra information; this should only be used when printing results
  // NOT during the search phase (TODO: this is ugly, better way?)

    if (vnorm_c(u)<vnorm_c(v)) {
      strcpy(s, "SUN IS CLOSER");
    } else {
      strcpy(s, "POSSIBLE TRANSIT");
    }

  *value = vsep_c(u,v)*180./pi_c();
}
예제 #6
0
void gfq (SpiceDouble et, SpiceDouble *value) {

  // array to hold the XYZ and lt results from spkezp_c
  SpiceDouble res[3];
  SpiceDouble lt;

  // 301 is the moon's "NAIF ID" and 399 is the Earth's NAIF ID; see
  // planet-ids.txt (it git directory referenced above) for details
  spkezp_c(301, et, "ECLIPDATE", "LT+S", 399, res, &lt);

  *value = res[2];
}
예제 #7
0
int main (int argc, char **argv) {

  SPICEDOUBLE_CELL(cnfine,2);
  SPICEDOUBLE_CELL(result,500000);
  SpiceDouble beg, end, et_start, et_end, lt, iss[3];
  char stime[255];

  furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm");

  // the limits of my TLE
  // TODO: compute this automatically from BSP file
  et_start = 506092496.;
  et_end = 507411908.;

  // geocentric angular distance between ISS and moon (transits)
  void issmoon (SpiceDouble et, SpiceDouble *value) {
    SpiceDouble iss[3], moon[3], lt;

    spkezp_c(-125544,et,"EQEQDATE","CN+S",399,iss,&lt);
    spkezp_c(301,et,"EQEQDATE","CN+S",399,moon,&lt);
    //    printf("%f -> %f\n", et, vsep_c(iss,moon)*dpr_c());
    *value = vsep_c(iss,moon);
  }
예제 #8
0
void earthvector(double time, int planet, SpiceDouble position[3]) {
  SpiceDouble lt;
  SpiceInt i;

  // planet -1 is the star
  if (planet==-1) {
    for (i=0; i<=2; i++) {
      position[i] = starpos[i];
    }
    return;
  }

  spkezp_c(planet, time,"J2000","NONE",399,position,&lt);
}
예제 #9
0
int main (int argc, char **argv) {

  SpiceDouble delta, lt, v[3], t=0;
  furnsh_c("/home/user/BCGIT/ASTRO/standard.tm");

  // test that I got directions right

  printf("UNIX2ET(0): %f\n",unix2et(0));
  printf("ET2UNIX(above): %f\n",et2unix(unix2et(0)));
  printf("ET2UNIX(0): %f\n",et2unix(0));
  printf("UNIX2ET(above): %f\n",unix2et(et2unix(0)));
  exit(0);


  deltet_c(0,"ET",&delta);
  spkezp_c(299,t+delta,"ITRF93","LT+S",399,v,&lt);
  printf("ITRF93: %f %f %f\n",v[0],v[1],v[2]);

  return 0;
}
예제 #10
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,&lt);
    *value = v[0];
  }
예제 #11
0
void gfq3 (SpiceDouble et, SpiceDouble *value) {
  SpiceDouble v[3], lt;
  spkezp_c(1,et,"ECLIPJ2000","NONE",10,v,&lt);
  *value = v[1];
}
예제 #12
0
void gfq (SpiceDouble et, SpiceDouble *value) {
  SpiceDouble v[3], lt;
  spkezp_c(1,et,"J2000","NONE",0,v,&lt);
  *value = vnorm_c(v);
}
예제 #13
0
int main (int argc, char **argv) {

  SpiceDouble et, mat[3][3], mat2[3][3], jac[3][3], nut, obq, dboq;
  SpiceDouble pos[3], newpos[3];
  SpiceDouble lt;
  SpiceInt planets[6], i;
  SPICEDOUBLE_CELL (range, 2);
  SpiceDouble beg,end,stime,etime,*array;
  char test2[2000];

  furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm");

  exit(-1);

  for (i=-20000; i<=20000; i++) {
    timout_c(year2et(i), "ERAYYYY##-MON-DD HR:MN:SC.############# ::MCAL", 50, test2);
    printf("TIME: %d %s\n", i, test2);
  }

  exit(-1);

  spkcov_c("/home/barrycarter/SPICE/KERNELS/de431_part-1.bsp", 399, &range);
  wnfetd_c (&range, 0, &stime, &end);
  spkcov_c("/home/barrycarter/SPICE/KERNELS/de431_part-2.bsp", 399, &range);
  wnfetd_c(&range, 0, &beg, &etime);

  printf("TIMES: %f %f\n", beg, etime);



  str2et_c("2017-10-17 07:59", &et);
  printf("ET: %f\n", et);
  spkezp_c(1, et, "EQEQDATE", "CN+S", 399, pos, &lt);
  printf("ET: %f\n", et);
  printf("POS: %f %f %f %f %f\n", et, pos[0], pos[1], pos[2], lt);

  //  eqeq2eclip(et, mat, jac);

  mxv_c(mat, pos, newpos);

  printf("NEWPOS: %f %f %f\n", newpos[0], newpos[1], newpos[2]);

  exit(0);

  zzwahr_(&et, &nut);
  zzmobliq_(&et, &obq, &dboq);

  printf("NUTATION: %f\n", nut);
  printf("OBLIQUITY: %f\n", obq);

  pxform_c("EQEQDATE", "ECLIPDATE", et, mat);

  for (i=0; i<=2; i++) {
    printf("ALPHA: %d %f %f %f\n", i, mat[i][0], mat[i][1], mat[i][2]);
  }

  eqeq2eclip(et, mat2);

  printf("ALPHATEST\n");

  for (i=0; i<=2; i++) {
    printf("BETA: %d %f %f %f\n", i, mat2[i][0], mat2[i][1], mat2[i][2]);
  }


  exit(0);

  str2et_c("10400-FEB-28 00:00:00", &et);
  printf("ET: %f\n", et);
  str2et_c("10400-MAR-01 00:00:00", &et);
  printf("ET: %f\n", et);


  exit(0);



  timout_c(0, "ERAYYYY##-MON-DD HR:MN:SC.############# ::MCAL", 41, test2);

  printf("%s\n", test2);

  exit(0);

  long long test = -pow(2,63);

  printf("TEST: %lld\n",test);

  exit(0);


  if (!strcmp(argv[1],"posxyz")) {
    double time = atof(argv[2]);
    int planet = atoi(argv[3]);
    posxyz(time,planet,pos);
    printf("%f -> %f %f %f\n",time,pos[0],pos[1],pos[2]);
  };

  if (!strcmp(argv[1],"earthvector")) {
    double time = atof(argv[2]);
    int planet = atoi(argv[3]);
    earthvector(time,planet,pos);
    printf("%f -> %f %f %f\n",time,pos[0],pos[1],pos[2]);
  };

  if (!strcmp(argv[1],"earthangle")) {
    double time = atof(argv[2]);
    int p1 = atoi(argv[3]);
    int p2 = atoi(argv[4]);
    SpiceDouble sep = earthangle(time,p1,p2);
    printf("%f -> %f\n",time,sep);
  };

  if (!strcmp(argv[1],"earthmaxangle")) {
    double time = atof(argv[2]);
    for (i=3; i<argc; i++) {planets[i-3] = atoi(argv[i]);}
    SpiceDouble sep = earthmaxangle(time,argc-3,planets);
    printf("%f -> %f\n",time,sep);
  };

}