日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

IDL实现MOD021KM 角度数据重采样中的易错点

發布時間:2024/3/26 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 IDL实现MOD021KM 角度数据重采样中的易错点 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最近很忙,每天都特別忙碌,也很少有時間去打球了。

祝愿大家一切都好,北京一切還好,就是北京物價很貴,沒有工資補助的我露出了卑微的笑容~

今天和大家分享的是IDL怎么讀取MOD021KM MYD021KM中的角度數據,將其重采樣到其他的反射率光譜數據的維數大小,即ns = 1354,nl = 2030.重要的是如何避免最容易錯的地方,直接po上程序來,如下:
本來我是批處理的,此處簡化,po出單景圖像的程序,亦可用(中間的其他經緯度代碼是我原來讀取的時候要用到的,沒有用但我就不刪除了)。

pro MODIS_angle_resize;***************************啟動ENVI批處理模式************************************time_begin = systime(1)compile_opt idl2envi,/restore_base_save_filesenvi_batch_initcd,'G:\MODIS_TOA_r_Original\'fnames = 'MOD021KM.A2018071.0240.061.2018071132914.hdf'out = modis_georef(fnames)envi_batch_inittime_end = systime(1)print,'running time :',(time_end-time_begin)/60.0,'mins' end ;***************************所調用的函數********************************************* function modis_georef,fn;在函數中也一定要加上編譯,否則主過程中的compile不會傳到函數中compile_opt idl2envi,/restore_base_save_files;打開文件hd_id = hdf_sd_start(fn);讀取文件數據集數量和屬性數量hdf_sd_fileinfo,hd_id,nsds,natts;選擇打開數據集lat_id = hdf_sd_select(hd_id,0)long_id = hdf_sd_select(hd_id,1)SOZ_id = hdf_sd_select(hd_id,16);*****************************************讀取經緯度數據值*********************************************hdf_sd_getdata,lat_id,Lathdf_sd_getdata,long_id,Lonhdf_sd_getdata,SOZ_id,SOZSOZ = SOZ*0.01;*****************************************SOZ角度重采樣**********************************************sz = size(SOZ)ns0 = sz[1]nl0 = sz[2];print,angle[58:60,69:71,3]envi_enter_data,SOZ,r_fid = SOZ_fid,ns = ns0,nl = nl0,nb= 1,data_type = 4,interleave = 0,offset = 0pos = lindgen(1)dims = [-1,0,ns0-1,0,nl0-1]outname = 'G:\MODIS_TOA_反射率\out1'xsize = ns0/1354.0ysize = nl0/2030.0envi_doit,'resize_doit',fid = SOZ_fid,dims = dims,pos = pos,interp = 1,rfact = [xsize, ysize],out_name =outname ,r_fid = r_fid;關閉數據集hdf_sd_endaccess,lat_idhdf_sd_endaccess,long_idhdf_sd_endaccess,SOZ_idhdf_sd_end,hd_id;關閉文件 end

易錯點1:
xsize = ns0/1354.0
ysize = nl0/2030.0
重采樣的時候設置的xsize和ysize必須是由原來的小size的圖像行列數比上最終要得到的重采樣后的圖像行列號(本程序中是采樣到對應的文件中1km反射率波段數據)的大小。或者如果想要擴n倍重采樣,則不需要比值,只需要設置:
xsize = 1/n.0
ysize = 1/n.0
一定要.0
易錯點2:
dims = [-1,0,ns0-1,0,nl0-1]
envi_doit,‘resize_doit’,fid = SOZ_fid,dims = dims,pos = pos,interp = 1,rfact = [xsize, ysize],out_name =outname ,r_fid = r_fid
在我們本科徐永明老師寫的《遙感二次開發語言IDL》書中’resize_doit’這個過程后,對于dims的說明是“重采樣后數據的空間范圍”,而實際上此處應該是待重采樣原始數據的dims,原始待重采樣的空間范圍。dims數組由一行五列元素組成,其中第一位如果不是用一個已經打開的ROI去重采樣的話,就默認用-1,后面四位見下:
DIMS
The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
DIMS[1]: The starting sample number. The first x pixel is 0.
DIMS[2]: The ending sample number
DIMS[3]: The starting line number. The first y pixel is 0.
DIMS[4]: The ending line number


版權歸作者 小白是哪個小白_ 所有,轉載、引用請注明鏈接出處,侵權必糾!

總結

以上是生活随笔為你收集整理的IDL实现MOD021KM 角度数据重采样中的易错点的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。