def combineRasters(graphic_type, yxc, cdl_type): print 'combineRasters..................................................' states = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\ancillary\\raster\\misc.gdb\\states' yxc_file = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\sa\\r2\\s35\\s35.gdb\\s35_{}'.format(yxc) cdl_specific_file = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\sa\\r2\\s35\\s35.gdb\\s35_{}'.format(cdl_type) if graphic_type == 'sm': # output= 'D:\\projects\\usxp\\deliverables\\s35\\sm_specifics.gdb\\sm_state_yfc_bfnc' output= 'D:\\projects\\usxp\\deliverables\\s35\\conus.gdb\\s35_{}_sm'.format(cdl_type) print 'small multiples-----------------------------------' # ###Execute Combine outCombine = Combine([states, yxc_file, cdl_specific_file]) ###Save the output outCombine.save(output) ###create pyraminds gen.buildPyramids(output) elif graphic_type == 'conus': output= 'D:\\projects\\usxp\\deliverables\\s35\\conus.gdb\\s35_{}_conus'.format(cdl_type) print 'conus---------------------------------------------' # ###Execute Combine outCombine = Combine([yxc_file, cdl_specific_file]) ###Save the output outCombine.save(output) ###create pyraminds gen.buildPyramids(output)
def createRefinedTrajectory(data): ##### create a file list of all the masked datasets filelist = [ data['pre']['traj_yfc']['path'], data['refine']['mask_fp_2007']['path'], data['refine']['mask_fp_nlcd_yfc']['path'], data['refine']['mask_fp_nlcd_ytc']['path'], data['refine']['mask_fp_yfc']['path'], data['refine']['mask_fp_ytc']['path'] ] print 'filelist:', filelist ##### mosaicRasters(): arcpy.MosaicToNewRaster_management( filelist, data['pre']['traj_rfnd']['gdb'], data['pre']['traj_rfnd']['filename'], Raster(data['pre']['traj']['path']).spatialReference, '16_BIT_UNSIGNED', data['global']['res'], "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management( data['pre']['traj_rfnd']['path'], "Overwrite") # Overwrite pyramids gen.buildPyramids(data['pre']['traj_rfnd']['path'])
def mosiacRasters(covertype): ######Description: mosiac tiles together into a new raster tilelist = glob.glob("C:/Users/Bougie/Desktop/Gibbs/data/tiles/*.tif") print 'tilelist:', tilelist #### need to wrap these paths with Raster() fct or complains about the paths being a string inTraj=Raster("C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\pre\\traj\\v4\\v4_traj.gdb\\v4_traj_cdl30_b_2008to2017") gdb='D:\\projects\\intact_land\\abandoned.gdb' def getFileName(covertype): if covertype=='noncrop': return "abandoned_nd" elif covertype=='crop': return "crop_nd" filename = getFileName(covertype) print 'filename:-----------------------------', filename ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(tilelist, gdb, filename, inTraj.spatialReference, "16_BIT_UNSIGNED", 30, "1", "LAST","FIRST") #######Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management(gdb+'\\'+filename, "Overwrite") ########Overwrite pyramids gen.buildPyramids(gdb+'\\'+filename)
def mosiacRasters(): ######Description: mosiac tiles together into a new raster tilelist = glob.glob( "D:/projects/usxp/deliverables/maps/suitability/tiles/*.tif") print 'tilelist:', tilelist #### need to wrap these paths with Raster() fct or complains about the paths being a string inTraj = Raster( 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\ancillary\\raster\\cdl.gdb\\cdl30_2017' ) filename = 'gssurgo_nicc_30m' print 'filename:', filename gdb = 'D:\\projects\\usxp\\deliverables\\maps\\suitability\\suitability.gdb' ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(tilelist, gdb, filename, inTraj.spatialReference, "16_BIT_UNSIGNED", 30, "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management( '{0}\\{1}'.format(gdb, filename), "Overwrite") # Overwrite pyramids gen.buildPyramids('{0}\\{1}'.format(gdb, filename))
def createSpecificLUCMask(): # Description: reclass cdl rasters based on the specific arc_reclassify_table # self.series = series # self.name = name # self.subname = subname # self.res = str(res) # self.mmu = str(mmu) # self.years = years # Set environment settings arcpy.env.workspace = defineGDBpath(['post', post.name]) cond = post.series + '_' + post.name + post.res + '_' + post.datarange + '_mmu' + post.mmu + '_nbl_' + post.subname print 'cond:', cond # print cond # #loop through each of the cdl rasters for raster in arcpy.ListDatasets(cond, "Raster"): print 'raster: ', raster outraster = raster + '_msk' print 'outraster: ', outraster myRemapVal = RemapValue(getReclassifyValuesString()) outReclassRV = Reclassify(raster, "VALUE", myRemapVal, "") # Save the output outReclassRV.save(outraster) #create pyraminds gen.buildPyramids(outraster)
def mosiacRasters(data, yxc, subtype): ######Description: mosiac tiles together into a new raster tilelist = glob.glob("C:/Users/Bougie/Desktop/Gibbs/data/tiles/*.tif") print 'tilelist:', tilelist # tilelist_complete=['C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\sa\\r2\\s35\\post\\yfc_s35.gdb\\s35_yfc30_2008to2017_mmu5_fnc_61'] + tilelist # print tilelist_complete #### need to wrap these paths with Raster() fct or complains about the paths being a string inTraj = Raster(data['pre']['traj']['path']) mask_61_filename = 'fnc_61_mask' mask_61_path = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\sa\\r2\\s35\\post\\yfc_s35.gdb' + '\\' + mask_61_filename # path_yfc_fnc_61 = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\sa\\r2\\s35\\post\\yfc_s35.gdb\\s35_yfc30_2008to2017_mmu5_fnc_61' ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(tilelist, data['post'][yxc]['gdb'], mask_61_filename, inTraj.spatialReference, "16_BIT_UNSIGNED", 30, "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management(mask_61_path, "Overwrite") # Overwrite pyramids gen.buildPyramids(mask_61_path)
def mosiacRasters(schema): ######Description: mosiac tiles together into a new raster tilelist = glob.glob( "D:/projects/usxp/series/s35/maps/{}/tiles/*.tif".format(schema)) print 'tilelist:', tilelist #### need to wrap these paths with Raster() fct or complains about the paths being a string inTraj = Raster( 'E:\\data\\gSSURGO\\gSSURGO_CONUS_10m.gdb\\MapunitRaster_30m') filename = 'gssurgo_{}_30m'.format(schema) print 'filename:', filename gdb = 'D:\\projects\\usxp\\series\\s35\\maps\\{0}\\{0}.gdb'.format(schema) ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(tilelist, gdb, filename, inTraj.spatialReference, "16_BIT_UNSIGNED", 30, "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management( '{0}\\{1}'.format(gdb, filename), "Overwrite") # Overwrite pyramids gen.buildPyramids('{0}\\{1}'.format(gdb, filename))
def mosiacRasters(data, subtype, year): ######Description: mosiac tiles together into a new raster tilelist = glob.glob("C:/Users/Bougie/Desktop/Gibbs/tiles/*.tif") print 'tilelist:', tilelist #### need to wrap these paths with Raster() fct or complains about the paths being a string inTraj = Raster(data['pre']['traj']['path']) gdb = data['post']['ytc']['gdb'] filename = '{}_{}'.format(data['post']['ytc'][subtype]['filename'], year) print 'filename:', filename ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(tilelist, gdb, filename, inTraj.spatialReference, "16_BIT_UNSIGNED", 30, "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management('{}//{}'.format(gdb, filename), "Overwrite") # Overwrite pyramids gen.buildPyramids('{}//{}'.format(gdb, filename))
def createChangeTrajectories(): print "-----------------createChangeTrajectories() function-------------------------------" # Description: "Combines multiple rasters so that a unique output value is assigned to each unique combination of input values" -arcGIS def #the rasters where combined in chronoloigal order with the recalssifed nlcd raster being in the inital spot. # Set environment settings arcpy.env.workspace = defineGDBpath(['refine','v2',refine.name]) def getRasterList(): orderedlist = [] for subtype in refine.subtypelist: orderedlist.append(refine.name+refine.res+'_'+refine.datarange+'_'+subtype) print orderedlist return orderedlist output = defineGDBpath(['refine','v2','trajectories'])+'traj_'+refine.name+refine.res+'_'+refine.datarange print 'output----', output # ##Execute Combine outCombine = Combine(getRasterList()) ###Save the output outCombine.save(output) ###create pyraminds gen.buildPyramids(output)
def createMask_nlcd(): nlcd2001 = Raster(defineGDBpath(['ancillary','raster','nlcd'])+'nlcd'+refine.res+'_2001') nlcd2006 = Raster(defineGDBpath(['ancillary','raster','nlcd'])+'nlcd'+refine.res+'_2006') nlcd2011 = Raster(defineGDBpath(['ancillary','raster','nlcd'])+'nlcd'+refine.res+'_2011') refinement_mtr = Raster(defineGDBpath(['refine','v2','mtr'])+'traj_cdl'+refine.res+'_b_'+refine.datarange+'_mtr') print 'refinement_mtr:', refinement_mtr if refine.join_operator == 'or': if refine.nlcd_count == 2: output = defineGDBpath(['refine','v2','masks'])+refine.traj_dataset+'_nlcd'+refine.nlcd_ven print 'output:', output outCon = Con((nlcd2006 == 82) & (refinement_mtr == 3) & (refine.yxc_dataset <= 2011), getArbitraryCropValue(), Con((nlcd2006 == 82) & (refinement_mtr == 3) & (refine.yxc_dataset > 2011), getArbitraryCropValue())) print outCon if refine.nlcd_count == 3: output = defineGDBpath(['refine','v2','masks'])+refine.traj_dataset+'_nlcd'+refine.nlcd_ven print output outCon = Con((nlcd2001 == 82) & (refinement_mtr == 3) & (refine.yxc_dataset < 2012), getArbitraryCropValue(), Con((nlcd2006 == 82) & (refinement_mtr == 3), getArbitraryCropValue() , Con((nlcd2006 == 82) & (refinement_mtr == 3) & (refine.yxc_dataset > 2011), getArbitraryCropValue()))) print outCon elif refine.join_operator == 'and': output = defineGDBpath(['refine','v2','masks'])+'traj_nlcd'+refine.res+'_b_'+refine.nlcd_years[0]+'and'+refine.nlcd_years[1]+'_'+refine.name+refine.datarange+'_mask' print 'output:', output outCon = Con(((nlcd2001 == 82) & (nlcd2 == 82) & (refinement_mtr == 3)), getArbitraryCropValue()) elif refine.join_operator == 'none': output = defineGDBpath(['refine','v2','masks'])+refine.traj_dataset+'_nlcd2011' print 'output:', output outCon = Con(((nlcd2011 == 82) & (refinement_mtr == 3)), getArbitraryCropValue()) outCon.save(output) gen.buildPyramids(output)
def mosiacRasters(): arcpy.env.workspace = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\data\\usxp\\ancillary\\raster\\cdl.gdb\\' cdl_raster = Raster("cdl30_2015") elevSTDResult = arcpy.GetRasterProperties_management(cdl_raster, "TOP") YMax = elevSTDResult.getOutput(0) elevSTDResult = arcpy.GetRasterProperties_management(cdl_raster, "BOTTOM") YMin = elevSTDResult.getOutput(0) elevSTDResult = arcpy.GetRasterProperties_management(cdl_raster, "LEFT") XMin = elevSTDResult.getOutput(0) elevSTDResult = arcpy.GetRasterProperties_management(cdl_raster, "RIGHT") XMax = elevSTDResult.getOutput(0) arcpy.env.extent = arcpy.Extent(XMin, YMin, XMax, YMax) rasterlist = [ 'resampled_cdl30_2007_p1', 'D:\\projects\\ksu\\v2\\attributes\\rasters\\cdl30_2007.img' ] ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(rasterlist, data['refine']['gdb'], data['refine']['mask_2007']['filename'], cdl_raster.spatialReference, "16_BIT_UNSIGNED", 30, "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management( data['refine']['mask_2007']['path'], "Overwrite") # Overwrite pyramids gen.buildPyramids(data['refine']['mask_2007']['path'])
def majorityFilter(): filter_combos = { 'n4h': ["FOUR", "HALF"], 'n4m': ["FOUR", "MAJORITY"], 'n8h': ["EIGHT", "HALF"], 'n8m': ["EIGHT", "MAJORITY"] } print 'filter_combo----', filter_combos[core.filter_key] parent_raster = core.traj_path print 'parent raster', parent_raster output = defineGDBpath( core.filter_gdb) + core.filter_parentnode + '_' + core.filter_key print 'output: ', output ## check if dataset already exists if arcpy.Exists(output): print 'dataset already exists' return else: print 'creating new filter dataset...............................' #Execute MajorityFilter outMajFilt = MajorityFilter(core.traj_path, filter_combos[core.filter_key][0], filter_combos[core.filter_key][1]) #save processed raster to new file outMajFilt.save(output) gen.buildPyramids(output)
def regionGroup(gdb_args_in, wc, region_combos): #define workspace arcpy.env.workspace=defineGDBpath(gdb_args_in) for k, v in region_combos.iteritems(): print k,v for raster in arcpy.ListDatasets(wc, "Raster"): print 'raster: ', raster raster_out=raster+'_'+k print 'raster_out', raster_out if arcpy.Exists(raster_out): print "{} exists, not copying".format(raster) else: output=defineGDBpath(['sensitivity_analysis','mmu'])+raster_out print 'output: ',output # Execute RegionGroup outRegionGrp = RegionGroup(raster, v[0], v[1],"NO_LINK") # Save the output print 'save the output' outRegionGrp.save(output) gen.buildPyramids(output)
def createRefinedTrajectory(data): # mask_fp_2007.run(data) # mask_fp_yfc_potential.run(data) # mask_fp_nlcd_yfc.run(data) # mask_fp_nlcd_ytc.run(data) # mask_fp_yfc.run(data) # mask_fp_ytc.run(data) ##### loop through each of the cdl rasters and make sure nlcd is last # filelist = [data['pre']['traj']['path'], data['refine']['masks_yfc']['path'], data['refine']['masks_ytc']['path'], data['refine']['mask_2007']['path'], data['refine']['mask_nlcd']['path']] # filelist = [data['pre']['traj_yfc']['path'], data['refine']['mask_fp_2007']['path'], data['refine']['mask_fp_yfc_potential']['path'], data['refine']['mask_fp_nlcd_yfc']['path'], data['refine']['mask_fp_nlcd_ytc']['path'], data['refine']['mask_fp_yfc']['path'], data['refine']['mask_fp_ytc']['path']] filelist = [ data['pre']['traj_yfc']['path'], data['refine']['mask_fp_2007']['path'], data['refine']['mask_fp_nlcd_yfc']['path'], data['refine']['mask_fp_nlcd_ytc']['path'], data['refine']['mask_fp_yfc']['path'], data['refine']['mask_fp_ytc']['path'] ] print 'filelist:', filelist ##### mosaicRasters(): arcpy.MosaicToNewRaster_management( filelist, data['pre']['traj_rfnd']['gdb'], data['pre']['traj_rfnd']['filename'], Raster(data['pre']['traj']['path']).spatialReference, '16_BIT_UNSIGNED', data['global']['res'], "1", "LAST", "FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management( data['pre']['traj_rfnd']['path'], "Overwrite") # Overwrite pyramids gen.buildPyramids(data['pre']['traj_rfnd']['path'])
def attachCDL(subtype): # DESCRIPTION:attach the appropriate cdl value to each year binary dataset print "-----------------attachCDL() function-------------------------------" def getAssociatedCDL(subtype, year): #this is an aux function for attachCDL() function to get correct cdl for the attachCDL() function if subtype == 'bfc' or subtype == 'bfnc': # NOTE: subtract 1 from every year in list cdl_file = defineGDBpath([ 'ancillary', 'cdl' ]) + 'cdl' + refine.res + '_' + str(year - 1) return cdl_file elif subtype == 'fc' or subtype == 'fnc': cdl_file = defineGDBpath(['ancillary', 'cdl' ]) + 'cdl' + refine.res + '_' + str(year) return cdl_file # NOTE: Need to copy the yxc_clean dataset and rename it with subtype after it arcpy.env.workspace = defineGDBpath(['refine', refine.name]) inputraster = defineGDBpath(['refine', refine.name]) + refine.yxc_dataset print "inputraster: ", inputraster output = inputraster + '_' + subtype print "output: ", output ##copy binary years raster so it can be modified iteritively arcpy.CopyRaster_management(inputraster, output) #note:checkout out spatial extension AFTER creating a copy or issues arcpy.CheckOutExtension("Spatial") wc = '*' + refine.res + '*' + subtype print wc for year in refine.conversionyears: print 'year: ', year # allow output to be overwritten arcpy.env.overwriteOutput = True print "overwrite on? ", arcpy.env.overwriteOutput #establish the condition cond = "Value = " + str(year) print 'cond: ', cond cdl_file = getAssociatedCDL(subtype, year) print 'associated cdl file: ', cdl_file #set everthing not equal to the unique trajectory value to null label this abitray value equal to conversion year OutRas = Con(output, cdl_file, output, cond) OutRas.save(output) #build pyramids t the end gen.buildPyramids(output)
def reclassRaster(data): print data["refine"]["list_arb_yfc"] outReclass1 = Reclassify(in_raster=data['refine']['mask_fn_yfc_61_preview']['path'], reclass_field="Value", remap=RemapValue(data["refine"]["list_arb_yfc"])) outReclass1.save(data['refine']['mask_fn_yfc_61']['path']) # Overwrite pyramids gen.buildPyramids(data['refine']['mask_fn_yfc_61']['path'])
def clipByMMU(): print "-----------------clipByMMU() function-------------------------------" path_mtr = Raster(defineGDBpath(['s14','core','core'])+post.mtr_dataset) path_yxc_msk = Raster(defineGDBpath(['s14','post',post.name])+post.yxc_mask_dataset) outCon = Con((path_mtr == post.mtr) & (IsNull(path_yxc_msk)), post.mtr, Con((path_mtr == post.mtr) & (path_yxc_msk >= 2008), path_yxc_msk)) output = defineGDBpath(['s14','post',post.name])+post.yxc_mmu_dataset outCon.save(output) gen.buildPyramids(output)
def appyValuesToMTR(schema, inraster, reclassed_raster): arcpy.env.workspace = 'D:\\projects\\usxp\\series\\s35\\maps\\{0}\\{0}.gdb'.format( schema) cond = "Value <> 3" outraster = SetNull('D:\\projects\\usxp\\series\\s35\\s35.gdb\\s35_mtr', inraster, cond) outraster.save(reclassed_raster) gen.buildPyramids(reclassed_raster)
def reclassRaster(data): ###Description: reclass the preview mask to the aggregated trajectory value outReclass1 = Reclassify( in_raster=data['refine']['mask_fp_yfc_preview']['path'], reclass_field="Value", remap=RemapValue([[101, 1], [105, 1], [201, 249], [204, 249], [206, 249]])) outReclass1.save(data['refine']['mask_fp_yfc']['path']) # Overwrite pyramids gen.buildPyramids(data['refine']['mask_fp_yfc']['path'])
def mask(): mtr = Raster( defineGDBpath(['core', 'mmu']) + 'traj_cdl30_b_2008to2016_rfnd_n8h_mtr_8w_msk5_nbl') ytc = Raster(defineGDBpath(['post', 'ytc']) + 'ytc30_2008to2016_mmu5') outCon = Con((mtr == 3) & (IsNull(ytc)), 3, Con((mtr == 3) & (ytc >= 2008), ytc)) output = defineGDBpath(['post', 'ytc']) + 'ytc30_2008to2016_mmu5_msk' outCon.save(output) gen.buildPyramids(output)
def reclassRaster(data): # Reclassify (in_raster, reclass_field, remap, {missing_values}) outReclass1 = Reclassify( in_raster=data['refine']['mask_fp_ytc_preview']['path'], reclass_field="Value", remap=RemapValue([[101, 1], [102, 1], [103, 1], [104, 1], [105, 1], [201, 249], [204, 249]])) outReclass1.save(data['refine']['mask_fp_ytc']['path']) # Overwrite pyramids gen.buildPyramids(data['refine']['mask_fp_ytc']['path'])
def blockStats(schema, tablename, cellsize): arcpy.env.workspace = 'D:\\projects\\usxp\\series\\s35\\maps\\{0}\\{0}.gdb'.format(schema) nbr = NbrRectangle(cellsize, cellsize, "CELL") outBlockStat = BlockStatistics(tablename, nbr, "MEAN", "DATA") # outAggreg = Aggregate(outBlockStat, cellsize, "MAXIMUM", "TRUNCATE", "DATA") # outBlockStat=None output_raster = "{}_bs3km".format(tablename) outBlockStat.save(output_raster) # outAggreg.save(output_raster) gen.buildPyramids(output_raster)
def setRasterNull(schema, newtable): arcpy.env.workspace = 'D:\\projects\\usxp\\series\\s35\\maps\\{0}\\{0}.gdb'.format(schema) filename = 'gssurgo_{}_10m'.format(schema) print 'filename:', filename cond = "Value <> 3" outraster = SetNull('D:\\projects\\usxp\\series\\s35\\s35.gdb\\s35_mtr', filename, cond) outraster.save(newtable) gen.buildPyramids(newtable)
def createMask(): print "-----------------createMask() function-------------------------------" path_mtr = Raster(defineGDBpath(['s14', 'core','core'])+post.mtr_dataset) print 'path_mtr', path_mtr path_yxc = Raster(defineGDBpath(['s14', 'post', post.name])+post.yxc_dataset) print 'path_yxc', path_yxc # outCon = Con((mtr == 3) & (ytc < 2008), 3, Con((mtr == 3) & (ytc >= 2008), ytc)) outCon = Con((path_mtr == post.mtr) & (path_yxc >= 2008), path_yxc) output = defineGDBpath(['s14', 'post', post.name])+post.yxc_mask_dataset outCon.save(output) gen.buildPyramids(output)
def createYearbinaries(): ## replace the arbitrary values in the trajectories dataset with the yxc values. raster = Raster(data['pre']['traj_rfnd']['path']) print 'raster:', raster output = data['post']['ytc']['path'] print 'output: ', output outReclass = Reclassify(raster, "Value", RemapRange(createReclassifyList()), "NODATA") outReclass.save(output) gen.buildPyramids(output)
def mosiacRasters(prg): # root_in = 'C:\\Users\\Bougie\\Desktop\\Gibbs\\tiles\\' # roo tilelist = glob.glob(prg.dir_tiles+"*.tif") print 'mtr tilelist:', tilelist ######mosiac tiles together into a new raster arcpy.MosaicToNewRaster_management(tilelist, prg.gdb_child, prg.raster_child, Raster(prg.path_parent).spatialReference, prg.pixel_type, prg.res, "1", "LAST","FIRST") #Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management(prg.path_child, "Overwrite") # Overwrite pyramids gen.buildPyramids(prg.path_child)
def getIntersectionofRasters(): raster1 = Raster( defineGDBpath(['ancillary', 'data_2008_2012']) + 'Multitemporal_Results_FF2') raster2 = Raster( defineGDBpath(['ancillary', 'temp']) + 'rg_mtr_v1_belowmmu') output = defineGDBpath(['ancillary', 'temp']) + 'rg_mtr_v1_belowmmu_mtr3' outCon = Con(((raster1 == 3) & (raster2 == 1)), 100) outCon.save(output) gen.buildPyramids(output)
def mosiacRasters(): tilelist = glob.glob(nibble.dir_tiles+'*.tif') print tilelist ######mosiac tiles together into a new raster nbl_raster = nibble.mask_name + '_nbl' print 'nbl_raster: ', nbl_raster arcpy.MosaicToNewRaster_management(tilelist, nibble.gdb_path, nbl_raster, Raster(nibble.in_raster).spatialReference, nibble.pixel_type, nibble.res, "1", "LAST","FIRST") ##Overwrite the existing attribute table file arcpy.BuildRasterAttributeTable_management(nibble.gdb_path + nbl_raster, "Overwrite") ## Overwrite pyramids gen.buildPyramids(nibble.gdb_path + nbl_raster)
def reclassifyRaster(gdb_in, inraster, gdb_out, outraster, reclasslist): # Set environment settings arcpy.env.workspace = gdb_in #Execute Reclassify raster_rc = Reclassify(inraster, "Value", RemapRange(reclasslist), "NODATA") # Set environment settings arcpy.env.workspace = gdb_out ##save raster raster_rc.save(outraster) #create pyraminds gen.buildPyramids(outraster)
def clipByMMU(): yxc = {'ytc':3, 'yfc':4} print "-----------------clipByMMU() function-------------------------------" path_mtr = Raster(data['core']['path']['mtr_mmu']) print 'path_mtr', path_mtr path_mask = data['post']['ytc']['path_mask'] print 'path_mask', path_mask path_mmu = data['post']['ytc']['path_mmu'] print 'path_mmu', path_mmu outCon = Con((path_mtr == yxc['ytc']) & (IsNull(path_mask)), yxc['ytc'], Con((path_mtr == yxc['ytc']) & (path_mask >= 2008), path_mask)) outCon.save(path_mmu) gen.buildPyramids(path_mmu)