I tried raster stacking using the below code.I tried to read pixel values at a particular coordinate and few values are coming as zero where as when I tried reading the value before stacking there is some pixel value at that particular coordinate. I don't understand why my raster stacking is causing the issue.
from rasterio import plot
import os
import earthpy.spatial as es
def image_stack(path, dest_file):
band_fnames = os.listdir(path)
band_paths = [path + fname for fname in band_fnames]
arr, arr_meta = es.stack(band_paths, dest_file)
return len(band_fnames)
es
? it gives me some errors. Could you please add the imports as well?listdir
will also list directories inpath
, you have only valid files inpath
?