1

I am using Landsat data to determine NDVI for a specific region of interest (roi). However, the roi has buildings and other artificial objects that I wish to mask.

I have followed through the example at Masking NetCDF time series data from shapefile using Python.

However, this method masks all data outside of the shapefile, and retains the data from inside of the shapefile.

Has anybody any solutions for doing the reverse of this, and thus masking the data INSIDE the shapefile?

1 Answer 1

1

https://corteva.github.io/rioxarray/stable/examples/clip_geom.html

You just need to pass in invert=True:

clipped = xds.rio.clip(......, invert=True)
2
  • Cheers @snowman2. Such a simple solution, and worked as expected.
    – turner__rs
    May 27, 2021 at 4:08
  • I am glad to hear that it worked 👍
    – snowman2
    May 27, 2021 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.