Stack Overflow for Teams is moving to its own domain! When the migration is complete, you will access your Teams at stackoverflowteams.com, and they will no longer appear in the left sidebar on stackoverflow.com.
Check your email for updates.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Make sure both rasters are in the same CRS. The trick to get the whole extent is to create a virtual raster.
In case the initial rasters contain nodata values, use Fill nodata cells on both rasters ...
There are several suggestions regarding your code:
work with os.path package and its methods: basename, exists, join, and normpath
TIFF is a raster dataset containing one or more layers called bands....
I think creating a window from the bounds of the larger raster then using that window with boundless=True to read the smaller raster should work.
window = rasterio.windows.from_bounds(*...
I think it's easier to use GDAL raster calculator. I execute the tool manually once in QGIS, press Ctrl+Alt+H and copy the command. Then write the loop.
To create the output names you can use layer....