Skip to content

all_touched=True unexpected behavior #167

Closed Answered by snowman2
ivanhigueram asked this question in Q&A
Discussion options

You must be logged in to vote

If you look at the values:

{
    "original": numpy.unique(original_raster.index).tolist(),
    "all_touched": numpy.unique(all_touched_raster.index).tolist(),
}

all_touched=True appears to fill in the nan values at the edges:

{'original': [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, nan],
 'all_touched': [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]}

I created a raster diff layer on top of the origin input polygons to illustrate the differences between the two and it appears to work as expected.

Difference mask:

different_mask = all_touched_raster.index != original_raster.index

Raster all_touched=False where it is different from all_touched=True overlayed on the original shapefile:

original_raster.index.where

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by snowman2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants