I want to convert a google earth image to a numpy array and use Google Earth Engine's Reducer.toList
operation. But the size of array I get is different than the size of image as I see in image metadata. Below is the code. I have a sentinel 2 image that I clip it to an area and then look at clipped image dimensions, which will be 11x12. However, reducing it will give me an array of 11x11 elements (the resolution of sentinel band B2 is 10 meters and I mentioned in in reducer parameters). What is the problem with different results?
area = ee.Geometry.Polygon(
[[[105.532, 19.059], [105.533, 19.059], [105.533, 19.060], [105.532, 19.060], [105.532, 19.059]]])
image = ee.Image("COPERNICUS/S2/20160209T034234_20160209T090731_T48QWG").select('B2')
image_clip = image.clip(area)
info = image_clip.getInfo()
dims = info['bands'][0].get('dimensions')
print(dims)
# Will give us [11, 12] -> 132 pixels
reduced = image.reduceRegion(
reducer=ee.Reducer.toList(),
geometry=area,
maxPixels=1e8,
scale=10);
data = np.array(reduced.get('B2').getInfo())
print(data.size)
# Will give us a list of 11x11 = 121 pixels