Xarray应该能够为您完成concat步骤。我在下面稍微修改了您的示例。您可以将文件名解析为有用的内容。
import globimport pandas as pdimport xarray as xrdef time_index_from_filenames(filenames): '''helper function to create a pandas DatetimeIndex Filename example: 20150520_0164.tif''' return pd.DatetimeIndex([pd.Timestamp(f[:8]) for f in filenames])filenames = glob.glob('*.tif')time = xr.Variable('time', time_index_from_filenames(filenames))chunks = {'x': 5490, 'y': 5490, 'band': 1}da = xr.concat([xr.open_rasterio(f, chunks=chunks) for f in filenames], dim=time)


