批处理重投影MOD04_第1页
批处理重投影MOD04_第2页
批处理重投影MOD04_第3页
批处理重投影MOD04_第4页
批处理重投影MOD04_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、IDL 代码共享 -批处理重投影 MOD042011-03-31 19:44:49| 分类: 代码类 | 标签: |字号 大中小 订阅 ;+; :Description:; Describe the procedure.; Reproject MODISs mod04 to Lambert Conformal Conic.; :Params:; input_directory; output_directory; :Examples:; input_directory = c:mod04; output_directory = d:mod04_out; reproject_mod04, inp

2、ut_directory, output_directory ; :Author: dabinPRO reproject_mod04, input_directory, output_directoryCOMPILE_OPT IDL2ENVI, /RESTORE_BASE_SAVE_FILESENVI_BATCH_INIT, LOG_FILE = reproj_mod04.logIF STRCMP(STRMID(input_directory, 0, 1, /REVERSE_OFFSET), ) THEN BEGIN input_directory = input_directory + EN

3、DIFIF STRCMP(STRMID(output_directory, 0, 1, /REVERSE_OFFSET), ) THEN BEGIN output_directory = output_directory + ENDIFinput_filenames = FILE_SEARCH(input_directory + MOD04 + *.hdf)IF SIZE(input_filenames, /N_ELEMENT) GE 1 THEN BEGIN ;Output method schema is:;0 = Standard, 1 = Projected, 2 = Standard

4、 and Projected out_method = 1name = China_Lambert_Conformal_Conic datum = WGS-84params = 6378137.0, 6356752.3, 0.000000,$105.000000, 0.0, 0.0, 25.000000, 47.000000 type = 4out_projection = ENVI_PROJ_CREATE(TYPE = type, NAME = name, DATUM = datum,$PARAMS = params)interpolation_method = 6 swath_name =

5、 mod04 sd_names = Image_Optical_Depth_Land_And_Oceanfilecount = SIZE(input_filenames, /DIMENSIONS) FOR i = 0, filecount0 - 1 DO BEGINtmp_filename = input_filenamesi fname = getfilename(tmp_filename) out_rootname = STRMID(fname, 0, STRLEN(fname) - 4)CONVERT_MODIS_DATA, IN_FILE = tmp_filename, OUT_PAT

6、H = output_directory, $OUT_ROOT = out_rootname, /HIGHER_PRODUCT, /SWATH, $ SWT_NAME = swath_name, OUT_METHOD = out_method, $ INTERP_METHOD = interpolation_method, SD_NAMES = sd_names, $ NUM_X_PTS = 50, NUM_Y_PTS = 50, /NO_MSG, OUT_PROJ = out_projection, $BACKGROUND = 0.0, FILL_REPLACE_VALUE = 0.0 EN

7、DFORENDIFENVI_BATCH_EXITPRINT, Job Done!END以上程序运行用到 MODIS Conversion Toolkit, 下载地址:IDL 代码共享 -创建 GIF 动画2011-04-10 17:32:42| 分类: 代码类 | 标签: |字号 大中小 订阅 ;+; :Description:; Create a GIF animation.; :Params:; in_filenamelist- Filename list. The columns and rows of image in each must be same.; outfname- Out

8、put GIF filename.; :Keywords:; delay_time- Set this keyword to an integer giving the delay in hundredths (1/100) of a second after the decoder displays the current image. This keyword can be settoa different value for each image within the file.; :Usage:; file_list = E:IDLtestinputtiff3B42_030501_00

9、.tif, $;E:IDLtestinputtiff3B42_030501_03.tif, $;E:IDLtestinputtiff3B42_030501_06.tif, $;E:IDLtestinputtiff3B42_030501_09.tif, $;E:IDLtestinputtiff3B42_030501_12.tif, $;E:IDLtestinputtiff3B42_030501_15.tif, $;E:IDLtestinputtiff3B42_030501_18.tif, $;E:IDLtestinputtiff3B42_030501_21.tifoutfname = E:IDL

10、testinputtiffanimation.gifcreate_gif_animation, file_list, outfname, delay_time = 20; :Author: Dabin Ji; :Email:; :Date: 2011-4-10PRO create_gif_animation, in_filenamelist, outfname, delay_time = delay_time COMPILE_OPT IDL2;Get the number of input files.file_nums = N_ELEMENTS(in_filenamelist)IF (fil

11、e_nums GT 0) AND STRCMP(in_filenamelist0, ) THEN BEGINFOR i = 0, file_nums - 1 DO BEGINimg = READ_IMAGE(in_filenamelisti, red, green, blue);Get the size information.img_s = SIZE(img);If the dimension of the img is 3-D, then convert it to a index image first.IF (img_s0 EQ 3) THEN BEGIN img_idx = COLO

12、R_QUAN(img0, *, *, img1, *, *, img2, *, *, tbl_r, tbl_g, tbl_b);Reverse array in the second dimension.img_idx = REVERSE(REFORM(img_idx), 2)WRITE_GIF, outfname, img_idx, tbl_r, tbl_g, tbl_b, $DELAY_TIME = delay_time, /MULTIPLE, REPEAT_COUNT = 0 ENDIF;If the dimension of the img is 2-D, then write it

13、to the gif file directly. IF (img_s0 EQ 2) THEN BEGINimg = REVERSE(REFORM(img), 2)IF (N_ELEMENTS(red) GT 0) AND (N_ELEMENTS(green) GT 0) AND(N_ELEMENTS(blue) GT 0) THEN BEGINWRITE_GIF, outfname, img, red, green, blue, DELAY_TIME = delay_time, /MULTIPLE,REPEAT_COUNT = 0ENDIFENDIFENDFOR;Close the file

14、.WRITE_GIF, outfname, /CLOSEENDIFENDIDL 代码共享 -IDL 读取文本格式矩阵数据2011-03-30 19:48:17| 分类: 代码类 | 标签: |字号 大中小 订阅 ;+; :Description:; Read digital number sotred in a text file, and the; separater of the data in each line must be a Space or Tab.; :Params:; infilename : Input filename of the text file.; :Uses:

15、; data = read_txt_data_file(c:test.txt) ; :Author: dabin; :Email:; :Date: 2009-12-16FUNCTION read_txt_data_file, infilename ;Get the number of lines nlines = FILE_LINES(infilename)OPENR, lun1, infilename, /GET_LUN;Used to store a line tmp_str = ;Get columns of the input fileREADF, lun1, tmp_strtmp = STRSPLIT(tmp_str, COUNT = col_count) POINT_LUN, lun1, 0;Allocate memorydata = FLTARR(col_count, nlines)row_count = 0LWHILE EOF(lun1) DO BEGINREA

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论