stack raster using GDAL and numpy dstack

المشرف العام

Administrator
طاقم الإدارة
I am testing Savitzky-Golay filter with my MODIS dataset. Currently I am testing for 10 rasters (but later on will use my whole dataset) only just to test how should I create my script. So my initial workflow is to: 1) Access my raster files2) each file I need to convert to 2D array using GDAL or GDAL Numeric3) Append all those created 2D arrays to a list4) Implement numpy.dstack() to stack my 2D arrays and hopefully I can begin some analysis.

However, I getting error in the 4th step (it says memory error) -- converting my list of 2D arrays to a stack. Could you guide me some advice how to proceed. I am just building my script so for now its not so much. please see below. Thanks.

import os, sysimport gdal, numpy as npimport gdalnumeric as gdfrom scipy.signal import savgol_filterrasters = list()ws = 'G:/Test/Raster'for folder, subs, files in os.walk(ws): for filename in files: aSrc = gd.LoadFile(os.path.join(folder,filename)) rasters.append(aSrc)stackRast = np.dstack(rasters)Any help will be appreciated.

Thanks,-Leo



أكثر...
 
أعلى