Make v2 preprocessing scripts location-independent and add a runbook - #28
Make v2 preprocessing scripts location-independent and add a runbook#28Choumingzhao wants to merge 8 commits into
Conversation
…lags Both helper scripts previously required editing hardcoded paths/values in main() before running. Move them to argparse using the same --snake_case convention as stitch_tiled_representation.py and dpixel_retiler.py, and update the README accordingly. - convert_npy2tiff.py: --npy_path / --ref_tiff_path / --out_dir (required), --downsample_rate (default 1). - convert_shp_to_tiff.py: --shp_path (required), --tiff_path (default: same name/dir as the shapefile), --pixel_size (default 10, matching the prior main() call), --force_crs (default: auto UTM, parsed via CRS.from_user_input). - README: replace the "edit main()" instructions with runnable example commands for both scripts. Co-Authored-By: GLM-5 <noreply@z.ai>
Both preprocessing shell scripts required `cd tessera_preprocessing` before they would find their sibling processors/binaries, and their output subdirectories were hardcoded. Resolve SCRIPT_DIR so each can be invoked from anywhere, expose the output subdirectories as env vars so the layout lines up across steps, and add a runnable end-to-end runbook to the README. - s1_s2_downloader.sh: resolve SCRIPT_DIR and invoke s1/s2_fast_processor.py (plus the existence checks) via "$SCRIPT_DIR/...". Expose S1_RAW_SUBDIR / S2_RAW_SUBDIR (defaults data_sar_raw / data_raw) so the raw-output layout is configurable and matches what the stacker reads. - s1_s2_stacker.sh: resolve SCRIPT_DIR and invoke "$SCRIPT_DIR/s1_stack" / "$SCRIPT_DIR/s2_stack". Make BASE_DIR, S1_RAW_SUBDIR, S2_RAW_SUBDIR, PROCESSED_SUBDIR and DOWNSAMPLE_RATE env-var overridable, so the stacker picks up the downloader's output layout automatically and produces a step-numbered data_processed dir. - stitch_tiled_representation.py: add --out_name (default stitched_representation) so the final .npy/.tif can be named after the region/year; convert_npy2tiff.py already reuses the npy basename for the .tif. - README: add an "End-to-end runbook" section — one-time setup (venv, base deps with a fiona / gdal-config install note, PyTorch, v2 deps + Medium weights), a shared variable block, step-numbered commands (Step 0-5 → 0.roi / 1.data_* / 2.data_processed / 3.retiled_d_pixel / 4.embeddings_v2 / 5.result), and two one-click copy-paste blocks. Co-Authored-By: GLM-5 <noreply@z.ai>
SummaryRunning the v2 embedding pipeline end-to-end required a lot of manual Commit 1 — CLI flags for the convert helpers
Commit 2 — Location-independent scripts, configurable layout, and a runbookPreprocessing scripts run from anywhere (no Output layout is now configurable and consistent across steps. The raw
New "End-to-end runbook" in the README walks through the whole pipeline as
It includes a one-time Setup block (venv → base deps → PyTorch → v2 deps + Known install gotchaWhile following the tutorial, installing the base sudo apt install gdal-bin libgdal-devAll defaults in the shell scripts are generic placeholders (
|
… downloads
Two runbook refinements on top of the previous commit.
- Non-download steps now invoke the activated venv's `python` directly instead
of `"${PYTHON_ENV}"`. The downloader is the only step that still needs
PYTHON_ENV: it prefixes commands with `$PYTHON_ENV` and has an `-x` existence
check, so it needs an absolute interpreter path. Every other step runs after
the venv is activated in Setup, so `python` suffices. PYTHON_ENV now appears
only in the variable block (annotated), the two downloader invocations, and
the Step 1 parameter bullet.
- The downloader commands (Step 1 + Block A) now set
`S1_OVERWRITE=false` / `S2_OVERWRITE=false`. With the script default
`overwrite=true`, re-running Step 1 re-downloads and reprocesses every
observation day of every partition — wasteful when only a day or partition
failed. With `overwrite=false`, each day whose per-date output already exists
*and* validates is skipped (guard in `process_day_orbit` / `process_day` /
`process_day_opera`), so re-pasting fetches only the missing/invalid days.
Corrected the previously inaccurate "completed partitions are skipped" line
and added a parameter bullet citing the source guard.
Co-Authored-By: GLM-5 <noreply@z.ai>
|
|
|
thanks for the PR! the v2 codebase is still in its very early stage. do you manage to get it running? |
yeah, following the This PR is intend to make it easier for people to run their ROI quickly. I'm testing multi-year now. Will let you know when finished. |
…figs. s1_s2_downloader.sh: make `S1_OVERWRITE` and `S2_OVERWRITE` really work when passing from command line.
|
thank you! will review it later! |
|
Commit: 542d314
Following screenshots are 10m and 40m embeddings from same area.
Footnotes
|



Both preprocessing shell scripts required
cd tessera_preprocessingbeforethey would find their sibling processors/binaries, and their output
subdirectories were hardcoded. Resolve SCRIPT_DIR so each can be invoked from
anywhere, expose the output subdirectories as env vars so the layout lines up
across steps, and add a runnable end-to-end runbook to the README.
s1_s2_downloader.sh: resolve SCRIPT_DIR and invokes1/s2_fast_processor.py(plus the existence checks) via "$SCRIPT_DIR/...". Expose S1_RAW_SUBDIR /
S2_RAW_SUBDIR (defaults data_sar_raw / data_raw) so the raw-output layout is
configurable and matches what the stacker reads.
s1_s2_stacker.sh: resolve SCRIPT_DIR and invoke "$SCRIPT_DIR/s1_stack" /"$SCRIPT_DIR/s2_stack". Make BASE_DIR, S1_RAW_SUBDIR, S2_RAW_SUBDIR,
PROCESSED_SUBDIR and DOWNSAMPLE_RATE env-var overridable, so the stacker
picks up the downloader's output layout automatically and produces a
step-numbered data_processed dir.
stitch_tiled_representation.py: add --out_name (defaultstitched_representation) so the final .npy/.tif can be named after the
region/year; convert_npy2tiff.py already reuses the npy basename for the .tif.
README: add an "End-to-end runbook" section — one-time setup (venv, base depswith a fiona / gdal-config install note, PyTorch, v2 deps + Medium weights),
a shared variable block, step-numbered commands (Step 0-5 → 0.roi /
1.data_* / 2.data_processed / 3.retiled_d_pixel / 4.embeddings_v2 /
5.result), and two one-click copy-paste blocks.
Co-Authored-By: GLM-5 noreply@z.ai