SmartCane/old_sh/smartcane.sh
Timon 458b8247be Cleanup: Fix CI formula, reorganize shell scripts and test files
- Fixed CI calculation: changed from NDVI (NIR-Red)/(NIR+Red) to correct NIR/Green-1 formula in:
  * process_single_tile() function
  * create_ci_band() utility function
  * Updated create_mask_and_crop() documentation

- Renamed numbered shell scripts for clarity (matching R script numbering):
  * 01_run_planet_download -> 10_planet_download.sh
  * 02_run_ci_extraction -> 20_ci_extraction.sh
  * 03_run_growth_model -> 30_growth_model.sh
  * 04_run_mosaic_creation -> 40_mosaic_creation.sh
  * 09_run_calculate_kpis -> 80_calculate_kpis.sh
  * 10_run_kpi_report -> 90_kpi_report.sh

- Archived obsolete shell scripts to old_sh/:
  * build_mosaic.sh, build_report.sh, interpolate_growth_model.sh
  * 05_run_dashboard_report.sh, 06_run_crop_messaging.sh
  * 11_run_yield_prediction.sh/ps1
  * runcane.sh, runpython.sh, smartcane.sh, update_RDS.sh

- Deleted test/debug files and temporary outputs:
  * analyze_*.R, benchmark_gpu_vs_cpu.py, convert_angata_harvest.py
  * debug_mosaic.R, examine_kpi_results.R, generate_sar_report.R
  * inspect_8band_structure.R, inspect_tif_bands.R
  * old_working_utils.R, predict_harvest_operational.R
  * run_kpi_calculation.R, run_report.R, simple_sar_test.R
  * data_validation_tool/, harvest_ci_pattern_analysis.png, kpi_debug.out

- Enhanced harvest prediction: Added threshold tuning (0.40-0.45) and field type handling

- Enhanced mosaic creation: Improved tile detection and routing logic
2026-01-14 16:58:51 +01:00

60 lines
2 KiB
Bash
Executable file

#!/bin/bash
# Definieer de directories die aangemaakt moeten worden
declare -a dirs=(
"./laravel_app/storage/app/extracted_ci/cumulative_vals"
"./laravel_app/storage/app/chemba/merged_tif"
"./laravel_app/storage/app/chemba/merged_virtual"
"./laravel_app/storage/app/chemba/single_images"
)
#
## Loop door de directories en maak ze aan als ze nog niet bestaan,
## of maak ze leeg als ze al bestaan
for dir in "${dirs[@]}"; do
if [ ! file -d "$dir" ]; then
mkdir -p "$dir"
chmod -R 775 "$dir"
echo "Directory $dir is aangemaakt en bijgewerkt."
else
# Verwijder alle inhoud binnen de bestaande directory
# find "$dir" -mindepth 1 -delete
#echo "Inhoud van directory $dir is verwijderd."
echo "Directory $dir bestaat al."
fi
done
## Runnen van Jupyter Notebook
# Directory waar de virtuele omgeving zal worden aangemaakt
VENV_DIR="./python_app/myenv"
# Controleer of de virtuele omgeving al bestaat
if [ ! -d "$VENV_DIR" ]; then
echo "Virtuele omgeving bestaat niet. Aan het aanmaken..."
python3.9 -m venv "$VENV_DIR"
else
echo "Virtuele omgeving bestaat al."
fi
# Activeer de virtuele omgeving
source "$VENV_DIR/bin/activate"
# Installeer of update de benodigde pakketten
OS=$(uname | tr '[:upper:]' '[:lower:]') # Dit zet de uitvoer om naar lowercase
REQUIREMENTS_PATH="python_app/requirements_${OS}.txt"
if [[ ! -f $REQUIREMENTS_PATH ]]; then
echo "Requirements bestand niet gevonden voor besturingssysteem: $OS"
exit 1
fi
pip install --upgrade -r $REQUIREMENTS_PATH
# Hier kan je verdere stappen toevoegen, zoals het uitvoeren van je Python-script of Jupyter Notebook
# Deactiveer de virtuele omgeving (optioneel)
deactivate
## Runnen van R scripts
# Kopieer de excel file met harvesting data en maak directory aan indien nodig
mkdir -p laravel_app/storage/app/harvesting_data
cp "Current - Pivots planting date and harevsting data.xlsx" "laravel_app/storage/app/harvesting_data/"
cp "pivot_20210625.geojson" "laravel_app/storage/app/Data"