예제 #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
int main()
{
       /* 
       Local variables 
      */

         SpiceDouble   et =  -527644192.5403653;

         SpiceChar        *leap = "/home/facom/Projects/JUPITER/kernels/naif0007.tls";
         ConstSpiceChar   *format;
         SpiceChar        *utcstr;

         SpiceInt           prec;

         SpiceInt           lenout = 35;

         format             = "C";
         prec               =  6;

         /*
         Load the leapseconds kernel. 
         */
         furnsh_c ( leap );
         et2utc_c (  et , format, prec, lenout, utcstr );

         printf ( "ET: %18.7f\n Converted output: %s\n",
                   et,
                   utcstr);

         return ( 0 );
}
예제 #3
0
파일: aquest.cpp 프로젝트: seap-udea/aQuest
int aQuest(void)
{
  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  //LOAD KERNELS
  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  furnsh_c("kernels");
  return 0;
}
예제 #4
0
int main() {

  SpiceDouble et, lt, pos[6];

  furnsh_c("/home/barrycarter/BCGIT/ASTRO/000157.html");
  furnsh_c("/home/barrycarter/BCGIT/ASTRO/eqeqdate.tf");
  furnsh_c("/home/barrycarter/SPICE/KERNELS/de431_part-1.bsp");
  furnsh_c("/home/barrycarter/SPICE/KERNELS/naif0011.tls");
  str2et_c("BC 9998-06-06 00:00:00", &et);

  //  spkgeo_c(10, et, "ECLIPDATE", 399, pos, &lt);
  //  spkezp_c(10, et, "ECLIPDATE", "NONE", 399, pos, &lt);
  //  spkezp_c(10, et, "EQEQDATE", "NONE", 399, pos, &lt);
  spkgeo_c(10, et, "EQEQDATE", "NONE", 399, pos, &lt);

  printf("ET: %f, POS: %f %f %f\n", et, pos[0], pos[1], pos[2]);

  return 0;
}
예제 #5
0
static VALUE furnsh(VALUE self, VALUE kernel) {
  sigset_t old_mask = block_signals();

  furnsh_c(StringValuePtr(kernel));

  restore_signals(old_mask);
  
  if(spice_error(SPICE_ERROR_SHORT)) return Qfalse;

  return Qtrue;
}
예제 #6
0
void HiJitCube::loadNaifTiming( ) {
  if (!naifLoaded) {
//  Load the NAIF kernels to determine timing data
    Isis::Filename leapseconds("$base/kernels/lsk/naif????.tls");
    leapseconds.HighestVersion();

    Isis::Filename sclk("$mro/kernels/sclk/MRO_SCLKSCET.?????.65536.tsc");
    sclk.HighestVersion();

//  Load the kernels
    string lsk = leapseconds.Expanded();
    string sClock = sclk.Expanded();
    furnsh_c(lsk.c_str());
    furnsh_c(sClock.c_str());

//  Ensure it is loaded only once
    naifLoaded = true;
  }
  return;
}
예제 #7
0
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);
}
예제 #8
0
VALUE furnsh(int argc, VALUE *argv, VALUE self) {
  sigset_t old_mask = block_signals();

  furnsh_c(StringValuePtr(argv[0]));

  restore_signals(old_mask);
  
  if(spice_error(SHORT)) return Qfalse;

  return Qtrue;
}
예제 #9
0
int main(void) {

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

  double stime = 1448953200, etime = 1454310000;
  double lat, lon, dl, noon, mindl, minnoon;

  for (lat = 22.; lat<=67.; lat+=1.) {
    for (lon = -74.; lon <= -71.; lon+=0.1) {

      double *results = bcriset(lat*rpd_c(),lon*rpd_c(), 0, stime, etime,
				"Sun", -5/6.*rpd_c(), ">");

      mindl = 0.;
      minnoon = 0.;

      // we intentionally ignore first result, expect it to be wrong

      // TODO: this assumption is invalid, and, even if it were valid,
      // should be i=1, not i=2

      for (int i=2; i<=100; i++) {

	// if we start seeing 0s, we are out of true answers
	if (results[2*i] < .001) {break;}

	// if the end result is too close to etime, result is inaccurate
	if (abs(results[2*i+1]-etime)<1) {continue;}

	// length of day and "noon"
	dl = results[2*i+1]-results[2*i];
	noon = (results[2*i+1]+results[2*i])/2;

	// if day length is less than mindl (or mindl = 0), set mindl and
	// minnoon to current

	if (mindl < .01 || dl < mindl) {
	  mindl = dl;
	  minnoon = noon;
	}
      }
  
  // the start of December for this longitude (1448928000 = GMT
  // midnight Dec 1)
      double sod = 1448928000-240.*lon;

      // this is: minimal time of noon and length of day
      printf("%f %f %f %f %f\n", lat, lon, minnoon, mindl,
	     1+(minnoon-sod)/86400);
    }
  }
  return 0;
}
예제 #10
0
파일: Kernels.cpp 프로젝트: assutech/isis3
 /**
  * @brief Loops through PvlKeyword containing Kernel file names
  * 
  * This method interogates a PvlKeyword that is determined to
  * contain SPICE kernel names.  It will optionally load the
  * kernels if initially requested and then adds the name to the
  * internally managed list.
  * 
  * Some keywords may contain special keywords.  These are ignored in this
  * method and can be handled explicitly in other methods.
  * 
  * @param key PvlKeyword containing SPICE kernels
  * @see  loadKernelFromTable()
  */
 void Kernels::loadKernel(PvlKeyword &key) {
   for (int i=0; i<key.Size(); i++) {
     if (key[i] == "") continue;
     if (iString(key[i]).UpCase() == "NULL") continue;
     if (iString(key[i]).UpCase() == "NADIR") continue;
     if (iString(key[i]).UpCase() == "TABLE") continue;
     Isis::Filename file(key[i]);
     if (!file.exists()) {
       string msg = "Spice file does not exist [" + file.Expanded() + "]";
       throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
     }
     string fileName(file.Expanded());
     if (_furnish) furnsh_c(fileName.c_str());
   }
 }
