Merging EOPatches for Entire Sentinel-2 Scene

Hello everyone,

I’m trying to download and process entire Sentinel-2 scenes. I break the scenes into 25 tiles (using BBoxSplitter) in order to stay below the 2500 x 2500 pixel service call limit. What I would like to do next is combine these patches into one for further processing. When I was testing my workflow, I was doing this manually (using numpy.concatenate for the relevant arrays part of my eopatches, like BANDS-S2_L1C.npy, etc.) for smaller areas and that worked fine. However, for entire scenes, I’m running into the issue that the scenes are so large that the number of horizontal pixels are not the same at the bottom and the top of a scene. That makes sense, but I’m having a hard time thinking about how I should combine entire scenes. The differences are small of course, but I’m not sure if dropping columns would create other problems.

I saw ‘MergeEOPatchesTask’, but I’m a bit confused about the documentation and I can’t find any examples of its use. Is this what I’m looking for or is it doing something else?

I also saw this post: Get large area as one image, but I have my subtiles as eopatches, so I wasn’t sure how I can apply the steps detailed here.

I apologize if this is a basic question, but I’m having trouble with how to search for an answer, if it is. Any advice would be really appreciated!

Thank you so much!

Hi @papprika,

I recommend checking out task that can export an EOPatch feature into a GeoTiff. Then you can use gdal tools to merge GeoTiffs together as shown in the other post.

MergeEOPatchesTask is for merging EOPatches over time dimension but I believe you want to join them over spatial dimensions.

In eo-learn we don’t have tasks for merging EOPatches spatially. That is because this soon leads to problems of having sparse data arrays, problems with spatial misalignments, memory issues, parallelization issues, etc. The idea in eo-learn is therefore that you work with smaller EOPatches that are easier to process. Then only at the end, when you have results, you export them into GeoTiffs and join them together with gdal.