I have a few NumPy arrays: lat, lon, and 6 data bands. I'd like to convert these to GeoTiff and then apply the gdalwarp function, based on a specific projection, to each band.
Is there a standard way to do this in Python?
Can be done fairly easy. First, create the dataset:
drv = gdal.GetDriverByName("GTiff") ds = drv.Create("name.tif", width, height, 6, gdal.GDT_Float32)
You then need to set the geotransform using
ds.SetGeoTransform where the argument is a six element tuple:
(upper_left_x, x_resolution, x_skew, upper_left_y, y_skew, y_resolution)
Set the projection using
ds.SetProjection, argument is the way string, then
Write the array for the first band:
That should be enough to get you going. If the purpose is just to reproject the data, then you could look at using an in memory dataset