Computing spyndex indices #194
Answered
by
guillemc23
guillemc23
asked this question in
Q&A
-
I'm having a bit of trouble when computing indices from the Spyndex catalog for a Sentinel 2 product. Is there any example? I couldn't find them in the docs and I got a bit confused with EOReader indices and how they differ from the Spyndex ones 🤔 For example, I was able to replicate the example with the NDWI, but I'm unable to do the same with NBR |
Beta Was this translation helpful? Give feedback.
Answered by
guillemc23
Dec 18, 2024
Replies: 1 comment
-
I was having namespace issues, this should work as expected: from pathlib import Path
from eoreader.bands import BLFEI, NBR, NBR2, NDVI, NDWI, UI
from eoreader.reader import Reader
def main():
product_path = Path("S2A_MSIL2A_20240716T100601_N0510_R022_T33TUM_20240716T160254.SAFE")
reader = Reader()
prod = reader.open(product_path=product_path)
ndwi = prod.stack(NDWI, stack_path="NDWI.tiff")
ndvi = prod.stack(NDVI, stack_path="NDVI.tiff")
ui = prod.stack(UI, stack_path="UI.tiff")
blfei = prod.stack(BLFEI, stack_path="BLFEI.tiff")
nbr = prod.stack(NBR, stack_path="NBR.tiff")
nbr2 = prod.stack(NBR2, stack_path="NBR2.tiff")
if __name__ == "__main__":
main() Still I believe the docs have some outdated examples on this matter because of the old "EOReader Indices" vs "Spyndex Indices" :) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
guillemc23
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was having namespace issues, this should work as expected: