You could sort the black-gray stuff out.
Just ignore every square with less than 10..20% of the max. value...
Each such square would be as big as a 4r*4r (r=radius of mex)
Even x/z: 0*4r, 1*4r, 2*4r
Odd x/z: 0*4r+2r, 1*4r+2r, 2*4r+2r
offset = 1: odd x, odd z & 2: even x, odd z & 3: odd x, even z & 4: even x, even z
for 1 to 4: insert into table: { x, z, metal } and update maxMetalFound if required.
Walk through generated table of { x, z, metal } and sort out every square with 10..20% metal or less.
Look in table-entries (=squares - or more exactly their offsets) for best metal coordinates.
Merge/Drop some overlapping mex-coordinates.