AnsweredAssumed Answered

Dividing Integers to create field type :DOUBLE output using Python

Question asked by MondiSA on Aug 14, 2015
Latest reply on Aug 14, 2015 by MondiSA

I extracted point data from a raster, using the GRID_CODE value from the raster data. This creates an integer field in the vector output. I needed to use this output in a division calculation but the answer had to be as a field type DOUBLE (i.e. I needed a decimal value). When doing this in a model using the CALCULATE FIELD tool, with the PYTHON syntax option, it would only produce an Integer value. Apparently this is a PYTHON limitation, judging by the Google search I ran on this issue. I did a work-around by creating a temporary DOUBLE field, copied the GRID_CODE value to it and then ran the CALCULATE FIELD division operation. I then deleted the temporary field. This works ok but is very cumbersome. Is there a smart way to set the PYTHON code so that it will divide an integer and produce a decimal output?

 

The CALCULATE FIELD tool, with the VB syntax option, works fine, but VB is not supported in ArcGIS Pro 64Bit so I can foresee problems in using VB in the near future?

 

Thanks very much.

Outcomes