API Reference
This section provides detailed reference information for the main scripts and their command-line interfaces.
Core Scripts
insar-query.py
Query and download InSAR data from the Norwegian Ground Motion Service.
| Bash | |
|---|---|
Options
| Parameter | Type | Description | Default |
|---|---|---|---|
--path |
string | Output directory for downloaded data | Required |
--bbox |
string | Bounding box (lon1,lat1,lon2,lat2) | Required |
--period |
string | Time period: 2019-2023, 2020-2024, 2018-2022, latest, all | 2019-2023 |
--list-datasets |
flag | List available datasets without downloading | False |
--include-radarsat |
flag | Also include Radarsat-2 datasets | False |
--datasets-only |
flag | Only query Sentinel datasets, skip other types | False |
--host |
string | Host server to query | https://insar.ngu.no |
--cert |
string | Root certificate for verification | Empty |
Example Usage
| Bash | |
|---|---|
hybrid_detector.py
Process InSAR data to detect significant ground motion changes.
| Bash | |
|---|---|
Algorithm Options (choose one)
| Algorithm | Description |
|---|---|
--ultra-selective |
Very strict criteria (default) |
--moderate |
Balanced detection |
--gradual |
Detect subtle changes |
--maximum |
Maximum sensitivity |
--baseline |
Baseline detection |
--original |
Legacy algorithm |
Processing Options
| Parameter | Type | Description | Default |
|---|---|---|---|
--path |
string | Directory containing CSV data files | Required |
--cpu-threads |
int | Number of CPU threads for processing | 8 |
--coherence |
float | Minimum coherence threshold (0.0-1.0) | 0.7 |
--fixed-2022-cutoff |
flag | Use fixed 2022-01-01 cutoff instead of flexible periods | False |
--threshold |
float | Change detection threshold | 2.0 |
--min-observations |
int | Minimum required observations for analysis | 10 |
--parallel-files |
int | Maximum files to process in parallel | 8 |
Example Usage
| Bash | |
|---|---|
gis_map_viewer.py
Launch interactive web-based map viewer for exploring results.
| Bash | |
|---|---|
Notes
- No command-line options available
- Automatically runs on http://127.0.0.1:5000
- Opens browser automatically after startup
- Debug mode is enabled by default
Required Files
change_detection_results.csvbinary_detection.tif(optional)Basisdata_*_FGDB/directories (optional)
Example Usage
insar-visualizer.py
Generate time-series plots for detected changes.
| Bash | |
|---|---|
Options
| Parameter | Type | Description | Default |
|---|---|---|---|
--results |
string | Path to change_detection_results.csv | Required |
--num-points |
int | Number of points per category | 5 |
--selection |
string | Point selection: highest, lowest, middle, mixed, all | mixed |
--output-dir |
string | Output directory for plots | visualizations |
Example Usage
CPU-Optimized Scripts
hybrid_detector-cpu.py
CPU-optimized version of the change detection algorithm.
| Bash | |
|---|---|
Same parameters as hybrid_detector.py but optimized for CPU processing.
insar-visualizer-cpu.py
CPU-optimized visualization script for large datasets.
| Bash | |
|---|---|
Same parameters as insar-visualizer.py with CPU optimizations.
Output File Formats
change_detection_results.csv
Main results file containing detected changes.
Columns
| Column | Type | Description |
|---|---|---|
easting |
float | X coordinate in EPSG:3035 (meters) |
northing |
float | Y coordinate in EPSG:3035 (meters) |
longitude |
float | Point longitude in WGS84 (decimal degrees) |
latitude |
float | Point latitude in WGS84 (decimal degrees) |
track |
string | Satellite track identifier |
file_source |
string | Source CSV file name |
coherence |
float | Temporal coherence value (0-1) |
change_magnitude |
float | Change magnitude (mm) |
is_significant |
boolean | Whether change is statistically significant |
valid_observations |
int | Number of valid observations |
confidence |
float | Detection confidence score |
Coordinate System Details
The CSV contains coordinates in both coordinate systems:
- EPSG:3035 (ETRS89-LAEA):
easting,northing- Used by GIS viewer for accurate European analysis - WGS84 (EPSG:4326):
latitude,longitude- Converted for compatibility with standard mapping tools
EPSG:3035 is preferred for analysis as it provides better accuracy for European data.
| track_type | string | Satellite track (ascending/descending) |
file_mapping.json
Maps internal point IDs to original data filenames.
| JSON | |
|---|---|
Return Codes
All scripts use standard return codes:
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments |
| 3 | File not found |
| 4 | Network error |
| 5 | Processing error |
Environment Variables
| Variable | Description | Default |
|---|---|---|
INSAR_DATA_PATH |
Default data directory | Current directory |
INSAR_THREADS |
Default CPU thread count | Auto-detect |
INSAR_COHERENCE |
Default coherence threshold | 0.7 |
Configuration Files
environment.yml
Conda environment specification for CPU processing.
environment-cpu.yml
Alternative CPU-only environment file.
requirements.txt
Pip requirements for manual installation.
Python API
For programmatic access, key functions can be imported:
| Python | |
|---|---|
Error Messages
Common error messages and their meanings:
| Error | Cause | Solution |
|---|---|---|
Invalid bounding box format |
Incorrect bbox syntax | Use lon1,lat1,lon2,lat2 |
No data files found |
Missing CSV files | Check path and run query first |
Insufficient memory |
Not enough RAM | Reduce threads or data size |
Network connection failed |
Internet issues | Check connection and retry |
CUDA not available |
GPU setup issues | Use CPU version or fix GPU setup |
Version Information
Check script versions: