For testing, I just load a sub-region of the band - 100*100pixels. The result I got was promising, with 10,000 values (digital numbers). But after I plot it in QGIS, it is strange. Different values should have different grayscales/colors, but you could see that every four neighbor pixels are exactly the same color.
I changed the symbology with “unique value” to better distinguish the grayscales. Now you can clearly see that four different pixels share the same color:
Please beware that I cannot say much about how rioxarray_open.rasterio reads jp2 files, but one thing that strikes me as a possible cause of error is the measure: B04 (red band) is provided at 10m resolution, while in your case it seems the values were read at 20m.
You can use EOBrowser to check that the values you get with Sentinel-2 are different at 10m scale (for 10m bands, of course).
Sentinel Hub QGIS plugin shows differences in B04 at 10m resolution as well:
hi Matej, thanks for your quick reply. I understand the resolution of B04 is 10m. In the screenshot I actually showed 2x2 pixels in 20mx20m which means each pixel is still 10m.
Each Digital Number represents one pixel (10x10) and should show one grayscale(or say color), while here we see four pixels (20x20) shows one color. So I was confusing
Yes, I understand. What I wanted to say is that perhaps what was actually read (in your case) was 20x20 m resolution, and then “upscaled” to 10x10. I don’t know how rioxarray_open.rasterio reads JP2 data, but as jpeg2000 is wavelet transformed data, it would be possible that only penultimate “level” was read.
With EOBrowser and my QGIS screenshot I wanted to show that retrieving data from Sentinel Hub (at appropriate resolution!) you get data at 10m pixels (when requesting 10m bands, of course).
I just downloaded another original/unprocessed Sentinel data to have a look at its Band08’s pixel size. It’s strange that the size is indeed 10m at EO Browser but in qgis it is still showing 20m… It seems like it’s the problem from the Sentinel bands themselves.