I have been using QGIS with Sentinel2A imagery, and i just noticed something wierd to the extent of my knowledge which should have an explanation.

Consider the 3 bands of Sentinel2, 4,3,2 that are the Red, Green and Blue ones and the following steps:

  1. Lets make an RGB composite raster with QGIS GDAL Merge tool with the 3 full bands from the Sentinel imagery.
  2. Now crop the RGB output image to the extent of the desired region of interest (ROI) with GDAL Clip Raster by mask layer, inserting the ROI polygon and saving the output: "clippedFromWholeNDVI.tif" (default options are left intact).
  3. Now lets crop the 3 Sentinel bands to the extent of the ROI and then construct in the same way the RGB composite.

The results are different in regard to their values and visually.

Can you explain why this happens?

clippedFromWholeRGB fromClippedRGBfromClippedRGBMetadata clippedFromWholeRGBMetadata

  • It's not clear to me which Dataset information belongs to which. It seems you're converting to Float32 ... why? I guess that along the second path, you scale the data with per-band dynamic values. Do not scale them or scale them with absolut values. – pLumo Jul 6 '17 at 10:56
  • Thank you for the comment @RoVo , the first cropped image is the clipped from the whole RGB composite and goes with the right Metadata properties (Float32). The second cropped image is from the merging of the cropped bands and has the left Metadata with the UInt16 data type. I have redone everything for the purpose of the experiment, and all in original data type of UInt16, and the Metadata are still 100% the same with the change of Float32 to UInt16 of course. – ODstuck Jul 6 '17 at 13:03
  • How is the issue related with scaling (and please explain that some more, as I did not fully understand "you scale the data with per-band dynamic values. Do not scale them or scale them with absolut values")? OK, the dimensions are different. The cropped image from the full RGB composite has kept the original dimensions, as expected, assigning black values to all the pixels outside (but not as novalues pixels), while the composite from the cropped bands has kept the bands' dimensions as expected again. – ODstuck Jul 6 '17 at 13:06
  • With scaling I mean scaling the pixel values not the image dimensions. Sentinel2 has Values in a range from 0-10000, if you scale/stretch/normalize these values in each band individually regarding to its histogram, you will have different color at the end. When over land, you have usually less blue at the beginning, so after normalizing, you will have more blue. (Compare gdal_translate -scale option) – pLumo Jul 6 '17 at 13:10
  • I don't know how you introduced scaling in the first place, as you did not intend to do that, but that your data is Float32 makes me think something happenend, because the original data is UInt16 – pLumo Jul 6 '17 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.