Composite bands tool not giving correct cell size

600
1
03-01-2021 07:46 AM
Labels (1)
GISArchbold
New Contributor II

I have 3 band RGB drone imagery and a vegetation index derived from the RGB (~3cm cell size) and the NIR band from the most recent NAIP imagery (0.6m cell size). I'm hoping to stack these into one 5 band raster with a 3cm cell size.

According to the tool documentation, Composite Bands should take the cell size, extent, and spatial reference from the first raster in the list (which should be my red band). However, the output raster has a cell size of 0.6m.

I have tried setting the cell size in the environment to "MINOF" as well as to match the size of the drone imagery. I was initially working in a python notebook, but I'm running into the same issues when I run the tool in the geoprocessing pane. 

I suppose I can resample the NAIP imagery before I run the Composite Bands tool, but I'm going to be repeating this process for numerous rasters and would love to save the step if possible. 

Here's some code from my notebook:

 

import arcpy
from arcpy import env
from arcpy.sa import *

defaultRas = ("...filepath\\droneimage.tif")
arcpy.env.cellSize = "MINOF"
arcpy.env.snapRaster = defaultRas 

#Load Rasters
r = Raster("...filepath\\droneimage.tif\\Red")
g = Raster("...filepath\\droneimage.tif\\Green")
b = Raster("...filepath\\droneimage.tif\\Blue")
n = Raster("...filepath\\NAIP_2019\\Band_4")

#calculate ExGI
exgi = 2 * g - r - b  

#composite bands
comp = arcpy.management.CompositeBands([r, g, b, n, exgi], "composite")

 

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

Unless you are going to get wildly varying input cell sizes, set it explictly rather than relying on min or maxs.  The default for cell size is maxof,... perhaps the compositebands has an issue

Cell Size (Environment setting)—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos