-
Notifications
You must be signed in to change notification settings - Fork 5
Code Modules
The Code/ directory contains processing scripts, QA tools, and one-time utilities. Scripts are organised into prefixed subdirectories.
Code/
├── DS02_DatasetQA/ # Dataset quality assurance scripts
│ ├── QA00_SpectralValidation.py
│ ├── QA02_SpectralRunComparison.py
│ └── README.md
├── DS03_PlotExtractionCode/ # Plot-level data extraction
│ └── PE00_LIDAR_extraction.py
├── functions/ # Shared utility functions
│ ├── core_functions/
│ │ ├── parse_APPN_dataset_path.py
│ │ ├── outputs_up_to_date.py
│ │ └── tests/
│ │ └── test_parse_APPN_dataset_path.py
│ └── spectral_qc/ # Shared spectral-QC helpers (QA00/QA02)
└── OT00_OneTimeScripts/ # One-time migration/maintenance scripts
├── OT00_RenameTiertoT.py
└── OT01_MoveGrawToRaw.py
Scripts use a prefix system:
| Prefix | Meaning | Example |
|---|---|---|
DS |
Dataset processing step | DS02_DatasetQA |
QA |
Quality assurance | QA00_SpectralValidation.py |
PE |
Plot extraction | PE00_LIDAR_extraction.py |
OT |
One-time script |
OT00_RenameTiertoT.py, OT01_MoveGrawToRaw.py
|
File: Code/DS02_DatasetQA/QA00_SpectralValidation.py
Full documentation: Code/DS02_DatasetQA/README.md
Author: Arden Burrell
Version: v2.2 (13.08.2026)
Extracts spectral data from ELM/VAL reflectance panels in hyperspectral imaging datasets and produces a per-run QC report and figure. Panel files must follow the official AerialDataQC naming convention. The summary below covers the essentials — see the linked README for tested package versions, full folder-structure assumptions, output schemas, troubleshooting, and future enhancements.
- Searches for QC panel vector files matching
QC_{ELM|VAL}[_{id}]_Panels[_{extra}].geojson(or.shp) underT1_proc/QC_data/ - Locates corresponding VNIR and SWIR orthomosaic rasters
- Extracts per-pixel reflectance with per-band wavelengths (nm) into
QC_data/QC_Spectral_Tables/QC_{ELM|VAL}[_{id}]_spectra_{VNIR|SWIR}[_gproN].{parquet|csv} - Identifies the physical panel set from its
Panel_refsignature (panel_setcolumn: Gryfn4P/Gryfn2P/unknown) - Writes a per-run QC report (
QC_data/QC_spectra_report.json) and per-target spectra figure (QC_data/QC_plots/) - Skips up-to-date outputs (mtime caching); prints a REPORTED/SKIPPED summary table
| Argument | Description |
|---|---|
--path |
Path to search for QC panel files (default: git root) |
-f, --force
|
Force overwrite of existing output files |
--type |
Output format: parquet (default) or csv
|
-s, --skipplot
|
Skip per-run figure generation |
--skip-processing |
Never process rasters; only load existing outputs for reporting |
--exclude-dir |
Directory names to exclude from the panel search |
--no-radiance-check |
Disable the reflectance vs radiance range check |
--keep-xy |
Retain per-pixel x/y coordinate columns |
--allow-multi-gpro |
Process runs with multiple .gpro folders (debugging only) |
-v, --verbose
|
Detailed output |
# Standard run (extraction + report + figure per run)
python Code/DS02_DatasetQA/QA00_SpectralValidation.py --path /path/to/data
# Extraction only, skip figures
python Code/DS02_DatasetQA/QA00_SpectralValidation.py --path /path/to/data -sFile: Code/DS02_DatasetQA/QA02_SpectralRunComparison.py
Full documentation: Code/DS02_DatasetQA/README.md
Author: Arden Burrell
Version: v1.1 (13.08.2026)
Gathers the extracted spectra tables produced by QA00 across every run under a path and produces cross-run comparison figures (per-panel reflectance and residual spectra, one line per run). Never opens raster files. Residuals are each run's deviation from the cross-run mean spectrum at each snapped wavelength.
| Argument | Description |
|---|---|
--path |
Node or project folder to crawl (default: git root) |
--output-dir |
Explicit figure directory (required for other path levels) |
--no-save |
Display figures instead of saving |
--type |
Table format: parquet (default) or csv
|
--load-dir |
Also load spectra tables from this folder (other nodes) |
--save-dir |
Save copies of every gathered table for sharing |
--start-date / --end-date
|
Inclusive date window limiting which runs are compared |
--errorbar |
Spread band per run line: pi (default), sd, none
|
--exclude-dir |
Directory names to exclude from the table search |
-v, --verbose
|
Detailed output |
# Compare every run under a node (figures -> <Node>/Documents/QCReports/)
python Code/DS02_DatasetQA/QA02_SpectralRunComparison.py --path /path/to/Node
# Share with other nodes / combine external data
python Code/DS02_DatasetQA/QA02_SpectralRunComparison.py --path /path/to/Node --save-dir /shared/spectra
python Code/DS02_DatasetQA/QA02_SpectralRunComparison.py --path /path/to/Node --load-dir /shared/spectra
# Only compare runs after 1 June 2026
python Code/DS02_DatasetQA/QA02_SpectralRunComparison.py --path /path/to/Node --start-date 2026-06-01numpy, pandas, xarray, rioxarray, rasterio, geopandas, shapely, matplotlib, seaborn, tqdm, GitPython, palettable (+ colorcet for >20 runs, pyarrow for parquet)
See the DS02_DatasetQA README for tested package versions and conda environment setup.
File: Code/DS03_PlotExtractionCode/PE00_LIDAR_extraction.py
Full documentation: Code/DS03_PlotExtractionCode/README.md
Authors: Arden Burrell & Richard Harwood
Version: v1.0 (09.03.2026)
Extracts plot-level data from LIDAR point clouds (GOBI and CALVIS sensors) by clipping to plot shapefiles and attaching DSM/DTM elevations. The summary below covers the essentials — see the linked README for full folder-structure assumptions, output schemas, troubleshooting, and future enhancements.
- Discovers
FieldLog.csvfiles (or crawls the hierarchy) to build a table of GOBI/CALVIS acquisitions - Loads and validates plot-layout shapefiles under
Documentation/Plot_Layout/ - Locates matching
*LiDAR_CombinedPointCloud.las,*LiDAR_DSM_*.tif,*LiDAR_DTM_*.tiffiles - Spatial-joins the point cloud to plot polygons and extracts DSM/DTM values per point
- Computes canopy height (
Delta_z = z - DTM) - Writes CSV/Parquet tables plus a YAML metadata sidecar (runtime, system, git state)
- Optionally saves identifiable copies to a shared
--save-dir
| Argument | Description |
|---|---|
--path |
Root path to search (default: git root) |
--path-level |
Level that --path refers to: root, node, project, site, sensor, date, run (default: site) |
-f, --force
|
Force overwrite of existing output files |
--savetype |
Output format: csv or parquet (default: parquet) |
--save-dir |
Save identifiable copies of extracted data for sharing |
--load-dir |
Load previously extracted data from another node |
-v, --verbose
|
Detailed output |
# Standard run
python PE00_LIDAR_extraction.py
# Process a single site
python PE00_LIDAR_extraction.py --path /data/node/project/2026SiteA --path-level site
# Save shared copies for other nodes
python PE00_LIDAR_extraction.py --save-dir /shared/lidarnumpy, pandas, xarray, rioxarray, laspy, geopandas, shapely, pyyaml, tqdm, GitPython
File: Code/OT00_OneTimeScripts/OT00_RenameTiertoT.py
A one-time migration script that renames folders starting with Tier to start with T (e.g. Tier0_raw → T0_raw).
# Use git root as search path
python OT00_RenameTiertoT.py
# Specify a custom path
python OT00_RenameTiertoT.py --path /path/to/dataThe script searches recursively, lists all matching folders, asks for confirmation, then performs the rename.
File: Code/OT00_OneTimeScripts/OT01_MoveGrawToRaw.py
A one-time migration script that relocates *.graw folders from T1_proc into the adjacent T0_raw folder for GOBI and CALVIS sensors only.
- Walks the search root looking for directories named
T1_proc - Keeps only those whose ancestry includes a folder whose name contains
GOBIorCALVIS(case-insensitive) - Collects the direct child folders of
T1_procending in.graw - Lists every proposed move and asks for confirmation
- Moves each
.grawfolder into the siblingT0_raw/(created if missing), refusing to overwrite existing targets
.../<sensor>/<date>/run_XX/T1_proc/<name>.graw
->
.../<sensor>/<date>/run_XX/T0_raw/<name>.graw
| Argument | Description |
|---|---|
--path |
Optional root directory to search. When supplied, the git repository check is skipped. |
--dry-run |
List candidate moves without performing them. |
# Use git root as search path
python OT01_MoveGrawToRaw.py
# Preview moves only
python OT01_MoveGrawToRaw.py --dry-run
# Specify a custom path
python OT01_MoveGrawToRaw.py --path /path/to/datatqdm (and git on PATH when --path is not provided).
Repository · Issues · MIT License · See Contributing-to-the-Wiki to edit these pages.
Start here
APPN Folder Structure
Guides
Reference
Project