Skip to content

Add a standalone slope filtering pipeline and update bbox parsing#49

Open
cmspeed wants to merge 9 commits into
OPERA-Cal-Val:mainfrom
cmspeed:add-standalone-sf
Open

Add a standalone slope filtering pipeline and update bbox parsing#49
cmspeed wants to merge 9 commits into
OPERA-Cal-Val:mainfrom
cmspeed:add-standalone-sf

Conversation

@cmspeed
Copy link
Copy Markdown
Collaborator

@cmspeed cmspeed commented Apr 23, 2026

This PR adds a standalone pipeline for generating slope-filtered versions of DIST-HLS and RTC products (opera-disaster slope-filter). The output is identical to the opera-disaster run when -m landslide and -st are specified; however, the key difference is the input to the slope filtering are either (1) local OPERA DIST-HLS / RTC granules or (2) local OPERA DIST-HLS / RTC mosaics. The standalone slope filtering automatically obtains B10_DEM.tif layers covering the AOI from the OPERA DSWx-HLS and generates a dem.tif and slope.tif. The slope.tif is used to mask pixels less than -st.

This PR also standardizes bounding box parsing across the CLI (i.e., run, search, download, mosaic)

Changes

  • Implemented run_slope_filter_only to generate slope-filtered outputs within a local directory.
  • Implemented apply_slope_mask_to_raster to dynamically reproject the slope.tif mask to match any target raster's specific grid in-memory, ensuring slope filtering can be done on both individual granules and mosaics.
  • Implemented fetch_missing_dems to ensure all DEMs (from DSWx-HLS, band 10) are downloaded to the local directory before proceeding.
  • Refactored get_local_spatial_properties to extract CRS and bounds directly from raster headers usingrasterio, rather than relying on OPERA text metadata.
  • Standardized bounding box parsing using a new parse_bbox_input helper.
  • Standardized the mosaic command's input flag from -i to -ld for CLI consistency.

How to run

Here is a scenario for which the standalone slope filtering could be applied.

(1) Download DIST-HLS / RTC granules locally:

opera-disaster download -b Brazil_DaNCE_AOI.kml -d 2024-05-08/2024-05-15 -m landslide -o testing-sf

(2) Create daily mosaics from the input granules:

opera-disaster mosaic -b Brazil_DaNCE_AOI.kml -ld testing-sf/data -o testing-sf/data/mosaics

(3) Apply a slope filter to the mosaics and save the new outputs in a subdirectory:

opera-disaster slope-filter -ld testing-sf/data/mosaics -o testing-sf/data/mosaics/slope_filtered -st 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant