Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mutli-Segment DSKs are not being handled correctly #2632

Closed
jessemapel opened this issue Feb 21, 2019 · 5 comments · Fixed by #2791
Closed

Mutli-Segment DSKs are not being handled correctly #2632

jessemapel opened this issue Feb 21, 2019 · 5 comments · Fixed by #2791
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jessemapel
Copy link
Contributor

jessemapel commented Feb 21, 2019

This is issue has been reported by the Dawn mission team. Their comments follow:

the problem I'm running into is with the DSK/BDS versions of the shape model here:

https://naif.jpl.nasa.gov/pub/naif/DAWN/kernels/dsk/

I think the source of the issue is that all of the files there are made up of smaller files that are combined together (with SPICE dlacat perhaps), and ISIS does not seem to work well with compound files. For example, the file dawn_ceres_grv_m100_m00p03m0p3_v1.bds (a 30x30 degree area covering 0-30 lon and 0-30 lat) actually consists of 9 10x10 degree files combined together:

commnt -r dawn_ceres_grv_m100_m00p03m0p3_v1.bds | grep dawn_ceres_g

...
dawn_ceres_grv_m100_m00p01m0p1_v1.bds
dawn_ceres_grv_m100_m00p01p1p2_v1.bds
dawn_ceres_grv_m100_m00p01p2p3_v1.bds
dawn_ceres_grv_m100_p01p02m0p1_v1.bds
dawn_ceres_grv_m100_p01p02p1p2_v1.bds
dawn_ceres_grv_m100_p01p02p2p3_v1.bds
dawn_ceres_grv_m100_p02p03m0p1_v1.bds
dawn_ceres_grv_m100_p02p03p1p2_v1.bds
dawn_ceres_grv_m100_p02p03p2p3_v1.bds
...

Now, if I have an image that covers say 13-19 lon and 18-23 lat and I try to associate this shape model with it when running spiceinit, I get what looks like an out of range error:

  Error                     = "An unknown NAIF error has been encountered. The
                               short explanation provided by NAIF is
                               [SPICE(NOINTERCEPT)]. The Naif error is [Ray
                               from vertex number 0 having longitude
                               1.7929049593918E-01 and latitude
                               2.7200364968331E-01 (radians) to center of
                               target 2000001 did not intersect the surface 
                               defined by the input handle and descriptor.]"

I don't have that problem if the image is entirely in the range from 0-10 lon and 0-10 lat (which is the range of the first of the subfiles in the list above. And, when I try and get it into ISIS cube format with dsk2isis, the resulting cube only covers the first of the 9 subfiles in the list above (0-10 lon and 0-10 lat). So all of this points to ISIS not dealing well with compound DSK files and just reading the first component/subfile of them.

I'm not sure if this is more of a SPICE issue or if it's something to do with how ISIS calls/uses SPICE. If it's the latter, then it would be a good thing to update. Let me know if you have any more questions about this. I can try and put together a few example files to illustrate what I wrote above.

@jessemapel
Copy link
Contributor Author

This looks like an issue with how we are loading the DSKs. In NaifDskPlateModel::openDSK we are only loading the first segment of the DSK.

Since the full release of the DSK software, DSK files can now be furnshd. We can also try and load each segment instead of just the first.

@jessemapel
Copy link
Contributor Author

We will also need to update the DSK intersection calls to the new functions, dskxsi_c and latsrf_c.

@spacekawboy
Copy link

This is additional info David sent.

Hi Tim, here's a few examples that will hopefully illustrate the issue. I've attached a few test cubes, and you can get the DSK file at:

https://naif.jpl.nasa.gov/pub/naif/DAWN/kernels/dsk/dawn_ceres_grv_m100_m00p03m0p3_v1.bds

As I described in the previous email, this DSK covers 0-30 lat and 0-30 lon, but it's actually a compound file consisting of nine individual 10x10 degree panels. The individual subfiles can be listed using the SPICE toolkit "commnt" command

commnt -r dawn_ceres_grv_m100_m00p03m0p3_v1.bds | grep dawn_ceres_g

...
dawn_ceres_grv_m100_m00p01m0p1_v1.bds
dawn_ceres_grv_m100_m00p01p1p2_v1.bds
dawn_ceres_grv_m100_m00p01p2p3_v1.bds
dawn_ceres_grv_m100_p01p02m0p1_v1.bds
dawn_ceres_grv_m100_p01p02p1p2_v1.bds
dawn_ceres_grv_m100_p01p02p2p3_v1.bds
dawn_ceres_grv_m100_p02p03m0p1_v1.bds
dawn_ceres_grv_m100_p02p03p1p2_v1.bds
dawn_ceres_grv_m100_p02p03p2p3_v1.bds

The first test is to load it into ISIS:

dsk2isis from=dawn_ceres_grv_m100_m00p03m0p3_v1.bds to=dawn_ceres_grv_m100_m00p03m0p3_v1_dsk2isis.cub map=equi.map

Looking at the loaded cube, though (dawn_ceres_grv_m100_m00p03m0p3_v1_dsk2isis.jpg), only the first of the 9 subfiles, covering 0-10 lat and 0-10 lon, seems to be loaded. The rest of the data is NULL.

