Skip to content

LInOG MintPy Guide

Ariel Nopre Jr edited this page Jun 4, 2026 · 3 revisions

LInOG InSAR Training — MintPy Pipeline Guide

Path 448 Pre-Processed Data (Symlinked Workflow)

Version: 1.0
Date: 2026-06-04
Status: draft
Prepared by: Ariel J. Nopre Jr., NIGS UP Diliman


Frame Assignments

Each trainee is assigned one frame of the pre-processed ALOS-1 PALSAR Path 448 dataset. Your frame is symlinked into your home directory on felix — you do not need to re-run ISCE2 processing.

Trainee Username Frame FRAME_TAG
Kryzelle De Ocampo kryzelled F0280 P448F0280
Moises Montealegre moisesm F0290 P448F0290
Jonard Acid jonarda F0300 P448F0300
Deo Carlo Llamas deol F0310 P448F0310
Alfie Pelicano alfiep F0320 P448F0320

Prerequisites

Before starting, verify your environment on felix is correctly set up.

Run on: FELIX

# Check that the isce2 conda environment is active
echo $CONDA_DEFAULT_ENV    # should print: isce2

# If not active, load it
source /eggraid/miniconda3/etc/profile.d/conda.sh
conda activate isce2

# Prepend isce2 env bin to PATH — ensures python3 resolves to the isce2 env, not system Python
# Required: without this, numpy and mintpy imports fail even when the isce2 env appears active
export PATH=/eggraid/miniconda3/envs/isce2/bin:$PATH

# Add /eggraid/bin to PATH — required for linog_gen_interactive_kmz.py and other LInOG scripts
# Do this every session before running any deliverable generation steps
export PATH=$PATH:/eggraid/bin

# Confirm the scripts are reachable
which linog_gen_interactive_kmz.py    # should return /eggraid/bin/linog_gen_interactive_kmz.py
which linog_save_insar_images.py      # should return /eggraid/bin/linog_save_insar_images.py

Important: /eggraid/bin is not added to PATH automatically on login. If you skip this step, the interactive KMZ generation in Step 6 will fail with command not found. Add the export line to your ~/.bashrc to make it permanent:

echo 'export PATH=$PATH:/eggraid/bin' >> ~/.bashrc

Verify your symlinked frame exists:

ls ~/projects/linog/insar/p448/
# Should show your frame directory (e.g., f0280) and a mintpy/ folder

Step 1 — Set Your Frame Variables

Set these variables at the start of every session. Replace 0280 with your assigned frame number.

Run on: FELIX

export PATH_NUM=448
export FRAME_NUM=0280          # change to your frame: 0280 / 0290 / 0300 / 0310 / 0320
export FRAME_TAG=P${PATH_NUM}F${FRAME_NUM}
export WORK_DIR=~/projects/linog/insar/p448/mintpy
export FRAME_DIR=~/projects/linog/insar/p448

echo "Frame tag: $FRAME_TAG"
echo "Working dir: $WORK_DIR"

Note: These variables are not persistent across sessions. Re-run this block every time you open a new terminal.


Step 2 — Run the MintPy Time-Series Pipeline

MintPy reads the pre-processed ISCE2 interferograms from your symlinked frame and runs the full small-baseline time-series inversion.

Run on: FELIX

# Create logs directory
mkdir -p $WORK_DIR/logs

# Navigate to mintpy directory
cd $WORK_DIR

# Run the full pipeline (this takes 30–60 minutes)
smallbaselineApp.py smallbaselineApp.cfg 2>&1 | tee logs/smallbaselineApp.log

Note: The smallbaselineApp.cfg file is pre-configured with the correct paths to your frame's Igrams, geometry, and DEM. Do not edit it unless instructed.

When complete, verify the primary outputs exist:

ls $WORK_DIR/geo/
# Expected files include:
# geo_velocity.h5
# geo_timeseries_ramp_demErr.h5
# geo_maskTempCoh.h5
# geo_geometryRadar.h5

Step 3 — Generate demErr Velocity Files

MintPy produces a combined ramp+demErr corrected timeseries. You need to generate separate velocity files for the two correction levels required by the deliverables checklist.

Run on: FELIX

cd $WORK_DIR

