After a comment was made here I was reminded of this question. After a while I was able to solve my issues, I wrote a little tutorial of how to export imagery in my github page, but the most relevant to me was the following:
- Defining my arearea to be clipped didn't worked after using
bounds
, so I ended up doing the following to convert the patch around the pixel to anee.Geometry.Rectangle
object:
region= point.buffer(len/2).bounds().getInfo()['coordinates']
#defining the rectangle
coords=np.array(region)
#taking min and maxs of coordinates to define the rectangle
coords=[np.min(coords[:,:,0]), np.min(coords[:,:,1]), np.max(coords[:,:,0]), np.max(coords[:,:,1])]
rectangle=ee.Geometry.Rectangle(coords)
The rest of the problems were associated to the arguments used when exporting the function. To clip the image, I used
image.filterBounds(rectangle).mean()
, where image is anee.ImageCollection
object, andrectangle
is the previously defined geometry. Usingmean()
converts this to anee.Image
object.With that done, I added the following arguments to either the
ee.batch.Export.image.toDrive
oree.batch.Export.image.toCloudStorage
besides the obvious ones (like the image we are exporting or the destination of the file:region=str(region)
to pass the previous list of coordinates of the geometry as a string.dimensions="33x33"
to pass the number of pixels to be included in the image.
When the image was exported to either of the sources, I used the
imageio
package, and did something likenp.array(imageio.imread(image_path))
to convert the image fromTIFF
to annp.array
.