Select to view content in your preferred language

Error message in raster calculator :can't multiply sequence by non-int of type 'float'

7349
9
Jump to solution
03-27-2015 08:49 AM
DitlevReventlow
Deactivated User

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

Tags (1)
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Just going by years of experience...these are my rules...and my advice to students.

  1. document everything in a text editor
  2. copy the results window there if using Arctoolbox tools into (1)
  3. work local (sorry...I hate networks), backup to networks, the 'cloud' ...don't use a USB drives for source or destination information
  4. backup everything (zip, copy and/or email backups) at time increments that you are comfortable losing...this includes your *.mxd files... create a python script that does this for you (ie, zip, name, copy and redirect
  5. Some people like geodatabases...your choice...unless you work with open source software.  If you need anything in a geodatabase that the above steps don't cover, then use one
  6. Filenames etc:    source and destination paths should NOT contain spaces or any other characters
  7. grid names... no spaces,  letters numbers and the underscore are ok... don't begin with a number
  8. <10ish characters in length...if you can't name it in ten...you aren't following steps 1 -4
  9. Did I mention...backup everything
  10. Develop your own rules based upon what you screwed up
  11. If these rules are too difficult to follow, then select File|Exit from the ArcMap menu

View solution in original post

9 Replies
DanPatterson_Retired
MVP Emeritus

'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

DarrenWiens2
MVP Honored Contributor

Can you post your entire script or map algebra expression?

JayantaPoddar
MVP Esteemed Contributor

I am doing just a little change to Dan's solution

Float('Raster' * (0.1))



Think Location
DarrenWiens2
MVP Honored Contributor

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.

DitlevReventlow
Deactivated User

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).

0 Kudos
DanPatterson_Retired
MVP Emeritus

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

DitlevReventlow
Deactivated User

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?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Just going by years of experience...these are my rules...and my advice to students.

  1. document everything in a text editor
  2. copy the results window there if using Arctoolbox tools into (1)
  3. work local (sorry...I hate networks), backup to networks, the 'cloud' ...don't use a USB drives for source or destination information
  4. backup everything (zip, copy and/or email backups) at time increments that you are comfortable losing...this includes your *.mxd files... create a python script that does this for you (ie, zip, name, copy and redirect
  5. Some people like geodatabases...your choice...unless you work with open source software.  If you need anything in a geodatabase that the above steps don't cover, then use one
  6. Filenames etc:    source and destination paths should NOT contain spaces or any other characters
  7. grid names... no spaces,  letters numbers and the underscore are ok... don't begin with a number
  8. <10ish characters in length...if you can't name it in ten...you aren't following steps 1 -4
  9. Did I mention...backup everything
  10. Develop your own rules based upon what you screwed up
  11. If these rules are too difficult to follow, then select File|Exit from the ArcMap menu

DitlevReventlow
Deactivated User

haha thanks alot