Yet again, working with that Ohio DEM dataset, I need some reduced resolution versions of the 2.5 foot DEMs. At a grand total of ~600 DEMs for a given county, it was time to batch, this time in Windows Command prompt. The neat thing is the variable substitution in the for-in-do command in the command prompt, where, e.g. for a file variable %f, the file name, minus extension can be invoked with %~nf. As I write this, I realize that I didn’t strictly need that variable for this dataset, as they were ESRI Grids, so they have no extension to trim off… . Hehe. I think I was being stupidly clever. But, well, trim off the /D flag, and you can use this with any file extension… . So, ya. This is the more generic solution… .
I use bilinear resampling below for each tier from half the resolution. Why bilinear when there are fancy resampling methods available? I trust bilinear to do exactly what I want, and that is create an averaged tier that can be overlayed with the original data 100% (knock on wood… .). I can quantify it’s behavior at each tier. In other words, I’m fussy, and I understand bilinear, and haven’t invested the time to find out if I like anything else… .
for /D %f in (n*) do gdalwarp -tr 5 5 -r bilinear %f resampled\%~nf_05.tif for /D %f in (n*) do gdalwarp -tr 10 10 -r bilinear resampled\%~nf_05.tif resampled\%~nf_10.tif for /D %f in (n*) do gdalwarp -tr 20 20 -r bilinear resampled\%~nf_10.tif resampled\%~nf_20.tif for /D %f in (n*) do gdalwarp -tr 40 40 -r bilinear resampled\%~nf_20.tif resampled\%~nf_40.tif for /D %f in (n*) do gdalwarp -tr 80 80 -r bilinear resampled\%~nf_40.tif resampled\%~nf_80.tif for /D %f in (n*) do gdalwarp -tr 160 160 -r bilinear resampled\%~nf_80.tif resampled\%~nf_160.tif