forked from greenvisionfarm/precision-ag-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_zoning.py
More file actions
19 lines (14 loc) · 1.7 KB
/
test_zoning.py
File metadata and controls
19 lines (14 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
import sys
# Добавляем путь к src
sys.path.append(os.path.join(os.getcwd(), 'src'))
from services.raster_service import process_ndvi_zones
tif_path = "test_files/NDVI.tif"
# Геометрия поля Prihore
field_wkt = "POLYGON ((18.728419683 48.202573458, 18.728295637 48.202608633, 18.728157596 48.202738883, 18.727922299 48.203050378, 18.727810157 48.203269124, 18.727787839 48.203682203, 18.727788983 48.203747904, 18.727963096 48.204104827, 18.72811183 48.204376214, 18.728185254 48.204592532, 18.728205659 48.204806965, 18.728172421 48.204992464, 18.728071514 48.205332654, 18.72787784 48.20586533, 18.727853319 48.206099248, 18.727835356 48.206196768, 18.727837726 48.206502104, 18.727825162 48.206581536, 18.727759302 48.206691881, 18.72757988 48.206848829, 18.727412839 48.206953669, 18.727219675 48.207094546, 18.727065439 48.20722025, 18.726700367 48.207619178, 18.726636021 48.207737879, 18.732415025 48.205036561, 18.731944253 48.204670261, 18.731713157 48.204530207, 18.731122554 48.204234552, 18.730840223 48.204051184, 18.730254886 48.203652955, 18.729800491 48.203329501, 18.729548227 48.203187479, 18.72930443 48.20306226, 18.729095266 48.202969287, 18.728935307 48.2029327, 18.728807535 48.202860421, 18.72872314 48.202776427, 18.728620513 48.202655323, 18.728569966 48.202625137, 18.728513022 48.20260062, 18.728419683 48.202573458))"
print("Запуск обработки зон для NDVI.tif...")
zones = process_ndvi_zones(tif_path, field_wkt)
print(f"Обработка завершена. Создано зон: {len(zones)}")
for z in zones:
print(f"- {z['name']}: Avg NDVI = {z['avg_ndvi']}, Color = {z['color']}")
print(f" Geometry: {z['geometry_wkt'][:100]}...")