Skip to content
This Git repository consolidates a collection of scripts that have been developed as part of a highly-automated workflow for generating digital terrain models (DTMs) from CTX and HiRISE stereo image data using the NASA Ames Stereo Pipeline (ASP).
Branch: sasp
Clone or download
Pull request Compare This branch is 38 commits ahead of USGS-Astrogeology:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Stefano's version of USGS ASP Scripts

I modified USGS ASP Scripts and added some of my own to produce CTX, HiRISE, and HRSC (work in progress) DEMs from stereo pairs.

I would like to thank USGS for providing this amazing toolset for free to the community.

These scripts are currently under development, and by no means stable and guaranteed to work on every machine. If you encounter any issues, feel free to report them, I always appreciate.

Major edits to the original USGS scripts and settings

  • CTX: Removed code inherent to high-performance computing environments using the SLURM job manager. This can be added back with a few lines of code, but I don't need it and prefer to keep the code cleaner for easier testing and debugging.
  • CTX: Removed and substitude with ISIS caminfo to produce a Transverse Mercator projection with reference longitude equal to the central latitude of the left image. This projection solves distorion issues associated with the default Sinusoidal projection at high latitudes.
  • CTX: Step 1 now can be run with the optional flag -w. This tells spiceinit to download SPICE kernels using the USGS ISIS Web service. This avoids the need to download all the kernels when installing ISIS, thus saving 10s GB of disk space and time. Also, this eliminates the need to keep the kernels up to date.
  • CTX: Moved creation of low resolution DEM from the beginning of step 3 to the end of step 2. There are two reasons for this: (1) It seemed logical to me to generate the DEM right after running parallel_stereo instead of a completely separate script, (2) one can check the result of parallel_stereo with SGM right away after running step 2.
  • CTX: Step 2 is meant to run with Semi-Global Matching settings. So, I renamed the step 2 script to reflect this crucial detail, and wrote a new setting file 'ctx_SGM_step2.stereo'. I recommend taking a look at these settings, because mine are not necessarily ideal for your particular situation.
  • CTX: All the scripts that take advantage of multiprocessing now read in the number of cpu cores as an argument. You can find info on your CPUs with 'cat /proc/cpuinfo'. This way, multithreading settings are not hardcoded anymore and don't need to be edited.
  • CTX: All scripts now keep the wroking folder cleaner by either better organizing files or deleting unnecessary files. This is usually done at the end of each script, so you can easily disable it.


Supported Platforms

This version of USGS ASP Scripts has been tested only on Linux Ubuntu.

Basic Usage

Scripts for processing CTX, HiRISE, and HRSC data are organized into their own subdirectories. The order in which individual scripts should be run is listed below. To make things easier, I put a sequence number in front of each script. Please see comments in the individual scripts for detailed usage information. Running any of the scripts without arguments will print a usage message.


  1. Download .IMG EDR files. My favorite way to do this is via JMARS>Web Browse.
  5. (Optional: Estimate max displacement between initial CTX DTM and MOLA PEDR using your favorite GIS software)


  3. (Estimate max displacement between initial HiRISE DTM and reference DTM, such as CTX, using your favorite GIS)

Referencing this Workflow

Please give all credits to the USGS Team by citing one or both of the following LPSC abstracts in any publications that make use of this work or derivatives thereof:

  1. Mayer, D.P. and Kite, E.S., "An Integrated Workflow for Producing Digital Terrain Models of Mars from CTX and HiRISE Stereo Data Using the NASA Ames Stereo Pipeline," (2016) LPSC XLVII, Abstr. #1241. E-poster:
  2. Mayer, D. P., "An Improved Workflow for Producing Digital Terrain Models of Mars from CTX Stereo Data Using the NASA Ames Stereo Pipeline," (2018) LPSC XLIX, Abstr. #1604. E-poster:

The Ames Stereo Pipeline itself should be cited according to guidelines outlined in the official ASP documentation:

You can’t perform that action at this time.