Select to view content in your preferred language

Raster Calculator

4517
3
01-27-2015 11:10 AM
MichaelBrown3
Emerging Contributor

I am having an issue with Raster Calculator (Spatial Analyst --> Map Algebra --> Raster Calculator). The data I am using is two separate optical wavelength rasters. One raster is the red band wavelength and the other is the blue band wavelength. The issue is that the output of the expression is continually a single class raster classification. All pixels are in this class and it is useless. I have no idea why this is the output that is occurring. The expression I am entering is as follows:

.895 - 4.33 * float(ln(B/R)) + 23 *float(ln(B/R))

I am looking for an output raster with each pixel having its own value. Why does my output keep returning a raster like image 1?

The second image is an example of what I am after but cannot obtain. Is my expression incorrect? Do I have to specify something I am unaware of? Help much appreciated, thanks.

- Michael -

0 Kudos
3 Replies
XanderBakker
Esri Esteemed Contributor

Can you attach a small set of the R and B data?

Be aware that the natural logarithm of a negative float or 0 will result in NoData and I see that you have negative values in your raster.

I tried your formula on some sample data (OR2A_Beijing_China_40cm_054000253010, each band has values ranging from 1-2047, so completely different from your data). The formula works:

0.895 - 4.33 * Float(Ln("Band_3B"/"Band_1R")) + 23 * Float(Ln("Band_3B"/"Band_1R"))

... but, the result had little variation in data, most pixels were NoData and large areas with the value 0.895000, and small areas with values ranging up to 99.72.

0 Kudos
MichaelBrown3
Emerging Contributor

I actually think I got it now. I think my issue was that I was using ^2 as my exponent opposed to using **2.

(I actually forgot to even show the exponent in my original post which means the error was impossible to find) facepalm...

I am now getting a desired result which I believe to be correct. Does my new expression seem to be correct? My output data ranges from 70.24 to .6912. If you would be so kind to tell me how to attach actual data here and see if you get the same range, that would be great.

Original expression ______________     .895 - 4.33 * float(ln(B/R)) + 23 *float(ln(B/R))

Original expression corrected  ______    .895 - 4.33 * float(ln(B/R)) + 23 *float(ln(B/R))^2

New expression _________________     .895 - 4.33 * float(ln(B/R)) + 23 *float(ln(B/R))**2

Thank you for your help and timely response.

- Michael -

0 Kudos
XanderBakker
Esri Esteemed Contributor

If you click on the Advanced Editor link in the upper right corner when writing a post, you will get the advanced editor which has a link in the lower right corner to attach files.

0 Kudos