IDL defines (divides) over-range pixel values according to conditions (artificial)

Pixel-by-pixel method (troublesome, space-consuming):

inData = read_tiff(inputfile,GEOTIFF=Geovar,INTERLEAVE=2)
iSize = size(inData,/DIMENSIONS)
iNs = iSize[0]
iNl = iSize[1]
outData = fltarr(iNs,iNl)
for ii = 0,iNs-1 do begin
  for ij = 0,iNl-1 do begin
    if outData[ii,ij]  le 0  then begin
      outData[ii,ij] = 1
    endif else begin
      outData[ii,ij] = 2
    endelse
  endfor
endfor

Index method:

bgIdx=WHERE(inData le 0,bgCnt)
IF bgCnt GT 0 THEN BEGIN
  inData[bgIdx]=!VALUES.F_NAN 
ENDIF
Released six original articles · won praise 1 · views 5463

Guess you like

Origin blog.csdn.net/aGang_Gg/article/details/86690355