# Copy final velocity as the demErr_ramp product
cp geo/geo_velocity.h5 geo/geo_velocity_demErr_ramp.h5

# Compute velocity from ramp-only corrected timeseries (proxy for demErr-only)
timeseries2velocity.py timeseries_ramp.h5 -o timeseries_ramp_velocity.h5

# Geocode it
geocode.py timeseries_ramp_velocity.h5 -l inputs/geometryRadar.h5 \
    -o geo/geo_velocity_demErr.h5

# Verify both files exist
ls geo/geo_velocity_demErr*.h5

Step 4 — Generate Vertical and Horizontal Velocity Components

LOS (line-of-sight) velocity is decomposed into vertical and horizontal components using the incidence angle from the geometry file.

Run on: FELIX

cd $WORK_DIR

python3 << 'EOF'
import numpy as np
from mintpy.utils import readfile, writefile

for suffix in ['demErr', 'demErr_ramp']:
    vel, atr = readfile.read(f'geo/geo_velocity_{suffix}.h5', datasetName='velocity')
    inc, _   = readfile.read('geo/geo_geometryRadar.h5', datasetName='incidenceAngle')
    inc_rad  = np.deg2rad(inc)

    vert = vel / np.cos(inc_rad)
    horz = vel / np.sin(inc_rad)

    writefile.write(vert, out_file=f'geo/geo_velocity_{suffix}_vertical.h5',   metadata=atr)
    writefile.write(horz, out_file=f'geo/geo_velocity_{suffix}_horizontal.h5', metadata=atr)
    print(f'Done: {suffix}')
EOF

Step 5 — Create the Interactive KMZ Symlink

The interactive KMZ script requires geo_timeseries_demErr.h5. Since only the ramp+demErr version exists, create a symlink:

Run on: FELIX

cd $WORK_DIR/geo
ln -s geo_timeseries_ramp_demErr.h5 geo_timeseries_demErr.h5

Step 6 — Generate All Deliverables (Phase 6)

This step generates all 16 files required by the Section 15 Deliverables Checklist: hillshade PNGs, GeoTIFFs, standard KMZs, and interactive KMZs.

Run on: FELIX

cd $WORK_DIR

# Create upload folder
OUT=geo/LInOG_Upload_${FRAME_TAG}
mkdir -p $OUT

MASK=geo/geo_maskTempCoh.h5
GEOM=geo/geo_geometryRadar.h5

# --- 15.1 & 15.2: Hillshade PNGs ---
view.py geo/geo_velocity_demErr.h5 velocity --mask $MASK -d $GEOM \
    -v -10 10 --shade-exag 0.05 --nodisplay --save \
    -o $OUT/${FRAME_TAG}_Velocity_Hillshade_demErr.png --dpi 600

view.py geo/geo_velocity_demErr_ramp.h5 velocity --mask $MASK -d $GEOM \
    -v -10 10 --shade-exag 0.05 --nodisplay --save \
    -o $OUT/${FRAME_TAG}_Velocity_Hillshade_demErr_ramp.png --dpi 600

view.py geo/geo_velocity_demErr_vertical.h5 velocity --mask $MASK -d $GEOM \
    -v -10 10 --shade-exag 0.05 --nodisplay --save \
    -o $OUT/${FRAME_TAG}_Velocity_Hillshade_Vertical.png --dpi 600

view.py geo/geo_velocity_demErr_horizontal.h5 velocity --mask $MASK -d $GEOM \
    -v -10 10 --shade-exag 0.05 --nodisplay --save \
    -o $OUT/${FRAME_TAG}_Velocity_Hillshade_Horizontal.png --dpi 600

view.py geo/geo_velocity_demErr_ramp_vertical.h5 velocity --mask $MASK -d $GEOM \
    -v -10 10 --shade-exag 0.05 --nodisplay --save \
    -o $OUT/${FRAME_TAG}_Velocity_Hillshade_Vertical_ramp.png --dpi 600

view.py geo/geo_velocity_demErr_ramp_horizontal.h5 velocity --mask $MASK -d $GEOM \
    -v -10 10 --shade-exag 0.05 --nodisplay --save \
    -o $OUT/${FRAME_TAG}_Velocity_Hillshade_Horizontal_ramp.png --dpi 600

