A common way to visualise dual-polarisation SAR data is to display a colour composite of HH (Red), HV (Green) and HH/HV(Blue).
Python Functions
Such composites can be created in RSGISLib using the following steps:
- Create the ratio image using the bandMath.
import rsgislib from rsgislib import imagecalc bandDefns = [imagecalc.BandDefn('hh', 'in_hh_file.kea', 1), imagecalc.BandDefn('hv', 'in_hv_file.kea', 1)] imagecalc.bandMath('out_hhhv_ratio.kea', 'hh/hv', 'KEA', \ rsgislib.TYPE_32FLOAT, bandDefns)
- Create the stack using stackImageBands
import rsgislib from rsgislib import imageutils bands_list = ['in_hh_file.kea', 'in_hv_file.kea', 'out_hhhv_ratio.kea'] band_names = ['HH','HV', 'HH/HV'] gdaltype = rsgislib.TYPE_32FLOAT imageutils.stackImageBands(bands_list, band_names, 'out_hhhvratio_stack.kea', None, 0, 'KEA', rsgislib.TYPE_32FLOAT)
- Stretch using stretchImage
import rsgislib from rsgislib import imageutils imageutils.stretchImage('out_hhhvratio_stack.kea, 'out_hhhvratio_stack_scale.kea', \ False, '', True, False, 'GTiff', rsgislib.TYPE_8INT, imageutils.STRETCH_LINEARSTDDEV, 2)
This will create a tiff with values between 0 – 255 (8 bit), suitable for display in GIS packages or graphics programs such as Photoshop / GIMP.
Script for ALOS PALSAR tiles
For the 1×1 degree 25 m resolution ALOS PALSAR tiles, which can be freely downloaded from http://www.eorc.jaxa.jp/ALOS/en/palsar_fnf/fnf_index.htm for 2007 – 2010. A script (create_palsar_tiles_rgb.py) is available from RSGIS Scripts on Bitbucket. The script will also untar files, and can be run on downloaded data using:
python create_palsar_tiles_rgb.py —unzip downloaded_palsar_files
The script will untar each tile into a separate directory, create temp files for the ratio image and stack and save a tiff in with the original date files in the following structure:
N63W165_10_MOS |-----N63W165_10_MOS.tar.gz - Original tar.gz |-----N63W165_10_MOS_composite.tif - Composite generated |-----N63W165_10_date - Acquisition date of each pixel |-----N63W165_10_date.hdr |-----N63W165_10_linci - Local incidence angle for each pixel |-----N63W165_10_linci.hdr |-----N63W165_10_mask - Data / no-data mask |-----N63W165_10_mask.hdr |-----N63W165_10_sl_HH - HH data (DN) |-----N63W165_10_s1_HH.hdr |-----N63W165_10_sl_HV - HV data (DN) |-----N63W165_10_s1_HH.hdr
The resulting tiff will be something like the example below (Alaska; 63N165W)
To apply the same stretch to multiple files a text file can be used with the minimum and maximum values for each band. For example:
#stddev #band,img_min,img_max,out_min,out_max 1,48.4992,9286,0,255 2,396,4823.89,0,255 3,0.0181456,0.449104,0,255
This stretch file is specified using:
python create_palsar_tiles_rgb.py --unzip --stretchtxt stats.txt downloaded_palsar_files
It is also possible to create a stack using the coefficient of variance as the third band using:
# Coefficient of variance HH python create_palsar_tiles_rgb.py --unzip --CoVHH downloaded_palsar_files # Coefficient of variance HV python create_palsar_tiles_rgb.py --unzip --CoVHV downloaded_palsar_files