Help with Con Statement

1824
1
Jump to solution
12-02-2010 07:49 AM
by Anonymous User
Not applicable
Original User: Lynn_Carlson

I would like to assign values greater than 350 with the values of 1 and the values less than 350  from the equation below where x= original values and y=the output value

y=1-cos^2(x/350*pi/2)

Thus, using Single Output Map Algebra the equation I am trying to write is:

con(x<350, 1-cos(x/350*RAD(90))*cos(x/350*RAD(90)),1)

where x is the original raster layer.

However this produces an error message. After playing around with it, I found that once I add the "divided by 350" the function no longer works. How do I solve this problem? What is the correct syntax?

ArcGIS 9.3.1 with Spatial Analyst

Thank you
0 Kudos
1 Solution

Accepted Solutions
WilliamHuber
New Contributor III
In 9.x, you need to surround most operators (including "/") with white space, Lynn.  A good approach is to first carry out a complex series of calculations one at a time in the Raster Calculator so you can catch such problems right where they happen.  Later you can combine them into a monolithic expression for SOMA.

BTW, it's simpler (and more accurate) to square the sine rather than subtract the square of the cosine from 1: remember, 1 - cos^2(x) = sin^2(x).

View solution in original post

1 Reply
WilliamHuber
New Contributor III
In 9.x, you need to surround most operators (including "/") with white space, Lynn.  A good approach is to first carry out a complex series of calculations one at a time in the Raster Calculator so you can catch such problems right where they happen.  Later you can combine them into a monolithic expression for SOMA.

BTW, it's simpler (and more accurate) to square the sine rather than subtract the square of the cosine from 1: remember, 1 - cos^2(x) = sin^2(x).