reproject from a tiff to another tiff gives "destination band 1 appears to be read only"


simonm3@...
 

Please can someone explain how I align a tiff file of lights with another of population to create two numpy arrays the same size and aligned. I tried:

    population = rio.open(population)
    lights = rio.open(lights)
    res = rio.warp.reproject(rio.band(lights,1), rio.band(population,1))

This gives "CPLE_IllegalArgError: Destination band 1 appears to be read-only."

I was expecting it to read the meta data (crs, height, width and affine transform) from source and destination then return something with the data of source but the shape of destination.

Join main@rasterio.groups.io to automatically receive all group messages.