Skip to content

Computing spyndex indices #194

Answered by guillemc23
guillemc23 asked this question in Q&A
Discussion options

You must be logged in to vote

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__":
…

Replies: 1 comment

Comment options

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