<?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: Error 000670 with Times function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485856#M37907</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I need Weight1 to be a number (I need to multiply a raster layer by a constant where the constant is a parameter), so I set the parameter data type to double. However, I am now getting an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
wks = arcpy.GetParameterAsText(0) # input workspace
Risk1 = arcpy.GetParameterAsText(1) # input raster layer
Weight1 = arcpy.GetParameterAsText(2) # input weight value

arcpy.env.workspace = wks
out1 = Raster(Risk1) * Weight1
outRaster1 = "Wt_" + os.path.basename(Risk1)
out1.save(outRaster1)

arcpy.SetParameterAsText(3,outRaster1)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Error: Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "\\HDQ_FP2\ISD\racheskin\Desktop\MapAlgebra.py", line 9, in&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out1 = Raster(Risk1) * Weight1&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 4049, in Times&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in_raster_or_constant2)&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = wrapper(*args, **kwargs)&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 4046, in wrapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _wrapLocalFunctionRaster(u"Times_sa", ["Times", in_raster_or_constant1, in_raster_or_constant2]) RuntimeError: ERROR 000732: Input Raster: Dataset 2.75 does not exist or is not supported Failed to execute (WeightRisk2).&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:25:01 GMT</pubDate>
    <dc:creator>RobinCheskin</dc:creator>
    <dc:date>2021-12-11T21:25:01Z</dc:date>
    <item>
      <title>Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485852#M37903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Hello Everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on a script that multiplies rasters by a given constant using the Times tool.&amp;nbsp; Both the rasters and constants are parameters in the script.&amp;nbsp; However, I am receiving an error that I don't know how to fix:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# -*- utf-8 -*-
