Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added AllowError option to campt #5437

Merged
merged 7 commits into from
Apr 5, 2024

Conversation

amystamile-usgs
Copy link
Contributor

Description

Related Issue

closes #5393

How Has This Been Validated?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation change (update to the documentation; no code change)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Infrastructure change (changes to things like CI or the build system that do not impact users)

Checklist:

  • I have read and agree to abide by the Code of Conduct
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added myself to the .zenodo.json document.
  • I have added my user impacting change to the CHANGELOG.md document.

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

  • I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

@Kelvinrr
Copy link
Collaborator

Gonna tag @acpaquette here since I think he is best to review this.

@acpaquette
Copy link
Collaborator

@amystamile-usgs So far this looks good but I think it needs a little more. While campt will no longer fail it seems like the desired output won't be provided, specifically the ephemeris data.

I may be wrong but we will need to expose the ephemeris data somewhere around here in CameraPointInfo.cpp

Given the current changes, does the ephemeris data get reported even on error?

@amystamile-usgs
Copy link
Contributor Author

@acpaquette This is the output with these changes:

campt from=~/testData/campt-ephemeris-data/VIR_VIS_1A_1_362681635_1.cub sample=0.0 line=0.0 allowerror=true
Group = GroundPoint
  Filename                   = /Users/astamile/testData/campt-ephemeris-data/-
                               VIR_VIS_1A_1_362681635_1.cub
  Sample                     = 0.0
  Line                       = 0.0
  PixelValue                 = NULL
  RightAscension             = NULL
  Declination                = NULL
  PlanetocentricLatitude     = NULL
  PlanetographicLatitude     = NULL
  PositiveEast360Longitude   = NULL
  PositiveEast180Longitude   = NULL
  PositiveWest360Longitude   = NULL
  PositiveWest180Longitude   = NULL
  BodyFixedCoordinate        = (NULL, NULL, NULL)
  LocalRadius                = NULL
  SampleResolution           = NULL
  LineResolution             = NULL
  ObliqueDetectorResolution  = NULL
  ObliquePixelResolution     = NULL
  ObliqueLineResolution      = NULL
  ObliqueSampleResolution    = NULL

  # Spacecraft Information
  SpacecraftPosition         = (NULL, NULL, NULL)
  SpacecraftAzimuth          = NULL
  SlantDistance              = NULL
  TargetCenterDistance       = NULL
  SubSpacecraftLatitude      = NULL
  SubSpacecraftLongitude     = NULL
  SpacecraftAltitude         = NULL
  OffNadirAngle              = NULL
  SubSpacecraftGroundAzimuth = NULL

  # Sun Information
  SunPosition                = (NULL, NULL, NULL)
  SubSolarAzimuth            = NULL
  SolarDistance              = NULL
  SubSolarLatitude           = NULL
  SubSolarLongitude          = NULL
  SubSolarGroundAzimuth      = NULL

  # Illumination and Other
  Phase                      = NULL
  Incidence                  = NULL
  Emission                   = NULL
  NorthAzimuth               = NULL

  # Time
  EphemerisTime              = 362681627.86732 <seconds>
  UTC                        = 2011-06-30T04:52:41.6831702
  LocalSolarTime             = NULL
  SolarLongitude             = NULL
  LookDirectionBodyFixed     = NULL
  LookDirectionJ2000         = NULL
  LookDirectionCamera        = NULL
  Error                      = "Requested position does not project in camera
                                model; no surface intersection"
End_Group
This function(PvlObject::addLogGroup) will be depreciated in ISIS3 v9.0 in favor of Application::appendLogGroup

@acpaquette
Copy link
Collaborator

So even if we don't get a target intersection we still know where the spacecraft is, where the sun is, as well as the various look directions. Rather than those being NULL they should be some value

@amystamile-usgs
Copy link
Contributor Author

