no data 옵션 주기
gdalbuildvrt -separate /vsistdout/ K3A_20210329110227_33179_00026559_L1G_PR.tif K3A_20210329110227_33179_00026559_L1G_PG.tif K3A_20210329110227_33179_00026559_L1G_PB.tif|gdal_translate /vsistdin/ K3A_0210329_110227_RGB_PS.tif
path : /nas/workspace/kbae/tool/shell/wv3_merge.sh
# wv3_merge.sh
BASE=/nas/Scenes/EO/WV3/Y2020/M06/D28/WV3_20200628_085131/RGB_PS
OUTPUT=WV3_20200628_085131
PS=_PS.TIF
RGB_PS=_RGB_PS.TIF
OUTPUT_PS=$BASE/$OUTPUT$PS
OUTPUT_RGB_PS=$BASE/$OUTPUT$RGB_PS
echo $OUTPUT_PS
echo $OUTPUT_RGB_PS
for image in $BASE/*.TIF; do
echo $image >> $BASE/list.txt
done
############# 8 bands 의 경우 ################
gdalwarp -multi -wm 1000 --optfile $BASE/list.txt $OUTPUT_PS && gdal_translate -b 5 -b 3 -b 2 $OUTPUT_PS $OUTPUT_RGB_PS
##############################################
chmod +x $OUTPUT_RGB_PS
rm $OUTPUT_PS
예시 코드
PATH_TO_WV3_IMAGES=/nas/Dataset/RSI_SS_SIA_SRCD/WV3/014327194010_colombo/
SUBPATH_TO_MULT_IMAGES=014327194010_01_P001_MUL/
SUBPATH_TO_PAN_IMAGES=014327194010_01_P001_PAN/
PATH_TO_OUTPUT=/nas/Dataset/RSI_SS_SIA_SRCD/WV3/014327194010_colombo/RGB_PS/
BASE=$PATH_TO_WV3_IMAGES
PATH_MULT=$SUBPATH_TO_MULT_IMAGES
PATH_PAN=$SUBPATH_TO_PAN_IMAGES
PATH_RESULT=$PATH_TO_OUTPUT
WV2_W='-w 0.095 -w 0.7 -w 0.35 -w 1.0 -w 1.0 -w 1.0 -w 1.0 -w 1.0'
WV3_W='-w 0.005 -w 0.142 -w 0.209 -w 0.144 -w 0.234 -w 0.234 -w 0.157 -w 0.116'
for mult_image in $BASE$PATH_MULT/*.TIF; do
filename=$(basename $mult_image)
pan_filename=$(echo "$filename" | sed -e 's/M2AS/P2AS/i')
pan_image=$BASE$PATH_PAN/$pan_filename
result_image=$PATH_RESULT/$filename
gdal_pansharpen.py -nodata 65535 $WV2_W $pan_image $mult_image $result_image
done
Path와 nodata는 영상에 맞춰 변경