IDL将0值设置为nodata

pro set_nodata

GPP=fltarr(720,360)

for i=1982L,2010L do begin 
 input_image='F:\P_SM_SPEI_GPP\Jung\GPP_JUNG\GPP_year\year\'+strtrim(string(i),02)+'.tif'
 GPP_image = read_tiff(input_image,Geotiff=Geotiff)
  for line=0,719 do begin
   for piex=0,359 do begin
   if (GPP_image[line,piex] le 0) then begin
    GPP[line,piex]=!VALUES.F_NAN
   endif else begin 
    GPP[line,piex]=GPP_image[line,piex]
   endelse
   endfor
  endfor
  output_file='F:\P_SM_SPEI_GPP\Jung\GPP_JUNG\GPP_year\year_nodata\'+strtrim(string(i),02)+'.tif'
  openw,lun,output_file,/get_lun
  write_tiff,output_file,GPP,Geotiff=Geotiff,/FLOAT
  free_lun,lun
  print,  i, '      OK!'
endfor

end

你可能感兴趣的:(IDL将0值设置为nodata)