爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4345|回复: 0

[求助] IDL批量提取图像DN值出错,求助!谢谢!

[复制链接]

新浪微博达人勋

发表于 2017-6-28 21:17:11 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
大家好!我想用idl通过经纬度批量提取遥感图像的dn值,参考了http://blog.sina.com.cn/s/blog_942ff76e0102v406.html的帖子,但我在批量处理的时候,总是出现这个错误:Object reference type required in this context: MAPINFO.请各位大神帮忙看一下,问题出在哪?请指导一下,谢谢!
  1. pro Extrat_TIFDN3
  2. Compile_opt IDL2
  3. ENVI,/RESTORE_BASE_SAVE_FILES
  4. ENVI_BATCH_INIT

  5. directory = 'E:\Data\modis\tif\'
  6. product = '*AOT.tif'
  7. files = file_search(directory + product)
  8. ;beijing
  9. longitude=116.381
  10. latitude=39.977
  11. for i=0,n_elements(files)-1 do begin
  12. ;Convert to the Projection as same as the Imput Image
  13. ENVI_OPEN_FILE,files[i], r_fid=fid ;1. Retrieve the Pojection Info from Input Image
  14. ENVI_FILE_QUERY, fid, dims=dims;some parameters will be used to get data
  15. ProjInfo=ENVI_GET_PROJECTION(fid=fid)
  16. OriProj=ENVI_PROJ_CREATE(/geographic) ;2. Original projection of Lon/Lat
  17. ENVI_CONVERT_PROJECTION_COORDINATES,longitude,latitude, OriProj,otX, otY, ProjInfo ;3. Process of Convert

  18. ;;Extract the Col & Row for the input Geoinfo
  19. mapinfo=ENVI_GET_MAP_INFO(fid=fid) ;1. Geolocation of Upper Left Point (0, 0) of the Input Image
  20. print,mapinfo
  21. <FONT color=red>ULlon=mapinfo.mc(2) :出错!!!  Object reference type required in this context: MAPINFO.</FONT>
  22. print,ULlon
  23. ULlat=mapinfo.mc(3)
  24. Xsize=mapinfo.PS(0) ;2. X/Y Size of the Input Image
  25. Ysize=mapinfo.PS(1)
  26. Row=(otX-ULlon)/Xsize ;3. Calculate the Number of Col & Row
  27. Coll=(otY-ULlat)/Ysize
  28. Row=fix(abs(Row)) ;Subscript directly from 0
  29. Coll=fix(abs(coll))

  30. tiff=Read_Tiff(files[i], GeoTIFF=GeoVar)
  31. NC_DN=tiff(Row, Coll)
  32. print,NC_DN
  33. endfor

  34. envi_batch_exit
  35. print,'job done!'

  36. end
复制代码

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表