-
Notifications
You must be signed in to change notification settings - Fork 33
Ale Kernel Selection Methods
This pages lists out all of the current ways to instantiate a naif spice driver using ALE. Currently there are two sources for spice data, either naif spice data from furnished kernels or spice data from an ISIS cube. The methods outlined bellow are for instantiating a driver that obtains its spice data from naif spice.
This method uses metakernels that can be downloaded from:
https://naif.jpl.nasa.gov/pub/naif/pds/data/{mission}/{mission_sub_directory}/extras/mk/*
So for MRO the mission is mro-m-spice-6-v1.0
and the mission_sub_directory is mrosp_1000
so the full URL for MRO is:
https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/extras/mk/*
Metakernels contain string paths to kernels that are in the data
directory located along side of the extras
directory. These metakernels are parsed and the kernel paths are loaded into memory, more commonly referred to as furnishing kernels. So to use metakernels you will need both the extras
directory and the data
directory from the respective mission. The best way to do this is to download the entire directory under the respective mission.
To get all of the necessary data for MRO you would download:
https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/
While this will contain more information than you absolutely need it's the structure that ALE is expecting.
Once these kernels and metakernels are accessible, the ALESPICEROOT
environment variable will need to be set which will be whatever directory your data is sitting in. (The data directory being something like /Path/to/data/
where mro-m-spice-6-v1.0
would be sitting under that path.)
For people internal to the USGS:
Add the following to your .bashrc:
alias spicemount='sudo mount -t nfs -o resvport beegfs-mgt.wr.usgs.gov:/beegfs-scratch/spice /scratch/spice/'
Then either source your .bashrc and run spicemount
or open a new terminal and run spicemount
. You may need to create the /scratch/spice/
directory on your computer.
Once that is done you should be able to run export ALESPICEROOT=/scratch/spice/
then be able to instantiate any driver that has a directory under /scratch/spice/
.
For people external to the USGS:
You should only need to run export ALESPICEROOT=/Path/to/data/
then be able to instantiate any driver that has a directory under /Path/to/data/
Once ALESPICEROOT
is set, driver instantiation should look something like this:
file = '/Path/to/Label.lbl'
with MyNaifDriver(file) as driver:
isd = to_isis(driver)
Any driver can be instantiated through a list of kernels passed in through the a props argument in a driver. Example:
file = '/Path/to/Label.lbl'
kernels = [Some, list, of, kernels]
with MyNaifDriver(file, props={'kernels': kernels}) as driver:
isd = to_isis(driver)
This allows numerous ways to generate some list of kernels to pass through to the driver.
There is a function in ALE's util module called generate_kernels_from_cube
, which generates either a list or a dict of kernels from an ISIS spiceinit'd cube. This list of kernels could then be passed into the driver instantiation as above where the kernels
list is the list generated from the aforementioned function.
spice_init_cube = '/Path/to/spiceinit'd/cube.cub'
file = '/Path/to/Label.lbl'
kernels = ale.util.generate_kernels_from_cube(spice_init_cube)
with MyNaifDriver(file, props={'kernels': kernels}) as driver:
isd = to_isis(driver)
Similarly to the above, you can also generate a metakernel from an ISIS cube. The path to the metakernel could then be used in driver instantiation rather than a list of kernels.
spice_init_cube = '/Path/to/spiceinit'd/cube.cub'
file = '/Path/to/Label.lbl'
metakernel = '/Path/to/new/mk.mk'
ale.util.write_metakernel_from_cube(spice_init_cube, mkpath=metakernel)
kernels = [metakernel]
with MyNaifDriver(file, props={'kernels': kernels}) as driver:
isd = to_isis(driver)
If you know exactly what kernels you need and where they are located, you could also just create your own list of kernels for furnishing.
file = '/Path/to/Label.lbl'
kernels = ['/Path/to/ck.bc',
'/Path/to/spk.bsp',
... ,
'/Path/to/iak.ti']
with MyNaifDriver(file, props={'kernels': kernels}) as driver:
isd = to_isis(driver)