Commit 3b38f16a authored by Jeannie Backer's avatar Jeannie Backer
Browse files

PROG: Fixed changes to Latitude and nocam2map that overwrote previous commits.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7228 41f8697f-d340-4b68-9986-7bafba869bb8
parent 6ee2ee04
Loading
Loading
Loading
Loading
+19 −67
Original line number Diff line number Diff line
@@ -16,14 +16,15 @@
#include "Cube.h"
#include "IString.h"
#include "LeastSquares.h"
#include "NaifStatus.h"
#include "nocam2map.h"
#include "PolynomialBivariate.h"
#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;
@@ -71,6 +72,7 @@ void IsisMain() {
  if (ui.WasEntered("LINC")) {
    linc = ui.GetInteger("LINC");
  }

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

@@ -82,7 +84,6 @@ 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,6 +91,8 @@ 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
@@ -149,6 +152,7 @@ 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;
@@ -230,8 +234,6 @@ 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")));
@@ -239,36 +241,10 @@ void IsisMain() {
    }
    //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.toAscii().data());

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

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

      if (!found) {
        QString msg = "Could not convert Target [" + target +
                     "] to NAIF code";
        throw IException(IException::Io, msg, _FILEINFO_);
      PvlGroup radii = Target::radiiGroup(targetName[0]);
      equRadius = radii["EquatorialRadius"];
      polRadius = radii["PolarRadius"];
    }

      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);

@@ -909,14 +885,6 @@ 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.toAscii().data());

      QString target;

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

      SpiceInt code;
      SpiceBoolean found;

      bodn2c_c(target.toAscii().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;
      PvlGroup radii = Target::radiiGroup(target);
      equRadius = double(radii["EquatorialRadius"]);
      polRadius = double(radii["PolarRadius"]);
    }

    if (isOcentric) {
+4 −0
Original line number Diff line number Diff line
@@ -136,6 +136,10 @@
    <change name="Kristin Berry" date="2015-07-22">
      Added NaifStatus::CheckErrors() to see if any NAIF errors were signaled. References #2248
    </change>
    <change name="Jeannie Backer" date="2016-05-10">
      Replaced calls to NAIF routines (bodn2c and bodvar) with call to static method
      Isis::Target::radiiGroup. References #3934
    </change>
    <change name="Curtis Rose" date="2016-05-16">
      Fixed an issue with small cubes (9x9 or less) causing application to become stuck in an infinite loop. References #2284.
      Also added to the description a message about why the application fails on small cubes (5x1, 1x5, or less).
+1 −1
Original line number Diff line number Diff line
@@ -26,9 +26,9 @@
#include "IException.h"
#include "IString.h"
#include "PvlGroup.h"
#include "QString"
#include "SpecialPixel.h"
#include "Target.h"
#include "QString"

namespace Isis {