earthpy documentation code example
Example: earthpy
# Get data for example
data = et.data.get_data("vignette-landsat")
# Set working directory
os.chdir(os.path.join(et.io.HOME, "earth-analytics"))
# Stack the Landsat 8 bands
# This creates a numpy array with each "layer" representing a single band
# You can use the nodata= parameter to mask nodata values
landsat_path = glob(
os.path.join(
"data",
"vignette-landsat",
"LC08_L1TP_034032_20160621_20170221_01_T1_sr_band*_crop.tif",
)
)
landsat_path.sort()
array_stack, meta_data = es.stack(landsat_path, nodata=-9999)