改善质量后的云层统计,第二部分

pro Part_7
  compile_opt idl2
  e=envi(/headless)
  cloud_all = float(0.0)
  pixel_all_69 = float(0.0)
  folder = "D:\Lansat_Data_Cloud_Final"
  envi_arr = file_search(folder,'*.dat',count=num)
  arr_out_put = strarr(4,70)
  for i=0,num-1,1 do begin
    envi_file = envi_arr[i]
    envi_name_length = strlen(envi_file)
    if (envi_name_length eq 34) then begin
      roi_number = strmid(envi_file,27,1)
      roi_number_int = fix(strmid(envi_file,27,1))
    endif else if (envi_name_length eq 36) then begin
      roi_number = strmid(envi_file,27,2)
      roi_number_int = fix(strmid(envi_file,27,2))
    endif
    cloud_pixel = long(0)
    raster = e.OpenRaster(envi_file)
    fid = ENVIRasterToFID(raster)
    MAP_INFO = ENVI_GET_MAP_INFO(fid=fid)
    ENVI_FILE_QUERY, fid, ns=ns, nl=nl, nb=nb, dims=dim, data_type=data_type
    data = raster.getdata()
    for l=0,ns-1,1 do begin
      for m=0,nl-1,1 do begin
        a=data[l,m]
        if (a eq 5) then begin
          cloud_pixel = cloud_pixel + 1
        endif
      endfor
    endfor
    cloud_all = cloud_all + cloud_pixel
    all_pixel = long(ns)*nl
    pixel_all_69 = pixel_all_69 + all_pixel
    percentage = (float(cloud_pixel)/all_pixel)*100
    arr_out_put[0,roi_number_int-1] = roi_number;ROI序号
    arr_out_put[1,roi_number_int-1] = string(all_pixel);总像素量
    arr_out_put[2,roi_number_int-1] = string(cloud_pixel);云像素
    arr_out_put[3,roi_number_int-1] = string(percentage);云百分比
    print,envi_file
  endfor
  percentage_final = (cloud_all/pixel_all_69)*100
  arr_out_put[0,69] = "ALL-ROI"
  arr_out_put[1,69] = string(pixel_all_69);总像素量
  arr_out_put[2,69] = string(cloud_all);云像素
  arr_out_put[3,69] = string(percentage_Final);云百分比
  txt_file = "D:\Lansat_Data_Cloud_Final\cloud_report.txt"
  openw,lun,txt_file,/get_lun
  printf,lun,arr_out_put
  free_lun,lun
  print,"----------------------OK!!!-----------------------------"
end

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值