Presentation is loading. Please wait.

Presentation is loading. Please wait.

A brief introduction to IDL

Similar presentations


Presentation on theme: "A brief introduction to IDL"— Presentation transcript:

1 A brief introduction to IDL
Greg Michael Planetology and Remote Sensing Institute of Geosciences Freie Universitaet Berlin

2 A brief introduction to IDL
Why IDL for planetary data processing? Array processing language Powerful visualisation facilities This short intro intended to give an idea about what IDL is Some IDL basics Arrays File handling Strings Worked example: read a VICAR image and save it as a TIFF file Mars Express HRSC/OMEGA data workshop, St. Louis, May 2008

3 IDL: some basics Arrays Files Strings Easy to create: a=indgen(10)
print,a Easy to manipulate (other languages typically require a loop to do this, with one iteration for each element): b=a*10 print,b Easy to introduce complex array operations. Here, a matrix multiplication: c=a#a print,c Easy to visualise: d=indgen(400)#indgen(400) tvscl,d Files To record an array in a file: openw,1,"D:\mydocs\tmp\a.tmp" writeu,1,a close,1 And to recover it: e=intarr(10) openr,1,"D:\mydocs\tmp\a.tmp" readu,1,e To check it’s correct: print,e Strings Variables which store text, e.g. s="this is a string" print,s Can also have string arrays: t=replicate(s,10) print,t print,transpose(t) And write them to a text file: openw,1,"D:\mydocs\tmp\t.txt" printf,1,transpose(t) Mars Express HRSC/OMEGA data workshop, St. Louis, May 2008

4 IDL example: extract image from VICAR file
Get the file berlin.de/mex4/0515/h0515_0000.ir4.50 Read the file header: filename="D:\mydocs\data\HRSC\0515\h0515_0000.ir4. 04" openr,1,filename s=“” readf,1,s close,1 print,s The values are stored as a series of expressions separated by spaces key=strsplit(s,' ',/extract) print,transpose(key) print,transpose(key[0:10]) To get an individual value: val=strsplit(key[0],'=',/extract) print,val lblsize=val[1] Extract the image data Also need to obtain NL and NS in the same way im=bytarr(ns,nl) openr,1,filename point_lun,1,lblsize readu,1,im close,1 tvscl,im tvscl,congrid(im,300,700) Save the image as a TIFF file write_tiff,"D:\mydocs\tmp\im.tif",im And a small version as a jpeg: write_jpeg,"D:\mydocs\tmp\im.jpg",congrid(im,300,700) *** Help Press F1, or Help-Contents from the menu Function library E.g. strsplit, congrid, tvscl, write_tiff Mars Express HRSC/OMEGA data workshop, St. Louis, May 2008


Download ppt "A brief introduction to IDL"

Similar presentations


Ads by Google