I have different folders containing Landsat 8 bands. I want to stack them into a single raster file. ArcPy can not be downloaded. Is there any other way to do that?
I have this snippet for the code
import os, numpy as np, rasterio as rs, matplotlib.pyplot as plt, earthpy.spatial as es, earthpy.plot as ep
from glob import glob
landsat_path = glob(
"/Users/admin/Downloads/LC08_L2SP_028030_20220628_20220706_02_T1/LC08_L2SP_028030_20220628_20220706_02_T1_SR_B[1-7].TIF"
)
sorted_path = sorted(landsat_path)
print(sorted_path)
arr_st, meta = es.stack(sorted_path, nodata=-9999)
print(arr_st[1])
ndvi = es.normalized_diff(arr_st[4], arr_st[3])
titles = ["Landsat 8 - Normalized Difference Vegetation Index (NDVI)"]
ep.plot_bands(ndvi, cmap="RdYlGn", cols=1, title=titles, vmin=-1, vmax=1)
But I want to run it in every folder. Even if I get to stack them in a different folder I can try to run the NDVI generation.