How do I manually pansharpen specific band, e.g. RED?

Home > Frequently Asked Questions > How do I manually pansharpen specific band, e.g. RED?

True color pansharpening can be implemented in Custom script in the following way:

weight = (B04 + B03 + B02 * 0.4) / 2.4;

if (weight == 0) {
return [0, 0, 0];
}
ratio = B08/weight * 2.5;
return [B04*ratio, B03*ratio, B02*ratio];

If one wants to pansharpen just RED band, it goes along the similar way:

weight = (B04 + B03 + B02 * 0.4) / 2.4;

if (weight == 0) {
return [0, 0, 0];
}
ratio = B08/weight * 2.5;
return [B04*ratio];