dimanche 1 février 2015

Specify the NoData pixel from 255 to a lower value pixel value


I have a series of raster files (tif) that extracted using a particular shapefile.

However, the output files became much larger (from 2 MB to 200MB). The NoData is now equivalent to pixel value of 255 instead of 0 (maybe this is the reason). Is there a way to specify it through this code?



import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
env.overwriteOutput = True

#Set the current workspace
env.workspace = ("C:\Users\Brent\Documents\JO_GIS_Analyst and PA")

#This is for extracting the forest areas of hansen percent treecover
for raster in arcpy.ListRasters("lossyear*", "TIF"):
print raster #checking the presence of raster
outputRasterExtractbyMask = ExtractByMask(raster, "NAMRIA.shp")
outputRasterExtractbyMask_Name = "forest_only"+raster
outputRasterExtractbyMask.save(outputRasterExtractbyMask_Name)


Thank you!





Aucun commentaire:

Enregistrer un commentaire