Convert image data using gdal_translate

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 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 certain formula that require 8bit data, for example Forest Canopy Density Model. So, after you do 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

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s