<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Raster Calculator Requires Cell Size and Extent with Trig Functions in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240803#M3368</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Dan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interesting, I missed that in the syntax at the bottom of the Cos help.&amp;nbsp; Good catch.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Patrick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Mar 2011 13:55:15 GMT</pubDate>
    <dc:creator>PatrickTaurman</dc:creator>
    <dc:date>2011-03-11T13:55:15Z</dc:date>
    <item>
      <title>Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240799#M3364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm reporting an issue and solution involving the Raster Calculator tool in ArcToolbox for ArcGIS 10.&amp;nbsp; Raster Calculator works fine until I include a trig function such as Cos().&amp;nbsp; When my expressions include a trig function, I get this error message upon execution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000539: Error running expression: rcexec() &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: No CellSize and Extent set&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A simple expression which produces this error is Cos(0)*"myraster".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To resolve the issue, I click Environments in the Raster Calculator window, and then set the Extent (under Processing Extent) and Cell Size (under Raster Analysis) to be "Same as layer myraster."&amp;nbsp; The tool then executes correctly, although it does warn me that the input and output datums don't match (even though they do appear to match).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm curious why using Cos() requires extents and cell sizes to be explicitly set.&amp;nbsp; But at least there's a workaround.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Mar 2011 13:55:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240799#M3364</guid>
      <dc:creator>TimWhiteaker</dc:creator>
      <dc:date>2011-03-10T13:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240800#M3365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just ran the following statement in the Raster Calculator, and did not receive any messages:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cos("test_elevation")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I tried&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cos(0) * "test_elevation"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I got the same message you get.&amp;nbsp; Next I tried &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"test_elevation" * Cos(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and still get the error, so the order of inputs does not matter.&amp;nbsp; I am not sure if this is expected or not.&amp;nbsp; I would log an incident with &lt;/SPAN&gt;&lt;A href="http://support.esri.com/en/"&gt;Support&lt;/A&gt;&lt;SPAN&gt; to verify if this should be functioning like this since Cos("test_elevation") works without error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Mar 2011 15:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240800#M3365</guid>
      <dc:creator>PatrickTaurman</dc:creator>
      <dc:date>2011-03-10T15:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240801#M3366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Bill,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well considering Cos("test_elevation") works without specifying extent or cellsize, I would expect "test_elevation" * Cos(0) or Cos(0) * "test_elevation" to work also.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Correct me if I am wrong, but Cos(0) is simply 1, so "test_elevation" * Cos(0) or Cos(0) * "test_elevation" is simply "test_elevation" * 1 or 1 * "test_elevation".&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the Raster Calculator can get the cellsize and extent information for Cos("test_elevation"), it really only makes sense that it can also get it for "test_elevation" * Cos(0) or Cos(0) * "test_elevation", considering it is just multiplying the raster by 1.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is where I believe the bug is.&amp;nbsp; Please let me know if I need to clarify for you further.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Patrick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 13:27:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240801#M3366</guid>
      <dc:creator>PatrickTaurman</dc:creator>
      <dc:date>2011-03-11T13:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240802#M3367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;From the the help for the function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000n8000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000n8000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to quote:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to use a number as an input for this parameter, the cell size and extent must first be set in the environment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which is in keeping with the intent of the tool/function and I suspect that all inputs for all expressions are checked for cell size and extent to ensure that the outputs meet the environment settings, hence, Cos(0) will fail since it has no extent or cell size and I would not want it to assume one.&amp;nbsp; This is not a bug, it is a wakeup to the user to delve into the problem further or use a numeric value for Cos rather than the tool/function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 13:47:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240802#M3367</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-03-11T13:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240803#M3368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Dan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interesting, I missed that in the syntax at the bottom of the Cos help.&amp;nbsp; Good catch.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Patrick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 13:55:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240803#M3368</guid>
      <dc:creator>PatrickTaurman</dc:creator>
      <dc:date>2011-03-11T13:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240804#M3369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bill,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It can never hurt to contact Support and at least get the enhancement in.&amp;nbsp; This could also be posted over on the &lt;/SPAN&gt;&lt;A href="http://ideas.arcgis.com"&gt;Ideas&lt;/A&gt;&lt;SPAN&gt; website (haven't checked to see if it exists there yet). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Patrick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 14:00:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240804#M3369</guid>
      <dc:creator>PatrickTaurman</dc:creator>
      <dc:date>2011-03-11T14:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240805#M3370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;better still, request that the math module functionality be available within the interface so you could generate code in the raster calculator such as&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import math&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"SomeGrid" * math.cos(somenumber)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;kind of like field calculator syntax&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 14:11:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240805#M3370</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-03-11T14:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240806#M3371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you to all for your interest in this issue. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So currently the complex map algebra expression, &lt;/SPAN&gt;&lt;PRE&gt;out = Raster("myraster) + Cos(0)&lt;/PRE&gt;&lt;SPAN&gt; requires a cellsize and extent to be set because the Spatial Analyst function arcpy.sa.Cos() requires it when using a scalar input. Using this or any other local function in your map algebra expression would have this requirement because the function result is a raster not a scalar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mr. Huber and Mr. Patterson are correct in there interpretation of the problem and provided a good explaination as to why. With that said, this expression should "just work", as it did work in workstation, and I think all share the same frustration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We acknowledge this is a defect and are currently working on the solution for supporting scalar values in Spatial Analyst local functions when used in a complex expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Workarounds for ArcGIS 10.0 (service pack 1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt; &lt;BR /&gt; &lt;LI&gt;set cellsize and extent environment if using Spatial Analyst arcpy.sa.Cos(0)&lt;/LI&gt; &lt;BR /&gt; &lt;LI&gt;use the python math.cos(0) to return scalar (note the python uses lowercase for cos() function)&lt;/LI&gt; &lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you again for you time and consideration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Ryan DeBruyn&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI - Spatial Analyst&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 17:57:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240806#M3371</guid>
      <dc:creator>RyanDeBruyn</dc:creator>
      <dc:date>2011-03-17T17:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Requires Cell Size and Extent with Trig Functions</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240807#M3372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ryan&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, I think some of us still miss the simplicity&amp;nbsp; of SA knowing an extent (whether it was right or wrong)...aka Avenue's&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.AsGrid&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 18:32:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-requires-cell-size-and-extent/m-p/240807#M3372</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-03-17T18:32:49Z</dc:date>
    </item>
  </channel>
</rss>

