Commit 13011e7b authored by Jeannie Backer's avatar Jeannie Backer
Browse files

Updated from trunk.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6825 41f8697f-d340-4b68-9986-7bafba869bb8
parent 3b1bfd99
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -214,18 +214,17 @@ namespace Isis {

    double CI[3][3];
    double IJ[3][3];
    std::vector<double> rtime;
    double rtime;
    SpiceRotation *prot = p_spi->bodyRotation();
    std::vector<double> CJ;
    CJ.resize(9);

    for(std::vector<double>::size_type pos = 0; pos < p_cacheTime.size(); pos++) {
      double et = p_cacheTime.at(pos);
      rtime.push_back((et - GetBaseTime()) / GetTimeScale());
      rtime = (et - GetBaseTime()) / GetTimeScale();
      double angle1 = function1.Evaluate(rtime);
      double angle2 = function2.Evaluate(rtime);
      double angle3 = function3.Evaluate(rtime);
      rtime.clear();

// Get the first angle back into the range Naif expects [180.,180.]
      if(angle1 < -1 * pi_c()) {
+2 −2
Original line number Diff line number Diff line
@@ -290,8 +290,8 @@ namespace Isis {
    function2.SetCoefficients(p_ang2Coefficients);

    // Compute polynomial approximations to angles, pangle1 and pangle2
    std::vector<double> rtime;
    rtime.push_back((et - p_baseTime) / p_timeScale);
    double rtime;
    rtime = (et - p_baseTime) / p_timeScale;
    double pangle1 = p_sampOff + p_sampScale * function1.Evaluate(rtime);
    double pangle2 = p_lineOff + p_lineScale * function2.Evaluate(rtime);

+6 −6
Original line number Diff line number Diff line
@@ -22,8 +22,13 @@ void IsisMain() {
  Process p;
  Cube *icube = p.SetInputCube("FROM");

  // Setup the histogram
  UserInterface &ui = Application::GetUserInterface();
  if(!ui.WasEntered("TO") && !ui.IsInteractive()) {
    QString msg = "The [TO] parameter must be entered";
    throw IException(IException::User, msg, _FILEINFO_);
  }
  
  // Setup the histogram
  Histogram hist(*icube, 1, p.Progress() );
  if(ui.WasEntered("MINIMUM") ) {
    hist.SetValidRange(ui.GetDouble("MINIMUM"),ui.GetDouble("MAXIMUM") );     
@@ -48,11 +53,6 @@ void IsisMain() {

  if(!ui.IsInteractive() || ui.WasEntered("TO") ) {
    // Write the results

    if(!ui.WasEntered("TO") ) {
      QString msg = "The [TO] parameter must be entered";
      throw IException(IException::User, msg, _FILEINFO_);
    }
    QString outfile = ui.GetFileName("TO");
    ofstream fout;
    fout.open(outfile.toLatin1().data());
+6 −2
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@
      of user-specified bins displayed in grapical/text output.
      See Ref #2188.
    </change>
    <change name="Curtis Rose" date="2016-06-10">
     Changed the application to fail immediately if the TO argument is not
     entered from the commandline. Fixes #3914.
    </change>	
  </history>

  <oldName>
+81 −25
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@
#include "ProcessRubberSheet.h"
#include "ProjectionFactory.h"
#include "Statistics.h"
#include "Target.h"
#include "TextFile.h"
#include "TProjection.h"
#include "NaifStatus.h"

using namespace std;
using namespace Isis;
@@ -62,16 +62,15 @@ void IsisMain() {
  UserInterface &ui = Application::GetUserInterface();

  //Set the sample and line increments
  int sinc = (int)(inCube->sampleCount() * 0.10);
  float sinc = (inCube->sampleCount() * 0.10);
  if (ui.WasEntered("SINC")) {
    sinc = ui.GetInteger("SINC");
  }

  int linc = (int)(inCube->lineCount() * 0.10);
  float linc = (inCube->lineCount() * 0.10);
  if (ui.WasEntered("LINC")) {
    linc = ui.GetInteger("LINC");
  }

  //Set the degree of the polynomial to use in our functions
  int degree = ui.GetInteger("DEGREE");

@@ -83,6 +82,7 @@ void IsisMain() {
  LeastSquares sampSol(sampFunct);
  LeastSquares lineSol(lineFunct);


  //Setup the variables for solving the stereographic projection
  //x = cos(latitude) * sin(longitude - lon_center)
  //y = cos(lat_center) * sin(latitude) - sin(lat_center) * cos(latitude) * cos(longitude - lon_center)
@@ -90,15 +90,13 @@ void IsisMain() {
  //Get the center lat and long from the input cubes
  double lat_center = latCube->statistics()->Average() * PI / 180.0;
  double lon_center = lonCube->statistics()->Average() * PI / 180.0;


  /**
   * Loop through lines and samples projecting the latitude and longitude at those
   * points to stereographic x and y and adding these points to the LeastSquares
   * matrix.
   */
  for (int i = 1; i <= inCube->lineCount(); i += linc) {
    for (int j = 1; j <= inCube->sampleCount(); j += sinc) {
  for (float i = 1; i <= inCube->lineCount(); i += linc) {
    for (float j = 1; j <= inCube->sampleCount(); j += sinc) {
      latBrick.SetBasePosition(j, i, 1);
      latCube->read(latBrick);
      if(IsSpecial(latBrick.at(0))) continue;
@@ -134,8 +132,15 @@ void IsisMain() {
  }

  //Solve the least squares functions using QR Decomposition
  try {
    sampSol.Solve(LeastSquares::QRD);
    lineSol.Solve(LeastSquares::QRD);
  }
  catch (IException &e) {
    FileName inFile = ui.GetFileName("FROM");  
    QString msg = "Unable to calculate transformation of projection for [" + inFile.expanded() + "].";
    throw IException(e, IException::Unknown, msg, _FILEINFO_);
  }

  //If the user wants to save the residuals to a file, create a file and write
  //the column titles to it.
@@ -144,7 +149,6 @@ void IsisMain() {
    oFile.Open(ui.GetFileName("RESIDUALS"), "overwrite");
    oFile.PutLine("Sample,\tLine,\tX,\tY,\tSample Error,\tLine Error\n");
  }

  //Gather the statistics for the residuals from the least squares solutions
  Statistics sampErr;
  Statistics lineErr;
@@ -226,6 +230,8 @@ void IsisMain() {

    PvlKeyword equRadius;
    PvlKeyword polRadius;


    //If the user entered the equatorial and polar radii
    if (ui.WasEntered("EQURADIUS") && ui.WasEntered("POLRADIUS")) {
      equRadius = PvlKeyword("EquatorialRadius", toString(ui.GetDouble("EQURADIUS")));
@@ -233,10 +239,36 @@ void IsisMain() {
    }
    //Else read them from the pck
    else {
      PvlGroup radii = Target::radiiGroup(targetName[0]);
      equRadius = radii["EquatorialRadius"];
      polRadius = radii["PolarRadius"];
      FileName pckFile("$base/kernels/pck/pck?????.tpc");
      pckFile = pckFile.highestVersion();

      QString pckFileName = pckFile.expanded();

      NaifStatus::CheckErrors();
      furnsh_c(pckFileName.toLatin1().data());

      QString target = targetName[0];
      SpiceInt code;
      SpiceBoolean found;

      bodn2c_c(target.toLatin1().data(), &code, &found);
      NaifStatus::CheckErrors();

      if (!found) {
        QString msg = "Could not convert Target [" + target +
                     "] to NAIF code";
        throw IException(IException::Io, msg, _FILEINFO_);
      }

      SpiceInt n;
      SpiceDouble radii[3];

      bodvar_c(code, "RADII", &n, radii);

      equRadius = PvlKeyword("EquatorialRadius", toString(radii[0] * 1000));
      polRadius = PvlKeyword("PolarRadius", toString(radii[2] * 1000));
    }

    mapGrp.addKeyword(equRadius, Pvl::Replace);
    mapGrp.addKeyword(polRadius, Pvl::Replace);

@@ -877,6 +909,14 @@ void ComputeInputRange() {
    }
    //Else read them from the pck
    else {
      FileName pckFile("$base/kernels/pck/pck?????.tpc");
      pckFile = pckFile.highestVersion();

      QString pckFileName = pckFile.expanded();

      NaifStatus::CheckErrors();
      furnsh_c(pckFileName.toLatin1().data());

      QString target;

      //If user entered target
@@ -890,9 +930,25 @@ void ComputeInputRange() {
        target = (QString)fromFile.findKeyword("TargetName", Pvl::Traverse);
      }

      PvlGroup radii = Target::radiiGroup(target);
      equRadius = double(radii["EquatorialRadius"]);
      polRadius = double(radii["PolarRadius"]);
      SpiceInt code;
      SpiceBoolean found;

      bodn2c_c(target.toLatin1().data(), &code, &found);
      NaifStatus::CheckErrors();

      if (!found) {
        QString msg = "Could not convert Target [" + target +
                     "] to NAIF code";
        throw IException(IException::Io, msg, _FILEINFO_);
      }

      SpiceInt n;
      SpiceDouble radii[3];

      bodvar_c(code, "RADII", &n, radii);

      equRadius = radii[0] * 1000;
      polRadius = radii[2] * 1000;
    }

    if (isOcentric) {
Loading