# --- 15.1 & 15.2: GeoTIFFs ---
save_gdal.py geo/geo_velocity_demErr.h5           -d velocity -o $OUT/${FRAME_TAG}_Velocity_demErr.tif
save_gdal.py geo/geo_velocity_demErr_ramp.h5      -d velocity -o $OUT/${FRAME_TAG}_Velocity_demErr_ramp.tif
save_gdal.py geo/geo_velocity_demErr_vertical.h5  -d velocity -o $OUT/${FRAME_TAG}_Velocity_Vertical.tif
save_gdal.py geo/geo_velocity_demErr_horizontal.h5 -d velocity -o $OUT/${FRAME_TAG}_Velocity_Horizontal.tif
save_gdal.py geo/geo_velocity_demErr_ramp_vertical.h5   -d velocity -o $OUT/${FRAME_TAG}_Velocity_Vertical_ramp.tif
save_gdal.py geo/geo_velocity_demErr_ramp_horizontal.h5 -d velocity -o $OUT/${FRAME_TAG}_Velocity_Horizontal_ramp.tif

# --- 15.1 & 15.2: Standard KMZs ---
save_kmz.py geo/geo_velocity_demErr.h5     velocity -o $OUT/${FRAME_TAG}_Velocity_demErr.kmz
save_kmz.py geo/geo_velocity_demErr_ramp.h5 velocity -o $OUT/${FRAME_TAG}_Velocity_demErr_ramp.kmz

# --- 15.1 & 15.2: Interactive KMZs ---
linog_gen_interactive_kmz.py --path $PATH_NUM --frame $FRAME_NUM \
    --correction demErr --frame-dir $FRAME_DIR

linog_gen_interactive_kmz.py --path $PATH_NUM --frame $FRAME_NUM \
    --correction demErr_ramp --frame-dir $FRAME_DIR

Step 7 — Verify the Deliverables Checklist

Run a final count to confirm all 16 files are present before downloading.

Run on: FELIX

ls $WORK_DIR/geo/LInOG_Upload_${FRAME_TAG}/ | sort
echo ""
echo "Total files: $(ls $WORK_DIR/geo/LInOG_Upload_${FRAME_TAG}/ | wc -l)"
echo "Expected: 16"

Expected output (16 files):

P448FXXXX_TimeSeries_demErr.kmz
P448FXXXX_TimeSeries_demErr_ramp.kmz
P448FXXXX_Velocity_demErr.kmz
P448FXXXX_Velocity_demErr.tif
P448FXXXX_Velocity_demErr_ramp.kmz
P448FXXXX_Velocity_demErr_ramp.tif
P448FXXXX_Velocity_Hillshade_demErr.png
P448FXXXX_Velocity_Hillshade_demErr_ramp.png
P448FXXXX_Velocity_Hillshade_Horizontal.png
P448FXXXX_Velocity_Hillshade_Horizontal_ramp.png
P448FXXXX_Velocity_Hillshade_Vertical.png
P448FXXXX_Velocity_Hillshade_Vertical_ramp.png
P448FXXXX_Velocity_Horizontal.tif
P448FXXXX_Velocity_Horizontal_ramp.tif
P448FXXXX_Velocity_Vertical.tif
P448FXXXX_Velocity_Vertical_ramp.tif

Step 8 — Phase 4.5: Download Interferograms for Local Visualization

Note: The manual (Section 10) uses interferograms/ in the rsync path. For Path 448 pre-processed data, the correct directory is Igrams/. Use the command below instead.

Run on: LOCAL

export PATH_NUM=448
export FRAME_NUM=0280          # change to your frame
export PADDED_PATH=p${PATH_NUM}
export PADDED_FRAME=f${FRAME_NUM}
export FRAME_TAG=P${PATH_NUM}F${FRAME_NUM}
export BASE_DIR=$HOME/LInOG/insar
export WORK_DIR=${BASE_DIR}/${PADDED_PATH}/${PADDED_FRAME}
export FELIX_USER=kryzelled     # change to your felix username

mkdir -p "${WORK_DIR}/Igrams/logs"
cd "${WORK_DIR}/Igrams"

rsync -avh --progress \
    "${FELIX_USER}@felix:/eggraid/home/${FELIX_USER}/projects/linog/insar/${PADDED_PATH}/${PADDED_FRAME}/Igrams/*/filt*.int*" \
    . \
    2>&1 | tee logs/fetch_igrams.log.v1

