ArcGIS / Python / Práce s rastrovými daty: Porovnání verzí

Z GeoWikiCZ
mBez shrnutí editace
Řádek 5: Řádek 5:


Výpočet normalizovaného diferenčního vegetačního indexu (NDVI) - viz [[153ZODH / 4. cvičení#NDVI|cvičení předmětu ZODH]].
Výpočet normalizovaného diferenčního vegetačního indexu (NDVI) - viz [[153ZODH / 4. cvičení#NDVI|cvičení předmětu ZODH]].
<source lang=python>
import arcpy
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "c:/Users/landa/arcpy"
### tm3_name = "tm3.tif"
### tm4_name = "tm4.tif"
tm3_name = arcpy.GetParameterAsText(0)
tm4_name = arcpy.GetParameterAsText(1)
# nacteni vstupnich dat
tm3 = Raster(tm3_name)
tm4 = Raster(tm4_name)
# vypocet NDVI
ndvi = 1.0 * (tm4 - tm3) / (tm4 + tm3)
# ulozeni vysledku do souboru TIFF
ndvi.save("ndvi.tif")
</source>


== Odkazy ==
== Odkazy ==


* http://blog.remotesensing.io/2013/05/using-arcpy-for-raster-analysis/
* http://blog.remotesensing.io/2013/05/using-arcpy-for-raster-analysis/

Verze z 19. 12. 2013, 15:46

Výpočet normalizovaného diferenčního vegetačního indexu

Výpočet normalizovaného diferenčního vegetačního indexu (NDVI) - viz cvičení předmětu ZODH.

import arcpy
from arcpy.sa import *

arcpy.CheckOutExtension("Spatial")

arcpy.env.overwriteOutput = True
arcpy.env.workspace = "c:/Users/landa/arcpy" 

### tm3_name = "tm3.tif"
### tm4_name = "tm4.tif"
tm3_name = arcpy.GetParameterAsText(0)
tm4_name = arcpy.GetParameterAsText(1)

# nacteni vstupnich dat
tm3 = Raster(tm3_name)
tm4 = Raster(tm4_name)

# vypocet NDVI
ndvi = 1.0 * (tm4 - tm3) / (tm4 + tm3)

# ulozeni vysledku do souboru TIFF
ndvi.save("ndvi.tif")

Odkazy