Stitching overlapping xarray patches by coordinates #776
Unanswered
MartinSJRogers
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have a list of xarrays that are patches of one larger xarray image. These patches are outputs from a deep learning network at inference time. I would like to stitch these together, akin to using xr.combine_by_coords, however because these patches overlap, I get an error if I use this method:
ValueError: Resulting object does not have monotonic global indexes along dimension x
When stitching overlapping patches together, I would like to use a weighted average function, whereby less weighting is given to pixels that are further from the centre of the patch. This is because these edge pixels are likely to contain artificial artefacts that would affect the quality of the model prediction.
Concretely, I want the weighting to look a bit like the image below. The areas in yellow (value = 1) are where there is no overlap between patches in the centre of the patch, so the network output will take the values of the patch (i.e. multiply the values of the pixels in the centre of the patch by 1). At the borders of the patch, where the patch overlaps with other patches, the value drops linearly to 0.
To confirm, all patches have the same variables, coordinates, dimensions etc, so there should be no other issues pertaining to their concatenation. Thanks in advance for looking at this question, any help appreciated.
Beta Was this translation helpful? Give feedback.
All reactions