After download, run the image generation scripts (Section 10 of the manual):

conda activate isce2_local
python linog_save_insar_images.py 2>&1 | tee logs/01_save_images.log.v1
python linog_create_grid.py --path "$PATH_NUM" --frame "$FRAME_NUM" 2>&1 | tee logs/02_report_grid.log.v1

Step 9 — Download MintPy Deliverables to Your Local Machine

Run this on your local computer (not on felix) to download the completed deliverables.

Run on: LOCAL

# Set your frame number before running
export FRAME_NUM=0280          # change to your frame
export FRAME_TAG=P448F${FRAME_NUM}
export FELIX_USER=kryzelled    # change to your felix username

mkdir -p ~/LInOG/insar/p448/f${FRAME_NUM}/deliverables

rsync -avP \
    ${FELIX_USER}@felix:/eggraid/home/${FELIX_USER}/projects/linog/insar/p448/mintpy/geo/LInOG_Upload_${FRAME_TAG}/ \
    ~/LInOG/insar/p448/f${FRAME_NUM}/deliverables/

Note: You will be prompted for your felix password. If you have SSH key authentication set up, the transfer will proceed automatically.

After the transfer completes, open the folder and do a final visual check:

  • Open the .png hillshade files to review the velocity maps
  • Load the .kmz files in Google Earth to verify spatial coverage
  • Confirm the .tif files open correctly in QGIS or similar

Troubleshooting

Error Cause Fix
smallbaselineApp.cfg not found Wrong working directory Run cd ~/projects/linog/insar/p448/mintpy first
ModuleNotFoundError: numpy python3 resolving to system Python despite isce2 env active Run export PATH=/eggraid/miniconda3/envs/isce2/bin:$PATH
stackStripMap.py: command not found PATH missing stripmapStack Run export PATH=$PATH:/eggraid/miniconda3/envs/isce2/share/isce2/stripmapStack
No module named 'stripmapStack' PYTHONPATH incorrect Run export PYTHONPATH=$PYTHONPATH:/eggraid/miniconda3/envs/isce2/share/isce2
geocode.py: error: -d/--dem required ISCE2's geocode.py is shadowing MintPy's Use python3 -m mintpy.cli.geocode instead of geocode.py
linog_gen_interactive_kmz.py not found /eggraid/bin not in PATH Run export PATH=$PATH:/eggraid/bin
Permission denied on mintpy dir Root-owned directory Contact the instructor to run sudo chown -R $USER ~/projects/linog/insar/p448/mintpy
FileNotFoundError: .slc.xml in run_08 Incomplete ISCE2 pipeline Use the symlinked p448 data instead — p449 processing is incomplete for some frames

Directory Structure Reference

After completing all steps, your directory structure on felix should look like this:

~/projects/linog/insar/p448/
├── f0280/          ← symlink to pre-processed ISCE2 outputs
│   ├── Igrams/
│   ├── geom_reference/
│   ├── merged/
│   ├── baselines/
│   └── ...
└── mintpy/         ← your MintPy working directory (writable)
    ├── smallbaselineApp.cfg
    ├── timeseries.h5
    ├── timeseries_ramp.h5
    ├── timeseries_ramp_demErr.h5
    ├── velocity.h5
    ├── inputs/
    │   ├── ifgramStack.h5
    │   └── geometryRadar.h5
    ├── geo/
    │   ├── geo_velocity.h5
    │   ├── geo_velocity_demErr.h5
    │   ├── geo_velocity_demErr_ramp.h5
    │   ├── geo_velocity_demErr_vertical.h5
    │   ├── geo_velocity_demErr_horizontal.h5
    │   ├── geo_geometryRadar.h5
    │   ├── geo_maskTempCoh.h5
    │   ├── geo_timeseries_ramp_demErr.h5
    │   ├── geo_timeseries_demErr.h5  ← symlink
    │   └── LInOG_Upload_P448FXXXX/  ← 16 deliverable files
    └── logs/

LInOG Project — NIGS, UP Diliman | DOST-PCIEERD funded
ALOS-1 PALSAR FBS | Path 448 | Central Luzon | 2007–2011