注册 登录
  • 注册时,本站名称为:RGB空格3S博客,注意中间的空格。
  • 2018.10.14本人利用业余时间接遥感数据处理与编程小活,欢迎骚扰,QQ:853060844
  • 2018.8.14本站全面接入google广告
  • 本人闲暇时间(周末及其他闲暇时间)接遥感图像处理与IDL编程小活,欢迎骚扰,qq:853060844
  • 2017.2.14今天收到45条恶意评论(全是外文),故评论时请填写必要信息,匿名评论全部拉黑,迫不得已而为之
  • 2017.1.27,2017年春节及至,我谨代表本人祝大家新春快乐,本人年终总结文章请访问:2016年终总结
  • 为防止恶意转载,本站全面禁止复制,并添加图片水印:RGB 3S博客www.ixxin.cn。
  • 本站正式更名为RGB 3S博客,本站将撤消所有非3S内容,其将转移到新博客江湖时代

IDL处理Himawari8-NC数据

ID L admin 338次浏览 已收录 0个评论
[隐藏]

首先是处理Himawari8数据的一个函数,当然了只处理可见光与短波红外波段:

;;
; 宿鑫(XXIN,www.ixxin.cn)
; 2017
; Himawari8 NC 转换为 ENVI格式
; 参数:
; NCFile:Himawari8 NC文件
; shpfile : 裁剪矢量
; save_dir : 保存目录
; GPL开源协议(https://opensource.org/licenses/GPL-3.0):
;;<H8_NC2ENVI>  Copyright (C) <2018>  <suxin>

;;This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
;;This is free software, and you are welcome to redistribute it
;;under certain conditions; type `show c' for details.
;;

Pro H8_NC2ENVI,NCFile = NCFile,shpfile = shpfile,save_dir = save_dir

  COMPILE_OPT IDL2
  e = envi(/headless)
  ;envi,/RESTORE_BASE_SAVE_FILES
  ;envi_batch_init
  
  restore,filepath('RasterSubsetViaShapefile.sav',root_dir = file_dirname(routine_filepath('H8_NC2ENVI')))

  dir = file_dirname(NCFILE)+'\'
  name = file_basename(NCFILE,'.nc')
  save_dir = save_dir+'\'
  envi_file = save_dir+name+'_ENVI_all.dat'
  latfile = save_dir+name+'_ENVI.dat'
  openw,lun,envi_file,/GET_LUN
  
  names1 = ['/SAA','/SAZ','/SOA','/SOZ']
  for i = 0,3 do begin
    tmp_data = H5_GETDATA(NCFile, names1[i])*0.01
  
    writeu,lun,tmp_data
    dim = tmp_data.dim
    tmp_data = 0
  endfor

  names2 = ['/albedo_01','/albedo_02','/albedo_03','/albedo_04','/albedo_05','/albedo_06']  
  for i = 0,5 do begin
    tmp_data = H5_GETDATA(NCFile, names2[i])*0.0001
    writeu,lun,tmp_data
    tmp_data = 0
  endfor
 
  free_lun,lun
  
  ns = dim[0]
  nl = dim[1]
  nb = 10
  bnames = [names1,names2]
  
  mc = [0.0,0.0,80.0,60.0]
  ps = [0.05,0.05]
  map_info = ENVI_MAP_INFO_CREATE(/GEOGRAPHIC,mc = mc,ps = ps,DATUM='WGS-84')
  
  ENVI_SETUP_HEAD,fname = envi_file,ns = ns,nl = nl,nb = nb,DATA_TYPE=4,INTERLEAVE=0,$
    map_info = map_info,BNAMES=BNAMES,/WRITE
    
  envi_open_file,envi_file,r_fid = fid
  
  if ~N_ELEMENTS(shpfile) then begin
    print,'H8NC2ENVI IS OK'
    return 
  endif
    
  RasterSubsetViaShapefile,fid,shpfile = shpfile,r_fid = r_fid,outFile = latfile

  envi_file_mng,id = fid,/REMOVE,/DELETE
  ENVI_FILE_MNG,id = r_fid,/REMOVE

  ;ENVI_BATCH_EXIT
  print,'Subset,OK'
    
end

然后是调用这个函数进行批处理:

;;
; 宿鑫 (suxin,www.ixxin.cn)
; 2017
; 批处理
; 
; GPL开源协议(https://opensource.org/licenses/GPL-3.0):
;;<h8_nc2envi_Batch>  Copyright (C) <2018>  <suxin>

;;This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
;;This is free software, and you are welcome to redistribute it
;;under certain conditions; type `show c' for details.
;;

Pro h8_nc2envi_Batch

  COMPILE_OPT IDL2
  
  dir = 'I:\Rs_data\FY4\Data\Himawari8'
  save_dir = 'I:\Rs_data\FY4\Data\Himawari8'
  shpfile = 'I:\H8\SHP\zhanghan\china_wgs84.shp'
  ;dir = ENVI_PICKFILE(title = '请选择Himawari8文件夹',/DIRECTORY)
  ;shpfile = ENVI_PICKFILE(title = '请选择shp文件')
  ;save_dir = ENVI_PICKFILE(title = '请选择输出文件夹',/DIRECTORY)
  
  file_mkdir,save_dir 
  files = file_search(dir,'*.nc',count = count) 
  print,count 
  for i = 0, count-1 do begin
    H8_NC2ENVI,NCFile = files[i],shpfile = shpfile,save_dir = save_dir
    ;H8_NC2ENVI,NCFile = files[i],save_dir = save_dir
  endfor
end

处理结果图(中国区域)

重要

支持博主的点击一下网站头部与底部的广告哦,扫一下支付宝红包。


如有问题,请发邮件到:s_xxin@qq.com


xxin blog , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明IDL处理Himawari8-NC数据
喜欢 (0)
支付宝[853060844@qq.com]
分享 (0)
admin
关于作者:
坐标山科大遥感系小鲜肉一枚。
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址