More scripts: Raster

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
$warnings 3  # Set warning level 3
class RASTER R, R2;
GetOutputRaster(R2, NumLins(R), NumCols(R), RastType(R));
IgnoreNull(R);		# make sure the actual raster value is reported
array numeric mapto[255];
numeric i;
for i=0 to 255
	mapto[i]=i;	# if mapped values aren't set below the value in R2 will equal R's value
# below provide all mappings of the form: mapto[ input raster value ] = desired output value 
mapto[41] = 192;	# maps all values of 41 in R to 192 in R2
mapto[42] = 15;		# maps all values of 42 in R to 15 in R2
for each R2
    R2 = mapto[R];	# for each value in R, set R2 to the desired 'mapped' value
CopySubobjects(R, R2);	# copy all subobjects from R (georef, colormap, etc.) 
# comment next line out if null value not desired
SetNull(R2, 0);		# set the null value to the desired value (set to 0 here)