I have an hillshade tiff for which the current band type=Bytemay be problematic.

How to change the band type to type=float ?



gdal_translate -of GTiff -ot Float32 input.tif output.tif

Seems you can choose between several float types: "Byte"/"Int16"/"UInt16"/"UInt32"/"Int32"/"Float32"/"Float64"/"CInt16"/"CInt32"/"CFloat32"/"CFloat64"

  • The answer has been edited but was initially correct: the float supported types are Float32/Float64/CFloat32/CFloat64. Mar 12 '19 at 20:31

With gdal_calc.py is, for example, --type Float32 (my answer based in your link). The next command worked for me when I used to calculate at-satellite brightness temperature:

gdal_calc.py -A b6.rad.tif --calc "1260.56/log((607.76/A)+1)" --type Float32 --outfile bright_temp.tif

I hope that helps.

  • Did you tested it ? --type='Float32' clearly fails for me.
    – Hugolpz
    May 22 '15 at 18:03
  • Of course. The above example was in my system with Ubuntu. In Debian, you can see my answer here: gis.stackexchange.com/questions/147457/…
    – xunilk
    May 22 '15 at 20:16
  • If you have problems with gdal_cal.py the script is here: svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/gdal_calc.py. I copied it in an older Ubuntu system in /usr/bin and it worked nicely (I know that you use Linux for a recently question).
    – xunilk
    May 22 '15 at 20:28
  • I indeed run on ubuntu. I used srtm tif, gdal hillshade, then gdal_calc with type=Float32, it fails. When --calc=<equation> is more basic, it behave as expected.
    – Hugolpz
    May 23 '15 at 7:33

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.