Hey Everyone.
I am trying to multiply a raster layer with a number (0.1) but I get the error:
"
can't multiply sequence by non-int of type 'float'
"
I can see that other people have had this problem but I am still not completely sure what the solution to it is.
Thanks a lot!
Ditlev
Solved! Go to Solution.
Just going by years of experience...these are my rules...and my advice to students.
'Raster' * 0.1 with the spaced in between? If that doesn't work try the Times tool in the math toolset of the spatial analyst. If that doesn't work convert your raster to an Esri grid format
Can you post your entire script or map algebra expression?
I am doing just a little change to Dan's solution
Float('Raster' * (0.1))
Check the spelling of your raster layer. The error appears when you attempt to multiply what it thinks is a string (because it's not a raster in the map) by a non-integer (interestingly, you can actually multiply a string by an integer). I can reproduce your error by misspelling an existing raster layer.
For example, with an existing raster.jpg:
"ras234ter.jpg" * 0.1
...results in your error, while:
"raster.jpg" * 0.1
...completes successfully.
I have typed the following in raster calculator:
"H20.V7\12min01h20v7" * 0.1
I have also tried with:
Float("H20.V7\12min01h20v7" * 0.1)
and
Float("H20.V7\12min01h20v7" * (0.1))
and neither worked.
This is the information about the raster from the properties:
Format: GRID
Source_Type: Generic
Pixel_Type: signed integer
Dan: So I guess that the format is already GRID. What does the Times tool exactly do?
Darren: I am still not sure what string means? But the name of the raster layer inserted into the raster calculator is correct because I press the layer displayed in there ( So I am not spelling it myself if you know what I mean).
times does the same as * (aka multiply)
It is your grid name that is killing the expression you can't specify a path, nor have periods, nor should a grid begin with a number or be > 10 characters in length...even though you can create one like that in the first place. Export your grid to
'myGrid'
and try again
The problem was the output name of the raster "et_wsi_0.1".
When I took out the "." it worked.
Which other naming rules apply to ArcGIS? I have tried to search for this but havent found usefull answer?
Just going by years of experience...these are my rules...and my advice to students.
haha thanks alot