# ---------------------------------------------------------------------------
# Times.py
# Created on: 2012-09-20 14:34:40.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Usage: Times &amp;amp;lt;Risk_Layer&amp;amp;gt; &amp;amp;lt;Weight&amp;amp;gt; &amp;amp;lt;Risk_Layer__2_&amp;amp;gt; &amp;amp;lt;Weight__2_&amp;amp;gt; &amp;amp;lt;Risk_Layer__3_&amp;amp;gt; &amp;amp;lt;Weight__3_&amp;amp;gt; &amp;amp;lt;Risk_Layer__5_&amp;amp;gt; &amp;amp;lt;Weight__5_&amp;amp;gt; &amp;amp;lt;Risk_Layer__4_&amp;amp;gt; &amp;amp;lt;Weight__4_&amp;amp;gt; &amp;amp;lt;Risk_Layer__6_&amp;amp;gt; &amp;amp;lt;Weight__6_&amp;amp;gt; &amp;amp;lt;Risk_Layer__7_&amp;amp;gt; &amp;amp;lt;Weight__7_&amp;amp;gt; &amp;amp;lt;Risk_Layer__8_&amp;amp;gt; &amp;amp;lt;Weight__8_&amp;amp;gt; &amp;amp;lt;Risk_Layer__10_&amp;amp;gt; &amp;amp;lt;Weight__10_&amp;amp;gt; &amp;amp;lt;Risk_Layer__9_&amp;amp;gt; &amp;amp;lt;Weight__9_&amp;amp;gt;
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
#Set geoprocessing environment
inWorkspace = arcpy.GetParameterAsText(0)
arcpy.env.workspace = inWorkspace
arcpy.env.overwriteOutput = True
# Script arguments
Risk_Layer = arcpy.GetParameterAsText(1)
Weight = arcpy.GetParameterAsText(2)
Risk_Layer__2_ = arcpy.GetParameterAsText(3)
Weight__2_ = arcpy.GetParameterAsText(4)
Risk_Layer__3_ = arcpy.GetParameterAsText(5)
Weight__3_ = arcpy.GetParameterAsText(6)
Risk_Layer__5_ = arcpy.GetParameterAsText(7)
Weight__5_ = arcpy.GetParameterAsText(8)
Risk_Layer__4_ = arcpy.GetParameterAsText(9)
Weight__4_ = arcpy.GetParameterAsText(10)
Risk_Layer__6_ = arcpy.GetParameterAsText(11)
Weight__6_ = arcpy.GetParameterAsText(12)
Risk_Layer__7_ = arcpy.GetParameterAsText(13)
Weight__7_ = arcpy.GetParameterAsText(14)
Risk_Layer__8_ = arcpy.GetParameterAsText(15)
Weight__8_ = arcpy.GetParameterAsText(16)
Risk_Layer__10_ = arcpy.GetParameterAsText(17)
Weight__10_ = arcpy.GetParameterAsText(18)
Risk_Layer__9_ = arcpy.GetParameterAsText(19)
Weight__9_ = arcpy.GetParameterAsText(20)
# Local variables:
Weight__Risk_Layer_ = Risk_Layer
Weight__Risk_Layer__2__ = Risk_Layer__2_
Weight__Risk_Layer__3__ = Risk_Layer__3_
Weight__Risk_Layer__4__ = Risk_Layer__4_
Weight__Risk_Layer__5__ = Risk_Layer__5_
Weight__Risk_Layer__6__ = Risk_Layer__6_
Weight__Risk_Layer__7__ = Risk_Layer__7_
Weight__Risk_Layer__8__ = Risk_Layer__8_
Weight__Risk_Layer__9__ = Risk_Layer__9_
Weight__Risk_Layer__10__ = Risk_Layer__10_
# Process: Times a
rcpy.gp.Times_sa(Risk_Layer, Weight, Weight__Risk_Layer_)
# Process: Times (2)
arcpy.gp.Times_sa(Risk_Layer__2_, Weight__2_, Weight__Risk_Layer__2__)
# Process: Times (3)
arcpy.gp.Times_sa(Risk_Layer__3_, Weight__3_, Weight__Risk_Layer__3__)
# Process: Times (4)
arcpy.gp.Times_sa(Risk_Layer__4_, Weight__4_, Weight__Risk_Layer__4__)
# Process: Times (5)
arcpy.gp.Times_sa(Risk_Layer__5_, Weight__5_, Weight__Risk_Layer__5__)
# Process: Times (6)
arcpy.gp.Times_sa(Risk_Layer__6_, Weight__6_, Weight__Risk_Layer__6__)
# Process: Times (7)
arcpy.gp.Times_sa(Risk_Layer__7_, Weight__7_, Weight__Risk_Layer__7__)
# Process: Times (8)
arcpy.gp.Times_sa(Risk_Layer__8_, Weight__8_, Weight__Risk_Layer__8__)
# Process: Times (9)
arcpy.gp.Times_sa(Risk_Layer__9_, Weight__9_, Weight__Risk_Layer__9__)
# Process: Times (10)
arcpy.gp.Times_sa(Risk_Layer__10_, Weight__10_, Weight__Risk_Layer__1)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And receiving the error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;
&lt;SPAN&gt;&amp;nbsp; File "\\HDQ_FP2\ISD\racheskin\Desktop\Times.py", line 75, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.gp.Times_sa(Risk_Layer, Weight, Weight__Risk_Layer_)&lt;/SPAN&gt;
&lt;SPAN&gt;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 484, in &amp;lt;lambda&amp;gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args, True))&lt;/SPAN&gt;
&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;
&lt;SPAN&gt;ERROR 000670: output P:\Crime_Analysis\Testing_Training\RiskTerrainModeling\RobinAdrienne\Assault_Factors.gdb\Bin_Rec_AA_JAS_10 is same as input P:\Crime_Analysis\Testing_Training\RiskTerrainModeling\RobinAdrienne\Assault_Factors.gdb\Bin_Rec_AA_JAS_10&lt;/SPAN&gt;
&lt;SPAN&gt;Failed to execute (Times).&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am confused as to why the output ends up the same as the input since I specified the outRasters be named differently in the script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Help please!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Robin&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:24:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485852#M37903</guid>
      <dc:creator>RobinCheskin</dc:creator>
      <dc:date>2021-12-11T21:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485853#M37904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;This is a great example of a case where building a process in modelbuilder and exporting to Python is not the optimal approach. The code you get is just too convoluted and does not take advantage of Python map algebra. The translation may have gone (a little) easier if you had used the Raster Calculator tool instead of many Times tools, but not much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Rather than fix the code, I recommend a rewrite. I'll do it here with just two rasters input and you can expand it from there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
wks = arcpy.GetParameterAsText(0) # input workspace
Risk1 = arcpy.GetParameterAsText(1) # input raster layer
Weight1 = arcpy.GetParameterAsText(2) # input raster layer
outRaster1 = arcpy.GetParameterAsText(3)&amp;nbsp; # output raster

arcpy.env.workspace = wks
out1 = Raster(Risk1) * Raster(Weight1) 
out1.save(outRaster1)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:24:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485853#M37904</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T21:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485854#M37905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Curtis.&amp;nbsp; I originally tried with map algebra with an original python script, but failed.&amp;nbsp; This looks great and I will be sure to try it asap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would prefer not to have the outRaster name as a parameter, but rather would like all the rasters saved as Weight_%Name% and have the output &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;location&lt;/SPAN&gt;&lt;SPAN&gt; as a parameter.&amp;nbsp; Does setting the input workspace take care of the location, and how can I save all the rasters like this automatically?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 22:32:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485854#M37905</guid>
      <dc:creator>RobinCheskin</dc:creator>
      <dc:date>2012-09-20T22:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485855#M37906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I would prefer not to have the outRaster name as a parameter, but rather would like all the rasters saved as Weight_%Name% and have the output &lt;SPAN style="font-style:italic;"&gt;location&lt;/SPAN&gt; as a parameter.&amp;nbsp; &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Does setting the input workspace take care of the location&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, if you do a raster save without specifying a full path, the current workspace is used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How can I save all the rasters like this automatically?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You not only want to save using a generated name, but also have the output appear when the script is run in ArcMap or in ModelBuilder appear as an output to link to further processes. (Just like a regular tool.) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is done using a derived script parameter with the SetParameterAsText method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the toolbox script tool properties, set the fourth parameter as data type "Raster" and parameter type "Derived".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Be careful with your raster naming, grids can only have 13 characters!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