예제 #11
0
파일: iTime.cpp 프로젝트: corburn/ISIS
  //! Uses the Naif routines to load the most current leap second kernel.
  void iTime::LoadLeapSecondKernel() {
    // Inorder to improve the speed of iTime comparisons, the leapsecond
    // kernel is loaded only once and left open.
    if(p_lpInitialized) return;

    // Get the leap second kernel file open
    Isis::PvlGroup &dataDir = Isis::Preference::Preferences().findGroup("DataDirectory");
    QString baseDir = dataDir["Base"];
    baseDir += "/kernels/lsk/";
    FileName leapSecond(baseDir + "naif????.tls");

    QString leapSecondName(leapSecond.highestVersion().expanded());
    furnsh_c(leapSecondName.toAscii().data());

    p_lpInitialized = true;
  }
예제 #12
0
파일: Kernels.cpp 프로젝트: corburn/ISIS
 /**
  * @brief Load a kernel file
  *
  * The internal file structure contains information related to a kernel that
  * is common to the ISIS system.  Its status is checked and only if the
  * kernels is not loaded will it be loaded via the NAIF furnsh_c utility.  Its
  * load status is updated as well as its manage status (it becomes managed).
  *
  * @param kfile Structure containing the file to load
  *
  * @return bool True if the file is loaded successfully, false if not.  It may
  *         not be loaded for various reasons: it is not a NAIF type kernel or
  *         it failed to load due to errors or non-existance.
  */
 bool Kernels::Load(Kernels::KernelFile &kfile) {
   if (IsNaifType(kfile.ktype)) {
     if (!kfile.loaded) {
       NaifStatus::CheckErrors();
       try {
         furnsh_c(kfile.fullpath.toAscii().data());
         NaifStatus::CheckErrors();
         kfile.loaded = true;
         kfile.managed = true;
       }
       catch (IException &ie) {
         return (false);
       }
     }
   }
   return (kfile.loaded);
 }
예제 #13
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;
}
예제 #14
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;
}
예제 #15
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);
}
예제 #16
0
파일: Spice.cpp 프로젝트: assutech/isis3
  //! Load/furnish NAIF kernel(s)
  void Spice::Load(Isis::PvlKeyword &key) {
    NaifStatus::CheckErrors();

    for (int i=0; i<key.Size(); i++) {
      if (key[i] == "") continue;
      if (iString(key[i]).UpCase() == "NULL") break;
      if (iString(key[i]).UpCase() == "NADIR") break;
      if (iString(key[i]).UpCase() == "TABLE") break;
      Isis::Filename file(key[i]);
      if (!file.exists()) {
        string msg = "Spice file does not exist [" + file.Expanded() + "]";
        throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
      }
      string fileName(file.Expanded());
      furnsh_c(fileName.c_str());
      p_kernels.push_back((string)key[i]);
    }

    NaifStatus::CheckErrors();
  }
예제 #17
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;
}
예제 #18
0
    void SpicePosition::init() {
        erract_c("SET", 0, (char*)"IGNORE");

        const char * k = "../cfg/kernels.furnsh";
        furnsh_c(k);

        std::vector<std::string> ks;
        kernels(ks);

        for (std::vector<std::string>::iterator i = ks.begin(); i != ks.end(); i++) {
            getbodies(*i);
        }



        for (BodyConstantsConstIterator it = m_bodies.begin(); it != m_bodies.end(); it++) {
            EphemeridesInterval & interval = m_intervals[(*it)->id()];
            getinterval(ks, (*it)->id(), interval);

            if (it == m_bodies.begin()) {
                m_interval.a = interval.a;
                m_interval.b = interval.b;
            } else {
                m_interval.a = std::max(m_interval.a, interval.a);
                m_interval.b = std::min(m_interval.b, interval.b);
            }
        }

        m_interval.a += 100;
        m_interval.b -= 100;

        char timea[1000], timeb[1000];

        timout_c (m_interval.a, "YYYY ::TDB", sizeof(timea), timea);
        timout_c (m_interval.b, "YYYY ::TDB", sizeof(timeb), timeb);

        erract_c("SET", 0, (char*)"DEFAULT");
    }
