i work with EVI MODIS and i need to stack all raster i had using python but i don't know how

i'm using this backag and script to read my rasters

    import os
    import glob
    from osgeo import gdal
    import numpy as np
    import matplotlib.pyplot as plt
    import scipy.ndimage
    import pandas as pd
    import datetime as dt
    import rasterio as rio

    #repertoire de travail 

    inDir = r'D:\MODIS\Doy2000/'
    #repertoir sorti 

    outDir = os.path.normpath(os.path.split(inDir)[0] + os.sep + 'output') + '\\' 
    if not os.path.exists(outDir): os.makedirs(outDir)

    # Create list of MODIS rasters for surface reflectance
    modis_EVI = glob.glob('MOD13Q1.006__250m_16_days_EVI_**.tif')


but idon't know how stack all my raster in python need help i'm very new in python

  • Use gdal_merge. There are many suggestion how to do it in documentation of this function. Dec 31, 2018 at 19:34
  • start here: gis.stackexchange.com/questions/32995/… and also look at numpy.dstack Dec 31, 2018 at 19:57
  • @MarcPfister i need to transform all my rasters to array with numpy that first step ? sorry my english
    – Tiera Eyek
    Jan 1, 2019 at 17:23
  • @DiogoCaribé i need documentation
    – Tiera Eyek
    Jan 1, 2019 at 17:23
  • See here gdal.org/gdal_merge the input you need to use regular expression in order to add all bands Jan 1, 2019 at 17:47


Browse other questions tagged or ask your own question.