wks = arcpy.GetParameterAsText(0) # input workspace
Risk1 = arcpy.GetParameterAsText(1) # input raster layer
Weight1 = arcpy.GetParameterAsText(2) # input raster layer

arcpy.env.workspace = wks
out1 = Raster(Risk1) * Raster(Weight1) 
outRaster1 = "Wt_" + os.path.basename(Risk1)
out1.save(outRaster1).

arcpy.SetParameterAsText(3,outRaster1)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:24:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485855#M37906</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T21:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485856#M37907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I need Weight1 to be a number (I need to multiply a raster layer by a constant where the constant is a parameter), so I set the parameter data type to double. However, I am now getting an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
wks = arcpy.GetParameterAsText(0) # input workspace
Risk1 = arcpy.GetParameterAsText(1) # input raster layer
Weight1 = arcpy.GetParameterAsText(2) # input weight value

arcpy.env.workspace = wks
out1 = Raster(Risk1) * Weight1
outRaster1 = "Wt_" + os.path.basename(Risk1)
out1.save(outRaster1)

arcpy.SetParameterAsText(3,outRaster1)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Error: Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "\\HDQ_FP2\ISD\racheskin\Desktop\MapAlgebra.py", line 9, in&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out1 = Raster(Risk1) * Weight1&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 4049, in Times&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in_raster_or_constant2)&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = wrapper(*args, **kwargs)&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 4046, in wrapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _wrapLocalFunctionRaster(u"Times_sa", ["Times", in_raster_or_constant1, in_raster_or_constant2]) RuntimeError: ERROR 000732: Input Raster: Dataset 2.75 does not exist or is not supported Failed to execute (WeightRisk2).&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485856#M37907</guid>
      <dc:creator>RobinCheskin</dc:creator>
      <dc:date>2021-12-11T21:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485857#M37908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I currently have this script accomplishing the task:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
import arcpy
from arcpy import env
from arcpy.sa import *

constantValue = arcpy.GetParameterAsText(0) # input weight value
cellSize = 100
outExtent = Extent(871599.89, 982834.44, 912502.09, 1070920.9)
arcpy.CheckOutExtension("Spatial")
outConstRaster = CreateConstantRaster(constantValue, "FLOAT", cellSize, outExtent)

#Set local variables
wks = arcpy.GetParameterAsText(1) # input workspace
inRaster1 = arcpy.GetParameterAsText(2) # input raster layer
env.workspace = wks
outRaster = "Ct_" + os.path.basename(inRaster1)
outConstRaster.save(outRaster)

outTimes = Raster(inRaster1)* Raster(outRaster)
outRaster1 = "Wt_" + os.path.basename(inRaster1)
outTimes.save(outRaster1)

arcpy.SetParameterAsText(3,outRaster1)
arcpy.Delete_management(outRaster)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works, but is not optimal and much slower than I would like.&amp;nbsp; I tried this code without saving outConstRaster and just calling it as a raster object, but I kept getting the same error: "TypeError: expected a raster or layer name."&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts on making this more efficient?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485857#M37908</guid>
      <dc:creator>RobinCheskin</dc:creator>
      <dc:date>2021-12-11T21:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error 000670 with Times function</title>
      <link>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485858#M37909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp; know this is three years later... too bad no one else picked up this thread...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your issue with WeightValue is to directly use it in arcpy map algebra you need to convert it back to a number with float() so you can use it as a multiplier. (GetParameterAsText always gives you a string [hence its name!]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you just leave the constant raster outRaster as temporary, this will probably delay calculation until you run outTimes.save(). The reason it looked like it was running really fast is that nothing was really happening until you executed the .save() method which runs the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Local functions get packed up until they are needed which can really speed things up as intermediate grids in some cases do not have to be saved to disk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os 
import arcpy 
from arcpy import env 
from arcpy.sa import * 
arcpy.CheckOutExtension("Spatial")

constantValue = float(arcpy.GetParameterAsText(0)) # input weight value 
cellSize = 100 
outExtent = arcpy.Extent(871599.89, 982834.44, 912502.09, 1070920.9) 

# Set local variables 
wks = arcpy.GetParameterAsText(1) # input workspace 
inRaster1 = arcpy.GetParameterAsText(2) # input raster layer 
arcpy.CheckOutExtension("Spatial")

# run Times
&lt;SPAN style="font-size: 9pt;"&gt;outTimes = Raster(inRaster1) * constantValue&lt;/SPAN&gt;
outTimes.save("Wt_" + os.path.basename(inRaster1)&amp;nbsp; ) 
# return raster (outTimes is a raster object so path is returned "as text"
arcpy.SetParameterAsText(3, outTimes) &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000670-with-times-function/m-p/485858#M37909</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T21:25:06Z</dc:date>
    </item>
  </channel>
</rss>

