I'm writing a bash script to warp all the rasters in a specific directory to match another raster. I'd like to warp all these rasters iteratively in to match the other raster in all was except shape and boundries. At the most basic level I just want to warp the reprojection and upsample the resolutions to match.
tempA2 (primary raster) is raster of a specific region in the US. The files (secondary rasters) I'm warping are lower resolution rasters of the entire US.
Using the following code
for file in *.bil; do rio warp "$file" /media/warped/warped-"$file" --like /media/templates/tempA2.tif --resampling nearest --co compress=LZW --overwrite ; done
does everything I need, but also clips (I think you GIS people call that masking?) the raster of the US to the same region as the original. In fact it seems to do this first and overzealously at the boundries which sucks for the lower resolution raster that's then increased in resolution.
I'd manually specify the resolution and crs in warp and not use the "--like" flag, however I have different primary rasters and I'd like to have the same bash script be iterable without modification. I suspect I could pipe out the metadata of the primary raster minus the boundaries and shape somehow, then pipe that metadata in for the warping of the secondary rasters, but I have no idea how to pull this off.