Skip to main content
added 272 characters in body
Source Link
fluidmotion
  • 1.9k
  • 10
  • 16

should RasterCount be a parameter within mem_drv.Create? - if that is removed, then fetch the band and write the new array? something something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)

# see edit comment
#band

EDIT: oh, i see it here - i didn't see the destination raster as a parameter to ReprojectImage at first - hopefully the above change will help. i was originally thinking of re-interpolating the array, then writing it to the dest raster band -

band = dest.GetRaseterBandGetRasterBand(1)
#resres = gdal.ReprojectImage( DEM, dest, \
#        DEM.GetProjection(), DEM.GetProjectionSomeReInterpolationFunction(**kwargs), \
# if this were a custom function to gdal.GRA_Bilinearinterpolate )an array
#bandband.WriteArray(res)

if res is the newly interpolated array?

EDIT: oh, i seethough it here - perhaps you don't need to write the banddoesn't appear to the memory raster, the dest raster is a parameterbe needed in gdal.Reproject. So hopefully removing RasterCount from the Create method would helpthis case.

should RasterCount be a parameter within mem_drv.Create? - if that is removed, then fetch the band and write the new array? something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)

# see edit comment
#band = dest.GetRaseterBand(1)
#res = gdal.ReprojectImage( DEM, dest, \
#        DEM.GetProjection(), DEM.GetProjection(), \
#        gdal.GRA_Bilinear )
#band.WriteArray(res)

if res is the newly interpolated array?

EDIT: oh, i see it here - perhaps you don't need to write the band to the memory raster, the dest raster is a parameter in gdal.Reproject. So hopefully removing RasterCount from the Create method would help.

should RasterCount be a parameter within mem_drv.Create? something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)

EDIT: oh, i see it here - i didn't see the destination raster as a parameter to ReprojectImage at first - hopefully the above change will help. i was originally thinking of re-interpolating the array, then writing it to the dest raster band -

band = dest.GetRasterBand(1)
res = SomeReInterpolationFunction(**kwargs) # if this were a custom function to interpolate an array
band.WriteArray(res)

though it doesn't appear to be needed in this case.

added 272 characters in body
Source Link
fluidmotion
  • 1.9k
  • 10
  • 16

should RasterCount be a parameter within mem_drv.Create? - if that is removed, thethen fetch the band and write the new array? something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)
band
# see edit comment
#band = dest.GetRaseterBand(1)
res#res = gdal.ReprojectImage( DEM, dest, \
#        DEM.GetProjection(), DEM.GetProjection(), \
#        gdal.GRA_Bilinear )
band#band.WriteArray(res)

if res is the newly interpolated array?

EDIT: oh, i see it here - perhaps you don't need to write the band to the memory raster, the dest raster is a parameter in gdal.Reproject. So hopefully removing RasterCount from the Create method would help.

should RasterCount be a parameter within mem_drv.Create? - if that is removed, the fetch the band and write the new array? something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)
band = dest.GetRaseterBand(1)
res = gdal.ReprojectImage( DEM, dest, \
        DEM.GetProjection(), DEM.GetProjection(), \
        gdal.GRA_Bilinear )
band.WriteArray(res)

if res is the newly interpolated array?

should RasterCount be a parameter within mem_drv.Create? - if that is removed, then fetch the band and write the new array? something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)

# see edit comment
#band = dest.GetRaseterBand(1)
#res = gdal.ReprojectImage( DEM, dest, \
#        DEM.GetProjection(), DEM.GetProjection(), \
#        gdal.GRA_Bilinear )
#band.WriteArray(res)

if res is the newly interpolated array?

EDIT: oh, i see it here - perhaps you don't need to write the band to the memory raster, the dest raster is a parameter in gdal.Reproject. So hopefully removing RasterCount from the Create method would help.

Source Link
fluidmotion
  • 1.9k
  • 10
  • 16

should RasterCount be a parameter within mem_drv.Create? - if that is removed, the fetch the band and write the new array? something like:

dest = mem_drv.Create('', x_size, y_size, 1, gdal.GDT_Float32)
band = dest.GetRaseterBand(1)
res = gdal.ReprojectImage( DEM, dest, \
        DEM.GetProjection(), DEM.GetProjection(), \
        gdal.GRA_Bilinear )
band.WriteArray(res)

if res is the newly interpolated array?