So even if we don't get a target intersection we still know where the spacecraft is, where the sun is, as well as the various look directions. Rather than those being NULL they should be some value

Gotcha. Okay I will look into adding this.

@amystamile-usgs
Copy link
Contributor Author

@acpaquette Here is the new output with my most recent push. Let me know if this is what you had in mind.

campt from=~/testData/campt-ephemeris-data/VIR_VIS_1A_1_362681635_1.cub sample=0 line=0 allowerror=true
Group = GroundPoint
  Filename                   = /Users/astamile/testData/campt-ephemeris-data/-
                               VIR_VIS_1A_1_362681635_1.cub
  Sample                     = 0.0
  Line                       = 0.0
  PixelValue                 = Null
  RightAscension             = 273.60969682341 <DEGREE>
  Declination                = -5.9086378766684 <DEGREE>
  PlanetocentricLatitude     = 12.87652975146 <DEGREE>
  PlanetographicLatitude     = 20.005687396323 <DEGREE>
  PositiveEast360Longitude   = 271.77604985107 <DEGREE>
  PositiveEast180Longitude   = -88.223950148932 <DEGREE>
  PositiveWest360Longitude   = 88.223950148932 <DEGREE>
  PositiveWest180Longitude   = 88.223950148932 <DEGREE>
  BodyFixedCoordinate        = (8.1268692810831, -262.09070773209,
                                59.942599464894) <km>
  LocalRadius                = 268980.85492174 <meters>
  SampleResolution           = -1.79769313486231e+308 <meters/pixel>
  LineResolution             = -1.79769313486231e+308 <meters/pixel>
  ObliqueDetectorResolution  = -1.79769313486231e+308 <meters>
  ObliquePixelResolution     = -1.79769313486231e+308 <meters/pix>
  ObliqueLineResolution      = -1.79769313486231e+308 <meters>
  ObliqueSampleResolution    = -1.79769313486231e+308 <meters>

  # Spacecraft Information
  SpacecraftPosition         = (22572.463806328, -81336.57777876,
                                -52651.494775526) <km>
  SpacecraftAzimuth          = NULL
  SlantDistance              = 99301.144934871 <km>
  TargetCenterDistance       = 99485.350223766 <km>
  SubSpacecraftLatitude      = NULL
  SubSpacecraftLongitude     = NULL
  SpacecraftAltitude         = NULL
  OffNadirAngle              = NULL
  SubSpacecraftGroundAzimuth = 163.93679419381 <DEGREE>

  # Sun Information
  SunPosition                = (209857804.37538, -211848605.09938,
                                -143392280.91876) <km>
  SubSolarAzimuth            = NULL
  SolarDistance              = 2.2117942083132 <AU>
  SubSolarLatitude           = -25.681404502858 <DEGREE>
  SubSolarLongitude          = 314.72951885617 <DEGREE>
  SubSolarGroundAzimuth      = 132.84045118433 <DEGREE>

  # Illumination and Other
  Phase                      = 26.246429406428 <DEGREE>
  Incidence                  = NULL
  Emission                   = NULL
  NorthAzimuth               = NULL

  # Time
  EphemerisTime              = 362681627.86732 <seconds>
  UTC                        = 2011-06-30T04:52:41.6831702
  LocalSolarTime             = 9.1364353996598 <hour>
  SolarLongitude             = 250.04939429175 <DEGREE>

  # Look Direction Unit Vectors in Body Fixed, J2000, and Camera Coordinate Systems.
  LookDirectionBodyFixed     = (-0.09938640027495, 0.84155117272123,
                                0.53095571108324)
  LookDirectionJ2000         = (0.062624942180615, -0.99271393616209,
                                -0.10294249640672)
  LookDirectionCamera        = (0.12224457399522, 0.009182572755764,
                                0.99245752779971)
  Error                      = "Requested position does not project in camera
                                model; no surface intersection"

@acpaquette
Copy link
Collaborator

