I'm using Python in my research and how I don't have large experience in this language, I need Help to understand this error that occur when I`ll write a array as raster file.
data_res_b1_corrected = [np.zeros((col1, row1), np.float32)]
data_res_b1_corrected = (data_res_b1 - (coef_red_nir * (subt_nir_nir_med)))
print(data_res_b1_corrected.shape)
output1 = res_b1.GetDriver().Create('D:/CESAR_PHD/10.Lyzenga/output/Reservoir_RED_corrected.tif', col1, row1, 1, gdal.GDT_Float32)
output1.SetGeoTransform(geoT)
output1.SetProjection(proj.ExportToWkt())
output1.GetRasterBand(1).WriteArray(data_res_b1_corrected)
output1.FlushCache()
The error occur when I`ll run this line: "output1.GetRasterBand(1).WriteArray(data_res_b1_corrected)"
The console returns: ValueError: expected array of dim 2
print(data_res_b1_corrected.shape)
?data_res_b1_corrected = np.array(np.zeros((col1, row1), np.float32))
otherwise you are creating a list