using raster calculator for stack of raster layers

4909
3
Jump to solution
04-17-2015 03:20 AM
Leo_KrisPalao
New Contributor II

Hi ArcPy users,

I have a bit of problem in my script. I am working with MODIS data, and I already have a stack of raster layers. I want to rescale my MODIS data (stack layers) but whenever I use the raster calculator or the divide function in Math the output is converted into single band. I have 10 bands(rasters) stacked in each of my TIFF files.

out_Div = out_ws + "MOD_" + date_parse + "_clip_Geo_rescale" + ".tif"
outDivide = Divide(bands_WGS, 10000.00)
outDivide.save(out_Div)

bands_WGS is a stack of 10 rasters. When I execute this the output is converted into a single band. Not a stack of rasters divided by 10000.00

Hope my query is clear.

Thanks in advance for any help.

-Leo

0 Kudos
1 Solution

Accepted Solutions
KishorGhatage
Occasional Contributor III

I believe you need to separate the bands and then run the divide on each band raster.  You can try using composite band tool to create 10 raster layers for each band > divide them and stack them again in once single .tif image using composite band again. There may be other solutions using python.

Hope this is helpful

Kishor

View solution in original post

0 Kudos
3 Replies
KishorGhatage
Occasional Contributor III

I believe you need to separate the bands and then run the divide on each band raster.  You can try using composite band tool to create 10 raster layers for each band > divide them and stack them again in once single .tif image using composite band again. There may be other solutions using python.

Hope this is helpful

Kishor

0 Kudos
Leo_KrisPalao
New Contributor II

Hi Kishor, thanks for your suggestion. This confirms what I have in mind.

Thank you very much.

-Leo

0 Kudos
GabrielUpchurch1
Occasional Contributor III

I would agree with Kishor that you need to work with the individual bands, which makes sense logically based on what you are asking the software to do.  By trying to divide a multiband raster, you are asking the software to divide each individual band by 10000, which will create 10 new datasets, and then to composite these 10 new datasets into a new multiband raster.  In the case of Divide, it is simply a mathematical operator and lacks the complex programming necessary to complete such an operation.

0 Kudos