Overall looks great! I don't fully understand how you are able to get lats and lons as well as a bodyfixed coordinate if you don't intersect the target. The resolutions also don't seem to make much sense.

Could we make sure that those values aren't being populated by some previous setImage/setGround call?

@amystamile-usgs
Copy link
Contributor Author

@acpaquette SetImage failed so it was using a previous SetImage from LoadCache. So I just changed it to only grab SpacecraftPosition, SunPosition, and LookDirection.

New Output:

campt from=~/testData/campt-ephemeris-data/VIR_VIS_1A_1_362681635_1.cub sample=0 line=0 allowerror=true
Group = GroundPoint
  Filename                   = /Users/astamile/testData/campt-ephemeris-data/-
                               VIR_VIS_1A_1_362681635_1.cub
  Sample                     = 0.0
  Line                       = 0.0
  PixelValue                 = Null
  RightAscension             = Null
  Declination                = Null
  PlanetocentricLatitude     = Null
  PlanetographicLatitude     = Null
  PositiveEast360Longitude   = Null
  PositiveEast180Longitude   = Null
  PositiveWest360Longitude   = Null
  PositiveWest180Longitude   = Null
  BodyFixedCoordinate        = Null
  LocalRadius                = Null
  SampleResolution           = Null
  LineResolution             = Null
  ObliqueDetectorResolution  = Null
  ObliquePixelResolution     = Null
  ObliqueLineResolution      = Null
  ObliqueSampleResolution    = Null

  # Spacecraft Information
  SpacecraftPosition         = (22572.463806328, -81336.57777876,
                                -52651.494775526) <km>
  SpacecraftAzimuth          = Null
  SlantDistance              = Null
  TargetCenterDistance       = Null
  SubSpacecraftLatitude      = Null
  SubSpacecraftLongitude     = Null
  SpacecraftAltitude         = Null
  OffNadirAngle              = Null
  SubSpacecraftGroundAzimuth = Null

  # Sun Information
  SunPosition                = (209857804.37538, -211848605.09938,
                                -143392280.91876) <km>
  SubSolarAzimuth            = Null
  SolarDistance              = Null
  SubSolarLatitude           = Null
  SubSolarLongitude          = Null
  SubSolarGroundAzimuth      = Null

  # Illumination and Other
  Phase                      = Null
  Incidence                  = Null
  Emission                   = Null
  NorthAzimuth               = Null

  # Time
  EphemerisTime              = 362681627.86732 <seconds>
  UTC                        = 2011-06-30T04:52:41.6831702
  LocalSolarTime             = Null
  SolarLongitude             = Null
  LookDirectionBodyFixed     = (-0.09938640027495, 0.84155117272123,
                                0.53095571108324)
  LookDirectionJ2000         = (0.062624942180615, -0.99271393616209,
                                -0.10294249640672)
  LookDirectionCamera        = (0.12224457399522, 0.009182572755764,
                                0.99245752779971)
  Error                      = "Requested position does not project in camera
                                model; no surface intersection"
End_Group

(*gp)[i].addValue("NULL");
(*gp)[i].addValue("NULL");
(*gp)[i].addValue("NULL");
if (!allowErrors) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic seems like it will put all Nulls in a normal campt case if allowErrors isn't enabled. It seems like the logic should be !allowErrors && !noErrors

I can pull the branch and test this locally

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize this was nested. Scratch my comment

Copy link
Collaborator

@acpaquette acpaquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, all campt tests passed locally. This may break other tests so I will fire up a AWS EC2 to run tests.

acpaquette
acpaquette previously approved these changes Apr 4, 2024
Copy link
Collaborator

@acpaquette acpaquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests look good!

@amystamile-usgs amystamile-usgs merged commit 3fe2d96 into DOI-USGS:dev Apr 5, 2024
@github-actions github-actions bot added the enhancement New feature or request label Apr 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Campt Ephemeris data on no intersection
3 participants