예제 #19
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);
  }
예제 #20
0
int main (int argc, char **argv) {

  double lat, lon, time;

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

  for (int i=0; i< 100000; i++) {

    lat = pi_c()*rand()/RAND_MAX-halfpi_c();
    lon = twopi_c()*rand()/RAND_MAX-pi_c();
    time = 1167721200.*rand()/RAND_MAX + 946684800.;

    // failing badly, so testing w/ knownish values
    //    lat = 0.611738;
    //    lon = -1.85878;
    //    time = 1554616800.+i;

    //    double elev = bc_elev(lat, lon, unix2et(time), "10");
    double elev = bc_elev(lat, lon, unix2et(time), "10");

    printf("%f,%f,%f,%f\n", lat, lon, time, elev);
  }
}
예제 #21
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];
  }
예제 #22
0
int main() {

#define TIMFMT "YYYY-MON-DD HR:MN:SC.###### (TDB) ::TDB ::RND"
#define MAXVAL 10000
#define STRSIZ 41
#define LNSIZE 81
#define MAXPAR 10

  SpiceBoolean bail;
  SpiceBoolean rpt;

  SpiceChar begstr [LNSIZE] = "2001 jan 01 00:00:00.000";
  SpiceChar endstr [LNSIZE] = "2001 dec 31 00:00:00.000";
  SpiceChar event [] = "DISTANCE";
  SpiceChar relate [] = "LOCMAX";

 
  SpiceChar qpnams[SPICE_GFEVNT_MAXPAR][LNSIZE]={"TARGET","OBSERVER","ABCORR"};
  SpiceChar qcpars[SPICE_GFEVNT_MAXPAR][LNSIZE] = {"MOON","EARTH","LT+S"};
  SpiceDouble qdpars[SPICE_GFEVNT_MAXPAR];
  SpiceInt qipars[SPICE_GFEVNT_MAXPAR];
  SpiceBoolean qlpars[SPICE_GFEVNT_MAXPAR];
 

  SPICEDOUBLE_CELL ( cnfine, MAXVAL );
  SPICEDOUBLE_CELL ( result, MAXVAL );

  SpiceDouble begtim,endtim,step,refval,adjust,tol,beg,end;
  SpiceInt lenvals,nintvls,count,qnpars,i;

 furnsh_c ( "standard.tm" );

 str2et_c ( begstr, &begtim );
 str2et_c ( endstr, &endtim );
 wninsd_c ( begtim, endtim, &cnfine );
 count = wncard_c( &cnfine );
 printf( "Found %ld intervals in cnfine\n", count );

 
 step = 0.001 * spd_c();
 gfsstp_c ( step );


 bail = SPICETRUE;
 rpt = SPICETRUE;
 
 lenvals= LNSIZE;
 qnpars = 3;
 tol = SPICE_GF_CNVTOL;
 refval = 0.;
 adjust = 0.;
 nintvls= MAXVAL;

 gfevnt_c ( gfstep_c, gfrefn_c, event, qnpars, lenvals, qpnams,
 qcpars, qdpars, qipars, qlpars, relate, refval, tol, adjust, rpt,
 &gfrepi_c, gfrepu_c, gfrepf_c, nintvls, bail, gfbail_c, &cnfine,
 &result );

 if ( gfbail_c() ) {
   
   gfclrh_c();
 
   printf ( "\nSearch was interrupted.\n\nThis message "
	    "was written after an interrupt signal\n"
	    "was trapped. By default, the program "
	    "would have terminated \nbefore this message "
	    "could be written.\n\n" );
 }
 else
   {
     count = wncard_c( &result);
     printf( "Found %ld intervals in result\n", count );
     
     for( i=0; i<count; i++ )
       {
	 wnfetd_c( &result, i, &beg, &end );
	 
	 timout_c ( beg, TIMFMT, LNSIZE, begstr );
	 timout_c ( end, TIMFMT, LNSIZE, endstr );
	 
	 printf( "Interval %ld\n", i );
	 printf( "Beginning TDB %s\n", begstr );
	 printf( "Ending TDB %s\n", endstr );
       }
   }
 return (0);
}
예제 #23
0
//FUNCTION : loadKernels
int loadKernels(char *kernelsList)
{
	furnsh_c(kernelsList);

	return 1;
}
예제 #24
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);

  }
}
예제 #25
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);
  };

}