Another test is to use the DSK file with spiceinit. The first case here uses an image file that's entirely within the range 0-10 lat and 0-10 lon, and it seems to work fine:

spiceinit from=FC21B0050527_16007232707F1D.cub spkpredicted=yes shape=user model=dawn_ceres_grv_m100_m00p03m0p3_v1.bds
Group = Kernels
NaifFrameCode = -203121
LeapSecond = $base/kernels/lsk/naif0012.tls
TargetAttitudeShape = ($base/kernels/pck/pck00009.tpc,
$dawn/kernels/pck/dawn_ceres_v05.tpc,
$dawn/kernels/pck/dawn_ceres_v00.tf)
TargetPosition = ($dawn/kernels/tspk/de421.bsp,
$dawn/kernels/tspk/sb_ceres_140724.bsp)
InstrumentPointing = ($dawn/kernels/ck/dawn_sc_160104_160110.bc,
$dawn/kernels/fk/dawn_v14.tf,
$dawn/kernels/fk/dawn_fc_v3.bc)
Instrument = $dawn/kernels/ik/dawn_fc_v02.ti
SpacecraftClock = $dawn/kernels/sclk/DAWN_203_SCLKSCET.00091.tsc
InstrumentPosition = $dawn/kernels/spk/dawn_rec_151023-160202_160412-
_v1.bsp
InstrumentAddendum = $dawn/kernels/iak/dawnfcAddendum002.ti
ShapeModel = dawn_ceres_grv_m100_m00p03m0p3_v1.bds
InstrumentPositionQuality = Reconstructed
InstrumentPointingQuality = Reconstructed
CameraVersion = 2
End_Group

However, with another image that's outside of 0-10 lat and 0-10 lon (but still within the 0-30 lat and 0-30 lon that should still be covered by the DSK file), I get an out of range error:

spiceinit from=FC21B0050201_16006200347F1D.cub spkpredicted=yes shape=user model=dawn_ceres_grv_m100_m00p03m0p3_v1.bds
Group = Kernels
NaifFrameCode = -203121
LeapSecond = $base/kernels/lsk/naif0012.tls
TargetAttitudeShape = ($base/kernels/pck/pck00009.tpc,
$dawn/kernels/pck/dawn_ceres_v05.tpc,
$dawn/kernels/pck/dawn_ceres_v00.tf)
TargetPosition = ($dawn/kernels/tspk/de421.bsp,
$dawn/kernels/tspk/sb_ceres_140724.bsp)
InstrumentPointing = ($dawn/kernels/ck/dawn_sc_160104_160110.bc,
$dawn/kernels/fk/dawn_v14.tf,
$dawn/kernels/fk/dawn_fc_v3.bc)
Instrument = $dawn/kernels/ik/dawn_fc_v02.ti
SpacecraftClock = $dawn/kernels/sclk/DAWN_203_SCLKSCET.00091.tsc
InstrumentPosition = $dawn/kernels/spk/dawn_rec_151023-160202_160412-
_v1.bsp
InstrumentAddendum = $dawn/kernels/iak/dawnfcAddendum002.ti
ShapeModel = dawn_ceres_grv_m100_m00p03m0p3_v1.bds
InstrumentPositionQuality = Reconstructed
InstrumentPointingQuality = Reconstructed
CameraVersion = 2
Error = "An unknown NAIF error has been encountered. The
short explanation provided by NAIF is
[SPICE(NOINTERCEPT)]. The Naif error is [Ray
from vertex number 0 having longitude
2.3427275650753E-01 and latitude
2.5415972851239E-01 (radians) to center of
target 2000001 did not intersect the surface
defined by the input handle and descriptor.]"
End_Group
ERROR Unable to initialize camera model.

So again it seems like ISIS is only reading the first subfile/panel contained in the DSK file. Hopefully this illustrates the issues well enough, let me know if you have any questions.

Thanks,

Dave

@jlaura jlaura added this to the 3.7.0 milestone Feb 25, 2019
@jessemapel jessemapel added the bug Something isn't working label Feb 25, 2019
@jessemapel
Copy link
Contributor Author

Successfully reproduced, now to fix

@jessemapel
Copy link
Contributor Author

For ISIS 3.6.2, this has been fixed when using the Bullet ray casting engine. In order to use this, you will need to modify your IsisPreferences file so that your ShapeModel group looks like this

########################################################
# Specify which ray-tracing engine to use for shape
# models.
# 
# Leave the ShapeModel Group commented-out to continue
# using the ISIS3 default. 
#
# RayTraceEngine = Bullet | Embree
# OnError = Continue | Fail
# Tolerance = { numerical value that will be set as the
#           tolerance for the Bullet or Embree shape
#           model } 
# 
########################################################

Group = ShapeModel
  RayTraceEngine = Bullet
  OnError = Continue
#  CubeSupported = False
#  Tolerance = DBL_MAX
EndGroup

This will make ISIS use the Bullet library to do all intersections with DSK files. You may notice a small start-up time when working with a lev1 image that has been spiceinit'd with a DSK, but all of the processing after that will be significantly faster than the default NAIF Toolkit routines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants