TransWikia.com

ExtractByMask ignoring my set workspace, saving to Default.gdb instead

Geographic Information Systems Asked by AKC on March 6, 2021

I am calculating NDVI and then want to mask it with a vector file. I set my workspace a gdb and the NDVI raster calculator function saves to my gdb but the extract by mask saves to the Default.gdb.

Note: file path names changed for question posting

import arcpy
from arcpy.sa import *
arcpy.env.workspace = "C:Usersexampleexampleexampleexampleexampleexampleexample.gdb" 
arcpy.env.overwriteOutput = True

#Local Variables
Band4 = "Band4"
Band5 = "Band5"
NDVI_raw = "NDVI_raw"
NDVI = "NDVI" #Masked NDVI
Neighbourhoods = "Neighbourhoods"

#Calculate NDVI
arcpy.gp.RasterCalculator_sa("(Float("Band5") - Float("Band4")) / (Float("Band5") + Float("Band4"))", NDVI_raw)

#Mask out NDVI
ExtractByMask_NDVI = ExtractByMask(NDVI_raw, Neighbourhoods)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP