2

I'm using ArcGIS. I have a raster with angles in the value field. But the value field is type long integer. I would like to change it to float. Is that possible? Some more details: I've started with a DEM, and created two arrays with from it using numpy. The first array is the DEM source of data, and the second is the target array where I store de processed cells. I'm generating a topographic exposure raster.

My issue is that the value field from the original DEM is a long integer, therefore not suitable to storage decimal values. So, my question is how to change that value field type to float. This is done in python.


The way I solved this is by multiplying the angles (final data to store) by 1000000, so the value field store all the numbers that I need. I find this a cheesy trick. Is there a better/more 'elegant' solution?

1

you can multiply your numpy array by 1.0 and this will change the type of pixel to float.

newarray = oldarray*1.0
new_raster = arcpy.NumPyArrayToRaster(newarray)
  • Thanks @radouxju. This was the kind of answer I needed. Let me try it. – Delonix R. Mar 15 '16 at 14:07
0

Another way of changing data type for a raster is to use the Copy Raster tool where you can change the pixel type parameter to float 32.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.