Dst_Array = dst.ReadAsArray() print("Shape of distnation raster Before matching = " + str(Dst_Array.shape)) ### Match the alignment of both rasters NewRasterB = Raster.MatchRasterAlignment(src, dst) NewRasterB_array = NewRasterB.ReadAsArray() print("Shape of distnation raster after matching = " + str(NewRasterB_array.shape)) message = "Error the shape of the result raster does not match the source raster" assert NewRasterB_array.shape[0] == src_Array.shape[ 0] and NewRasterB_array.shape[1] == src_Array.shape[1], message ### Match the NODataValue NewRasterB_ND = Raster.MatchNoDataValue(src, NewRasterB) NoDataValue = NewRasterB_ND.GetRasterBand(1).GetNoDataValue() assert src.GetRasterBand( 1).GetNoDataValue() == NoDataValue, "NoData Value does not match" # NewRasterB_ND_array =NewRasterB_ND.ReadAsArray() # f = NewRasterB_ND_array[NewRasterB_ND_array == NoDataValue] # g = src_Array[src_Array == NoDataValue] #%% Raster.SaveRaster(NewRasterB_ND, SaveTo)