GDAL Translate

(0 comments)

In remote sensing data analyses, usually, we have to convert Landsat data to Top of Atmosphere value. This process will change the original digital number, in Landsat 5 from 8 bit to decimal with the range between 0 and 1. If the data is Landsat 8 then it will change from 16bit data to decimal with a range between 0 and 1.

If you want to analyze the ToA (reflectance), i.e., land cover classification, you can directly use the image. The problem will appear if you want to analyze with a certain formula that requires 8bit data, for example, Forest Canopy Density Model. So, after you do a radiometric correction to reflectance, you have to rescale into 8bit integer.

Usually, I use GRASS GIS for this purpose. But somehow today I found it’s difficult to use GRASS GIS. The result seems strange. After hours of trying, I found I trick to do the process.

GDAL to the rescue

We can use gdal_translate to convert data from any kind of range into 8bit integer. There are two steps to do this :

  1. Investigate the statistics of the data source. Use the minimum and maximum value in the data source
    • gdal_info filename.tif -stats
    • Metadata:

          STATISTICS_MAXIMUM=0.38453308863717

          STATISTICS_MEAN=0.11160144537989

          STATISTICS_MINIMUM=0.010000000000004

          STATISTICS_STDDEV=0.063021296050904

  2. Translate the data using gdal_translate command
    • gdal_translate -of GTiff -ot Byte -scale 0.010000000000004 0.38453308863717 1 255 source.tif target.tif
Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required