Skip to content

Commit def65b4

Browse files
authored
moved ale quickstart from ale docs to here (#129)
* moved ale quickstart from ale docs to here * spelling recommend * spelling * spelling ignore * quickstart -> ale in python * remove duplicated info * reorganize isd_generate * Navigation through ALE Pages, central ALE page * defining drivers as label + spice * spelling
1 parent f1a7b5a commit def65b4

6 files changed

Lines changed: 309 additions & 120 deletions

File tree

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# ALE SPICE Data Setup & Driver Types
2+
3+
<div class="grid cards" markdown>
4+
5+
- [:octicons-arrow-left-24: ALE - Getting Started](../../getting-started/using-ale/index.md)
6+
7+
- [:octicons-arrow-right-24: ALE on the Command Line](../../getting-started/using-ale/isd-generate.md)
8+
9+
</div>
10+
11+
## To use ALE, you will need:
12+
13+
- [ ] An [ALE Installation](https://github.com/DOI-USGS/ale/blob/main/README.md).
14+
- [ ] An image ([Locating Image Data](../../getting-started/using-isis-first-steps/locating-and-ingesting-image-data.md))
15+
formatted according to your driver type.
16+
- [ ] ***SPICE Data according to your driver type***.
17+
18+
## ALE Driver Types and their requirements
19+
20+
=== "IsisLabel + NaifSpice"
21+
22+
For **NaifSpice + IsisLabel** Drivers, you will need:
23+
24+
- An image [imported](../../getting-started/using-isis-first-steps/locating-and-ingesting-image-data.md#introduction-to-importing) into [ISIS](../../how-to-guides/environment-setup-and-maintenance/installing-isis-via-anaconda.md) cube (.cub) format with a [`-2isis` app](https://isis.astrogeology.usgs.gov/Application/index.html).
25+
26+
- NAIF SPICE Kernels (See [Setting up NAIF Data](#setting-up-naif-data) below).
27+
28+
29+
=== "IsisLabel + IsisSpice"
30+
31+
For **IsisLabel + IsisSpice** Drivers, you will need:
32+
33+
- An image [imported](../../getting-started/using-isis-first-steps/locating-and-ingesting-image-data.md#introduction-to-importing) into [ISIS](../../how-to-guides/environment-setup-and-maintenance/installing-isis-via-anaconda.md) cube (.cub) format with a [`-2isis` app](https://isis.astrogeology.usgs.gov/Application/index.html),
34+
35+
- AND the resulting ISIS cube must be [`spiceinit`ed](https://isis.astrogeology.usgs.gov/Application/presentation/Tabbed/spiceinit/spiceinit.html) with `spiceinit from=<your.cub>`.
36+
37+
38+
=== "Pds3Label + NaifSpice"
39+
40+
For **NaifSpice + Pds3Label** Drivers, you will need:
41+
42+
- An image in PDS3 format
43+
44+
- NAIF SPICE Kernels (See [Setting up NAIF Data](#setting-up-naif-data) below).
45+
46+
-----
47+
48+
??? info "How Each Driver Mixin Works - *NaifSpice, IsisSpice, IsisLabel, and Pds3Label*"
49+
50+
**NaifSpice** drivers use the NAIF Kernels to look up spice data to an image, while **IsisSpice** drivers depend on an ISIS cube already having spice data attached with `spiceinit`.
51+
52+
**IsisLabel** drivers use images in the ISIS cube (.cub) format, while **Pds3Label** drivers use images in the PDS format.
53+
54+
There are 3 possible combinations of these mixins: `IsisLabel + NaifSpice`, `IsisLabel + IsisSpice`, and `Pds3Label + NaifSpice`.
55+
56+
**NaifSpice + IsisLabel** is the most commonly used driver type, but you can check the ALE driver to find out if IsisLabel + IsisSpice or Pds3Label + NaifSpice drivers are available instead or in addition:
57+
58+
1. Look at the [drivers in the ALE repository](https://github.com/DOI-USGS/ale/tree/main/ale/drivers).
59+
1. Click on the drivers for the spacecraft that captured your image.
60+
1. Find the class for your sensor, and look for NaifSpice, IsisSpice, IsisLabel, or Pds3Label next to the class name.
61+
62+
There may be a class for both NaifSpice and IsisSpice; in that case you can use either, or use the `-n` or `-i` argument to specify which one to use. You might use `-i` for IsisSpice if you want to avoid re-`spiceinit`ing a .cub.
63+
64+
By default, ALE will run through different drivers until either it finds the first one that works (at which point it will use that driver and complete its run), or all drivers fail.
65+
66+
## Setting Up NAIF Data
67+
68+
For use of NAIF Data with ISIS, see the [ISIS Data Area](../../how-to-guides/environment-setup-and-maintenance/isis-data-area.md). For use of NAIF data with ALE, continue below.
69+
70+
### Downloading NAIF SPICE Data with wget
71+
72+
!!! warning ""
73+
74+
[[NAIF SPICE Data Home](https://naif.jpl.nasa.gov/naif/data.html)]
75+
[[Getting Spice Kernels from the NAIF Server](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Tutorials/pdf/individual_docs/34_naif_server.pdf)]
76+
77+
If you have enough space, NAIF recommends downloading the entire dataset for your spacecraft, detailed below.
78+
Otherwise, you can try subsetting the data as detailed in the [NAIF Server tutorial](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Tutorials/pdf/individual_docs/34_naif_server.pdf).
79+
You will need `wget`, a common download utility.
80+
81+
Let's download the Clementine archive as a test.
82+
83+
1. Find your mission on the [PDS SPICE Archives](https://naif.jpl.nasa.gov/naif/data_archived.html) and copy the **Archive Link**.
84+
85+
- The url for the Clementine archive is:
86+
`https://naif.jpl.nasa.gov/pub/naif/pds/data/clem1-l-spice-6-v1.0/clsp_1000`
87+
88+
1. `cd` into you spice folder, the folder you have or will set as `$ALESPICEROOT`.
89+
90+
1. Piece together the `wget` command.
91+
1. Starting with this base command... (Don't run it yet!)
92+
`wget -m -nH --cut-dirs=5 -R 'index.html*'`
93+
94+
1. add the url...
95+
`-nv https://naif.jpl.nasa.gov/pub/naif/pds/data/clem1-l-spice-6-v1.0/`
96+
97+
1. then filter by the directory path (last half of url)...
98+
`-I pub/naif/pds/data/clem1-l-spice-6-v1.0/`
99+
100+
1. and download into this folder (just the folder at the end of the url).
101+
`-P clem1-l-spice-6-v1.0/`
102+
103+
1. Run the complete wget command:
104+
105+
```sh
106+
wget -m -nH --cut-dirs=5 -R 'index.html*' -nv https://naif.jpl.nasa.gov/pub/naif/pds/data/clem1-l-spice-6-v1.0/clsp_1000 -I pub/naif/pds/data/clem1-l-spice-6-v1.0/clsp_1000 -P clem1-l-spice-6-v1.0/
107+
```
108+
109+
-----
110+
*The Mars Reconnaissance Orbiter (MRO) archive, which corresponds to the B10_013341_1010_XN_79S172W
111+
used in the related tutorials, is 340 GB. A subset of SPICE data is provided in the tutorials, but if you will be
112+
working with more MRO images, and you have the space, you can try downloading the MRO Spice data.*
113+
114+
### Setting $ALESPICEROOT
115+
116+
!!! warning ""
117+
118+
When you are using a NaifSpice Driver, ALE looks under the `$ALESPICEROOT` directory for SPICE Kernels.
119+
You can echo it to see if it is set.
120+
121+
```sh
122+
echo $ALESPICEROOT
123+
```
124+
125+
To work with MRO images for example, you might download the MRO NAIF SPICE Kernels to a data drive.
126+
If your directory structure looks like `/Volumes/data/spice-data/mro-m-spice-6-v1.0/mrosp_1000`,
127+
then you should set `$ALESPICEROOT` like:
128+
129+
```sh
130+
export ALESPICEROOT=/Volumes/data/spice-data
131+
```
132+
133+
### Setting the Path Value in a metakernel
134+
135+
!!! warning ""
136+
137+
When using a NaifSpice Driver, $ALESPICEROOT must point to the relevant NAIF SPICE Data,
138+
and the metakernel within that data must be set.
139+
140+
```sh
141+
isd_generate -n -v B10_013341_1010_XN_79S172W.cub
142+
```
143+
144+
If the path value in your metakernel has not been set, you may get an error like this:
145+
146+
```sh
147+
File B10_013341_1010_XN_79S172W.cub: No Such Driver for Label
148+
```
149+
150+
Look up further in the verbose data, and if an unset metakernel is causing the problem, you will find something like:
151+
152+
```sh
153+
Trying <class 'ale.drivers.mro_drivers.MroCtxIsisLabelNaifSpiceDriver'>
154+
Failed:
155+
================================================================================
156+
157+
Toolkit version: CSPICE_N0067
158+
159+
SPICE(NOSUCHFILE) --
160+
161+
The first file './data/lsk/naif0012.tls' specified by KERNELS_TO_LOAD in the file /Volumes/data/spice-data/mro-m-spice-6-v1.0/mrosp_1000/extras/mk/mro_2009_v14.tm could not be located.
162+
```
163+
164+
Open that .tm file (`mro_2009_v14.tm`), and change the PATH_VALUES line to point to your data; the folder containing folders for lsk, pck, sclk, fk, ik, spk, ck, etc...
165+
166+
```
167+
PATH_VALUES = ( './data' )
168+
```
169+
170+
if your `$ALESPICEROOT` is `/Volumes/data/spice-data`, and you are working with an MRO image, you might change it to:
171+
172+
```
173+
PATH_VALUES = ( '/Volumes/data/spice-data/mro-m-spice-6-v1.0/mrosp_1000/data' )
174+
```
175+
176+
Now save the metakernel try again, and, if your SPICE Data is correctly configured, you should not see the same error:
177+
178+
```sh
179+
isd_generate -n -v B10_013341_1010_XN_79S172W.cub
180+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ALE in Python - `load` and `loads`
2+
3+
<div class="grid cards" markdown>
4+
5+
- [:octicons-arrow-left-24: ALE SPICE Data Setup](../../getting-started/using-ale/ale-naif-spice-data-setup.md)
6+
7+
- [:octicons-arrow-right-24: ALE on the Command Line](../../getting-started/using-ale/isd-generate.md)
8+
9+
</div>
10+
11+
*See [Getting Started with ALE](../../getting-started/using-ale/index.md) for an overview of ALE Installation, NAIF SPICE Data Setup, and other ALE Topics.*
12+
13+
## Basic Usage
14+
15+
The `ale.load` and `ale.loads` functions are
16+
the main interface for generating ISDs. Simply pass them the path to your image
17+
file/label and they will attempt to generate an ISD for it.
18+
19+
```py
20+
import ale
21+
22+
image_label_path = "/path/to/my/image.lbl"
23+
isd_string = ale.loads(image_label_path)
24+
```
25+
26+
-----
27+
28+
More advanced usage can be seen in the CSM Stack Notebooks:
29+
30+
<div class="grid cards" markdown>
31+
32+
- [:octicons-arrow-right-24: Instantiating a CSM Camera Model](../../getting-started/csm-stack/image-to-ground-tutorial.ipynb)
33+
34+
- [:octicons-arrow-right-24: Knoten - Basic Camera Operations](../../getting-started/csm-stack/knoten-camera-tutorial.ipynb)
35+
36+
</div>
37+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Getting Started with ALE
2+
3+
## :material-numeric-1-circle-outline: Install ALE & Get SPICE Data
4+
5+
<div class="grid cards" markdown>
6+
7+
- :material-package-variant:{ .lg .middle } __Install ALE in [conda](https://conda-forge.org/download/)__
8+
9+
---
10+
11+
```sh
12+
conda create -n ale
13+
conda activate ale
14+
conda install -c conda-forge ale
15+
```
16+
17+
[:octicons-link-external-16: ALE Readme](https://github.com/DOI-USGS/ale/blob/main/README.md)
18+
19+
- :octicons-download-16:{ .lg .middle } __Get SPICE Data__
20+
21+
---
22+
23+
Download SPICE Data.
24+
Tell ALE where to find it.
25+
Learn about image/driver types.
26+
27+
[:octicons-arrow-right-24: Setup SPICE Data for ALE](../../getting-started/using-ale/ale-naif-spice-data-setup.md)
28+
29+
</div>
30+
31+
-----
32+
33+
## :material-numeric-2-circle-outline: ALE Basic Usage
34+
35+
<div class="grid cards" markdown>
36+
37+
- :octicons-terminal-16:{ .lg .middle } __ALE on the Command Line__
38+
39+
---
40+
41+
Use `isd_generate` to create ISDs
42+
43+
[:octicons-arrow-right-24: Generate an ISD](../../getting-started/using-ale/isd-generate.md)
44+
45+
- :simple-python:{ .lg .middle } __ALE in Python__
46+
47+
---
48+
49+
Create ISDs with `ale.load` & `ale.loads`
50+
51+
[:octicons-arrow-right-24: Get Started in Python](../../getting-started/using-ale/ale-python-load-loads.md)
52+
53+
</div>
54+
55+
-----
56+
57+
## :material-numeric-3-circle-outline: Using ALE in the CSM Stack
58+
59+
<div class="grid cards" markdown>
60+
61+
- [:octicons-arrow-right-24: Instantiating a CSM Camera Model](../../getting-started/csm-stack/image-to-ground-tutorial.ipynb)
62+
63+
- [:octicons-arrow-right-24: Knoten - Basic Camera Operations](../../getting-started/csm-stack/knoten-camera-tutorial.ipynb)
64+
65+
</div>
66+
67+
-----
68+
69+
## :material-numeric-4-circle-outline: Advanced Topics & ALE Development
70+
71+
<div class="grid cards" markdown>
72+
73+
- [:octicons-arrow-right-24: Creating an ALE Driver](../../how-to-guides/ale-developer-guides/creating-ale-drivers.md)
74+
75+
- [:octicons-arrow-right-24: ALE Drive Architecture](../../concepts/ale/ale-driver-architecture.md)
76+
77+
</div>

0 commit comments

Comments
 (0)