filmov
tv
Using Python to Create Composite Bands

Показать описание
This video shows a couple of ways to create Composite Bands using python/arcpy.
Twitter: @my_physical
Instagram: @MyPhysicalWorld
Code used in this video:
Simple variable assignments:
# ================================================== Create Full Composite .IMG ===============================================================
print(b1+';'+b2+';'+b3+';'+b4+';'+b5+';'+b6+';'+b7, imgCompFile)
arcpy.CompositeBands_management(b1+';'+b2+';'+b3+';'+b4+';'+b5+';'+b6+';'+b7, imgCompFile)
OR
FOR LOOP:
# ================================================== Create Full Composite .IMG ===============================================================
print(bands)
for band in bands:
if band[-6:] == 'B4.TIF':
rPath = imgNewDir + '\\' + band
break
# find the green band
for band in bands:
if band[-6:] == 'B3.TIF':
gPath = imgNewDir + '\\' + band
break
# find the blue band
for band in bands:
if band[-6:] == 'B2.TIF':
bPath = imgNewDir + '\\' + band
break
for band in bands:
if band[-6:] == 'B7.TIF':
iPath = imgNewDir + '\\' + band
break
print(rPath+';'+gPath+';'+bPath+';'+iPath, rgbiPath)
arcpy.CompositeBands_management(rPath+';'+gPath+';'+bPath+';'+iPath, rgbiPath)
Twitter: @my_physical
Instagram: @MyPhysicalWorld
Code used in this video:
Simple variable assignments:
# ================================================== Create Full Composite .IMG ===============================================================
print(b1+';'+b2+';'+b3+';'+b4+';'+b5+';'+b6+';'+b7, imgCompFile)
arcpy.CompositeBands_management(b1+';'+b2+';'+b3+';'+b4+';'+b5+';'+b6+';'+b7, imgCompFile)
OR
FOR LOOP:
# ================================================== Create Full Composite .IMG ===============================================================
print(bands)
for band in bands:
if band[-6:] == 'B4.TIF':
rPath = imgNewDir + '\\' + band
break
# find the green band
for band in bands:
if band[-6:] == 'B3.TIF':
gPath = imgNewDir + '\\' + band
break
# find the blue band
for band in bands:
if band[-6:] == 'B2.TIF':
bPath = imgNewDir + '\\' + band
break
for band in bands:
if band[-6:] == 'B7.TIF':
iPath = imgNewDir + '\\' + band
break
print(rPath+';'+gPath+';'+bPath+';'+iPath, rgbiPath)
arcpy.CompositeBands_management(rPath+';'+gPath+';'+bPath+';'+iPath, rgbiPath)