Modified spice2xyzv tool to write a comment header for generated xyzv files. The header contains the SPICE kernels used, the reference frame, creation time, and other parameters used to produce the xyzv file.

ver1_6_1
Chris Laurel 2008-05-31 00:41:15 +00:00
parent cc8f545677
commit d8aa8223a1
1 changed files with 54 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#include <fstream>
#include <iomanip>
#include <cmath>
#include <ctime>
using namespace std;
@ -336,6 +337,58 @@ bool convertSpkToXyzv(const Configuration& config,
}
// Dump information about the xyzv file in the comment header
void writeCommentHeader(const Configuration& config,
ostream& out)
{
SpiceInt observerID = 0;
SpiceInt targetID = 0;
SpiceBoolean found = SPICEFALSE;
bodn2c_c(config.observerName.c_str(), &observerID, &found);
if (!found)
return;
bodn2c_c(config.targetName.c_str(), &targetID, &found);
if (!found)
return;
out << "# Celestia xyzv file generated by spice2xyzv\n";
out << "#\n";
time_t now = 0;
time(&now);
out << "# Creation date: " << ctime(&now);
out << "#\n";
out << "# SPICE kernel files used:\n";
for (vector<string>::const_iterator iter = config.kernelList.begin();
iter != config.kernelList.end(); iter++)
{
out << "# " << *iter << endl;
}
out << "#\n";
out << "# Start date: " << config.startDate << endl;
out << "# End date: " << config.endDate << endl;
out << "# Observer: " << config.observerName << " (" << observerID << ")" << endl;
out << "# Target: " << config.targetName << " (" << targetID << ")" << endl;
out << "# Frame: " << config.frameName << endl;
out << "#\n";
out << "# Min step size: " << config.minStepSize << " s" << endl;
out << "# Max step size: " << config.maxStepSize << " s" << endl;
out << "# Tolerance: " << config.tolerance << " km" << endl;
out << "#\n";
out << "# Records are <jd> <x> <y> <z> <vel x> <vel y> <vel z>\n";
out << "# Time is a TDB Julian date\n";
out << "# Position in km\n";
out << "# Velocity in km/sec\n";
out << endl;
}
bool readConfig(istream& in, Configuration& config)
{
QuotedString qs;
@ -434,7 +487,6 @@ int main(int argc, char* argv[])
return 1;
}
// Check that all required parameters are present.
if (config.startDate.empty())
{
@ -466,6 +518,7 @@ int main(int argc, char* argv[])
return 1;
}
writeCommentHeader(config, cout);
convertSpkToXyzv(config, cout);
return 0;