I am processing several large (>40GB) geotiffs with GDAL_CALC.py and I encountered this error when attempting the process:
Error! Dimensions of file image.tif (198000, 126000) are different from other files (198752, 126000). Cannot proceed.
This was the command I use to replace problem areas in a DEM with values from another DEM:
gdal_calc -A problem_areas.tif -B mosaic_A.tif -C fill_mosaic_B.tif --outfile=dem_corrected.tif --calc="((A!=999)*B)+((A>=999)*C)"
My rather convoluted solution is to produce a convex hull vector from one raster and then use that to clip it and all other rasters with gdalwarp, thus redefining the dimensions:
gdalwarp -q -cutline convex_hull.shp -tr 0.5 0.5 -of GTiff -srcnodata 0 -dstnodata 0 mosaicA.tif mosaicA_clipped.tif
I imagine each clip will take at least a day to process (one is processing slowly as I write this). Does anyone know if it is possible to calculate (using GDAL_calc.py) rasters that have different dimensions without resampling or clipping the rasters? Is there an easier way to avoid adjusting the dimensions, or is this the correct (albeit painful) approach? For instance, can the one problematic file be clipped to the dimensions of the other DEMs?