I need to fix a raster that's been inappropriately resampled along the nodata edge. The bad data area is narrow, pretty much a single cell. The value range is too variable to use a simple "erase less than 20" kind of logic. How can I fix this?
I'm partial to a GDAL command line utilities or QGIS solution, but anything goes.
In the past I've used Gimp or Photoshop for this (magic wand select nodata with 0 tolerance, expand selection by 1 or 2px, delete, save, restore georeferencing), but I can't do that here. The image is 16bit (a DEM) which photo tools don't handle well (Gimp not at all) and at 4gb the image is too large to manage comfortably anyway.
In figure 1 black is the bad data to be removed, in figure 2 black is to be retained, but it's acceptable to lose 1 or 2 pixels.
Update: figure 3 close up showing cell values. A de-collaring tool like nearblack doesn't work because bad values are within valid value range, and often nowhere near black or white.
I've put samples from the dataset here: http://files.environmentyukon.ca/matt/gis-stack/expand-raster-nodata-area/
Update 2: remove Gdal/Qgis focus.