Boundary detection of dispersal impact craters based on morphological characteristics, using lunar Digital Elevation Model (DEM) data.
Based on: Liu et al. (2017) — Boundary Detection of Dispersal Impact Craters Based on Morphological Characteristics Using Lunar Digital Elevation Model.
- D8 Flow Direction — Computes ArcGIS-style flow directions from DEM
- Raw Crater Regions — Identifies depressions via priority-flood sink filling and D8 watershed expansion
- Shape Classification — Classifies regions as strip / radial / suborbicular / square (§III-B)
- Independent Craters — Filters false craters using posture ratio, rectangle factor, and sink validation (§III-C)
- Affiliated Craters — Detects dispersal crater rims via profile analysis and inflection point detection (§III-D)
core.py— D8 flow direction computationpreprocess.py— Sink filling (priority-flood) and depression core labelingdepression.py— Depression identification, basin expansion, and morphological metricsfalse_crater_filter.py— Independent crater filtering (§III-C)affiliated.py— Affiliated dispersal crater detection with profile analysis (§III-D)cli.py— CLI entry point for the full pipelineio.py— Raster and GeoJSON I/O utilitiesvalidate.py— D8 flow direction validationdirections.py— D8 neighbor encoding constants_numba.py— Optional Numba JIT acceleration
# Full pipeline (generates all outputs)
python -m code.cli <DEM.tif> --paper-shortcut
# D8 flow direction only
python -m code.cli <DEM.tif> <output_flow.tif>| Parameter | Default | CLI Flag | Purpose |
|---|---|---|---|
| Min crater depth | 7.0 m |
--crater-min-depth |
Fill-depth threshold for a cell to be classified as a crater sink |
| Min region size | 9 cells |
--min-region-cells |
Minimum watershed-expanded basin area |
| Max posture ratio | 1.12 |
--posture-ratio |
Max L/W ratio for shape acceptance (strip vs. radial) |
| Sink-fill method | priority-flood |
--preprocess-method |
Algorithm used for hydrological conditioning |
| Property | Requirement |
|---|---|
| Format | GeoTIFF (.tif) — single-band, 32-bit float |
| Data type | Elevation in metres (float32 / float64) |
| CRS | Any projected CRS with metric units; pixel size is read directly from the raster transform |
| Nodata | Any sentinel value or NaN; auto-detected from raster metadata, overridable via --nodata |
| Band count | Single band (band 1 is read) |
| Minimum size | ≥ 3 × 3 cells (smaller grids skip sink-filling) |
Source: The pipeline was designed and validated against the Lunar Reconnaissance Orbiter Camera (LROC) NAC DEM tiles, as used in Liu et al. (2017). Any single-band elevation raster with consistent metric units will work.
📦 Datasets: bhargav247/DIP26_G01_Datasets on Hugging Face
- Cell size is derived from the affine transform (
|a|for x,|e|for y). - Can be overridden via
--cellsize-xand--cellsize-yfor rasters without a valid transform. - D8 flow direction uses the true diagonal distance
√(cellsize_x² + cellsize_y²)for slope comparison.
| File | Type | Description |
|---|---|---|
<prefix>_flow.tif |
GeoTIFF uint8 | D8 flow direction (ArcGIS encoding: 1/2/4/8/16/32/64/128) |
raw_crater_regions.tif |
GeoTIFF int32 | All watershed-expanded depression labels |
crater_regions_strip.tif |
GeoTIFF int32 | Strip-classified regions |
crater_regions_radial.tif |
GeoTIFF int32 | Radial-classified regions |
crater_regions_suborbicular.tif |
GeoTIFF int32 | Suborbicular regions |
crater_regions_square.tif |
GeoTIFF int32 | Square-classified regions |
crater_labels_independent.tif |
GeoTIFF int32 | False-crater-filtered independent craters |
crater_rims_independent.geojson |
GeoJSON | Independent crater rim polygons with metrics |
affiliated_analysis.geojson |
GeoJSON | Profile lines, inflection points, hulls |
crater_rims_affiliated.geojson |
GeoJSON | Final affiliated crater rims |