This content has been marked as final. Show 11 replies
Most likely, if that field does indeed exist, you are using improper syntax for the field. What is the data type of the feature class you are calculating on? Square brackets are for personal geodatabases. (See http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s500000033000000.htm)
Also, double check the field data type to make sure it is numeric.
Also, if you are using ArcGIS 10, you should be using arcpy, not the old arcgisscripting. Unless you have it mapped to the new geoprocessor already.
Mathew..Let me try that and will let you know about the result. Thanks for your input..
I used the following code to add and calculate field:-
gp.AddField_management(nn_file, "p_area", "DOUBLE", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "")
gp.CalculateField_management(nn_file, "p_area", "[F_AREA]/1000", "PYTHON", "")
I keep getting error and couldn't figure it out..Any hint??? Thanks!
That's VBScript, you need to do one of the following. (This is documented in the Calculate Field tool documentation.)
VBScript (the default BTW):
gp.CalculateField_management(nn_file, "p_area", "[F_AREA] / 1000")
gp.CalculateField_management(nn_file, "p_area", "!F_AREA! / float(1000)","PYTHON")
- It is best practice (in Python 2.x anyway) to recast one of the operands to float to ensure you get floating division. (Even though if !F_AREA! is a float field python will know that, it's a good idea.)
- Mathew's comment about different field syntax for different dataset types does not apply here -- that applies only to SQL expressions used in tools like Select and MakeFeaturelayer. In Calculate Field, fields are always surrounded by  or !!, depending on the choice of script language.
Let me try it and I will let you know about the output..
Thanks a lot...
Hello, I am also getting this error. I am running raster calculator and I have 2 fields in which I am trying to multiply. One field is a float, the other was a long. This did not work. So I added a new field in the layer which had the long and designated it a float, then I filled the column with the values I had before as long. I then tried to multiply them again, but I received the same error. I need my data in float for further processing in Darcy's Tools. Currently I have the thickness and Hydrologic conductivity values. according to the formula K = T/b from those rules, that is the same as Kb=T. Transmissivity. This is the last layer I need to create to perform this tool. but I'm not sure why it will not multiply to floats.
Aaron, Raster Calculator is different - instead of accessing the fields directly in the expression, you access those data values for each cell using the Lookup() tool.
Yes, I have the two layers necessary, both of which have the same cell size and alignment. What I did to get it to run just now was created a new field in the attribute table as a float. Then, i did a reclassify of that layer on that field. but, reclassify does not make negative values, I did a raster calculation of minus two on every cell. this brought me back to my original values but in long format again. but this time it performed. but did not give me the values I am expecting. one field goes from -2 to 6. the other goes from 0-1,000,000 and I only got values from -358 to 760. all I'm trying to do is simply multiply 2 raster layers values, I've used this tool a hundred times, that's why I am confused as to why it is not working. I understand the different number types but since they're the same, i don't know what to do. I don't know how to program so I am limited to tool use.
Instead of Reclassify, have you tried the Lookup tool? Say you have a field "XVALUE" in the raster table. In Raster Calculator you can use Lookup to create a new grid with XVALUE as the cell values:
You can also just use the Lookup tool in the dialog, but the Raster Calculator would allow you to combine the operation with something else, for example:
Lookup("mygrid","XVALUE") * 100.0
I read your first post and it seems like you want to create a float field in the raster table, run Calculate Field in your raster table to get your "T/b" value, and .. then use Lookup to make a grid of that float field.
Well I got it to run by reclassifying both of the two layers into long form. so i have the new transmissivity layer. my next step is to run Darcy's flow. I found a way to side step the problem. but I may have a new problem. Darcys flow needs 4 raster layers, all of which have to be the same cell size and alignment, that is fine, im good there, but they all need to be in float, says the directions. also it says if the residual is too high, my data means nothing and that I should put it through a proper porous medium flow program. I think the effective porosity layer is that layer. I'm going to run this tool once I write down what I've done, if it does not run, I will try your advice on how to change all 4 of my layers to float numbers.
I actually have all 4 of my layer created and I ran Darcy's flow tool. Good news is over 99% of my cells had a residual of 0, almost all the other cells were within 1 STD. The bad news is only 75% of my area actually has a result. The areas with high porosity did not calculate and I have a rectangle at the top of my ROI that did not calculate either. I am not sure why this occurred. I will keep my results and continue looking for reasons as to why. and hopefully find a solution. oddly enough, Darcy direction did not work either but magnitude did.