Skip to main content
deleted 64 characters in body
Source Link
Allie
  • 33
  • 5

Thanks for the help! I have it out, here are two separate scripts I created. One reclass was done to change all values to 1, then the rasters were aggregated in model builder (where processing extent, snap raster, and raster mask were specified) then I ran the second reclass script. It turned out nicely where rasters were set to binary: 1's and 0's.

Reclass1:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/AlexandraOrrego/GIS_2017/Shapefiles/BD_projected"
outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass1.gdb"
outputsuffix = "r1"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapValue([[11002,1],[11004,1],[11005,1],[11006,1],[11007,1],[11009,1],[11015,1],[11013,1],[11014,1],[11016,1],[11019,1],[11029,1],[11030,1],[11036,1],[11043,1],[11044,1],[11046,1],[11048,1],[11049,1],[11050,1],[12039,1],[12040,1],[12042,1],[12123,1],[80002,1],[80003,1],[80004,1]])  

outReclassify = Reclassify(inRaster, "Value", remap, "NODATA")  
outRasterName = '{}{}'.format(inRaster, outputsuffix)

outReclassify.save(os.path.join(outputDir, outRasterName))

print outRasterName + " Reclassified Successfully!"

Then rasters were aggregated

Reclass2:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/AlexandraOrrego/GIS_2017/RasterData/Aggregated.gdb"


outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass2.gdb"
outputsuffix = "r2"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapRange([[1, 29, 0],[29, 289, 1],["NODATA", "NODATA", 0]])
    outReclassify = Reclassify(inRaster, "Value", remap, 0)


    outRasterName = '{}{}'.format(inRaster, outputsuffix)

    outReclassify.save(os.path.join(outputDir, outRasterName))


    print outRasterName + " Reclassified Successfully!"

Thanks for the help! I have it out, here are two separate scripts I created. One reclass was done to change all values to 1, then the rasters were aggregated in model builder (where processing extent, snap raster, and raster mask were specified) then I ran the second reclass script. It turned out nicely where rasters were set to binary: 1's and 0's.

Reclass1:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/AlexandraOrrego/GIS_2017/Shapefiles/BD_projected"
outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass1.gdb"
outputsuffix = "r1"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapValue([[11002,1],[11004,1],[11005,1],[11006,1],[11007,1],[11009,1],[11015,1],[11013,1],[11014,1],[11016,1],[11019,1],[11029,1],[11030,1],[11036,1],[11043,1],[11044,1],[11046,1],[11048,1],[11049,1],[11050,1],[12039,1],[12040,1],[12042,1],[12123,1],[80002,1],[80003,1],[80004,1]])  

outReclassify = Reclassify(inRaster, "Value", remap, "NODATA")  
outRasterName = '{}{}'.format(inRaster, outputsuffix)

outReclassify.save(os.path.join(outputDir, outRasterName))

print outRasterName + " Reclassified Successfully!"

Then rasters were aggregated

Reclass2:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/AlexandraOrrego/GIS_2017/RasterData/Aggregated.gdb"


outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass2.gdb"
outputsuffix = "r2"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapRange([[1, 29, 0],[29, 289, 1],["NODATA", "NODATA", 0]])
    outReclassify = Reclassify(inRaster, "Value", remap, 0)


    outRasterName = '{}{}'.format(inRaster, outputsuffix)

    outReclassify.save(os.path.join(outputDir, outRasterName))


    print outRasterName + " Reclassified Successfully!"

Thanks for the help! I have it out, here are two separate scripts I created. One reclass was done to change all values to 1, then the rasters were aggregated in model builder (where processing extent, snap raster, and raster mask were specified) then I ran the second reclass script. It turned out nicely where rasters were set to binary: 1's and 0's.

Reclass1:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/GIS_2017/Shapefiles/BD_projected"
outputDir = "E:/GIS_2017/RasterData/Reclass1.gdb"
outputsuffix = "r1"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapValue([[11002,1],[11004,1],[11005,1],[11006,1],[11007,1],[11009,1],[11015,1],[11013,1],[11014,1],[11016,1],[11019,1],[11029,1],[11030,1],[11036,1],[11043,1],[11044,1],[11046,1],[11048,1],[11049,1],[11050,1],[12039,1],[12040,1],[12042,1],[12123,1],[80002,1],[80003,1],[80004,1]])  

outReclassify = Reclassify(inRaster, "Value", remap, "NODATA")  
outRasterName = '{}{}'.format(inRaster, outputsuffix)

outReclassify.save(os.path.join(outputDir, outRasterName))

print outRasterName + " Reclassified Successfully!"

Then rasters were aggregated

Reclass2:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/GIS_2017/RasterData/Aggregated.gdb"


outputDir = "E:/GIS_2017/RasterData/Reclass2.gdb"
outputsuffix = "r2"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapRange([[1, 29, 0],[29, 289, 1],["NODATA", "NODATA", 0]])
    outReclassify = Reclassify(inRaster, "Value", remap, 0)


    outRasterName = '{}{}'.format(inRaster, outputsuffix)

    outReclassify.save(os.path.join(outputDir, outRasterName))


    print outRasterName + " Reclassified Successfully!"
Source Link
Allie
  • 33
  • 5

Thanks for the help! I have it out, here are two separate scripts I created. One reclass was done to change all values to 1, then the rasters were aggregated in model builder (where processing extent, snap raster, and raster mask were specified) then I ran the second reclass script. It turned out nicely where rasters were set to binary: 1's and 0's.

Reclass1:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/AlexandraOrrego/GIS_2017/Shapefiles/BD_projected"
outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass1.gdb"
outputsuffix = "r1"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapValue([[11002,1],[11004,1],[11005,1],[11006,1],[11007,1],[11009,1],[11015,1],[11013,1],[11014,1],[11016,1],[11019,1],[11029,1],[11030,1],[11036,1],[11043,1],[11044,1],[11046,1],[11048,1],[11049,1],[11050,1],[12039,1],[12040,1],[12042,1],[12123,1],[80002,1],[80003,1],[80004,1]])  

outReclassify = Reclassify(inRaster, "Value", remap, "NODATA")  
outRasterName = '{}{}'.format(inRaster, outputsuffix)

outReclassify.save(os.path.join(outputDir, outRasterName))

print outRasterName + " Reclassified Successfully!"

Then rasters were aggregated

Reclass2:

import arcpy
import os
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

env.workspace = "E:/AlexandraOrrego/GIS_2017/RasterData/Aggregated.gdb"


outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass2.gdb"
outputsuffix = "r2"

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapRange([[1, 29, 0],[29, 289, 1],["NODATA", "NODATA", 0]])
    outReclassify = Reclassify(inRaster, "Value", remap, 0)


    outRasterName = '{}{}'.format(inRaster, outputsuffix)

    outReclassify.save(os.path.join(outputDir, outRasterName))


    print outRasterName + " Reclassified Successfully!"