Mars Data Analysis Using IDL GG7101 Lecture 11 - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Mars Data Analysis Using IDL GG7101 Lecture 11

Description:

Discuss thermal emission, 2D Histograms, & homework. Irregular gridding ... in book, 297 & 298, in your favorite projection (but not mercator or cylindrical) ... – PowerPoint PPT presentation

Number of Views:86
Avg rating:3.0/5.0
Slides: 42
Provided by: fscotta
Category:

less

Transcript and Presenter's Notes

Title: Mars Data Analysis Using IDL GG7101 Lecture 11


1
Mars Data Analysis Using IDLGG710-1Lecture 11
  • F. Scott Anderson
  • Office POST 526B
  • Phone 956-6887
  • Email anderson_at_higp.hawaii.edu

2
Review of 11/8/04
  • Bar plots, plotting error, histograms
  • Discuss thermal emission, 2D Histograms,
    homework
  • Irregular gridding contour, mesh plots

3
Today
  • Quiz 8 returned / Homework NOT returned
  • Questions from last time
  • Quiz 9
  • Finish Graphics
  • Shaded surface plots, large images
  • Copying a screen image
  • Reading and writing graphics files
  • Other devices postscript and z-buffer
  • Curve Fitting
  • Polynomial least square fits
  • Minimum absolute deviation fits
  • Review of today's class

4
Questions from 11/8/04
  • Stay, hit, or fold?

5
Quiz 8 Scores
6
Quiz
7
Quiz Answers
8
Quiz Answers
9
Shaded Surface Plots
  • It is possible to produce a 3D perspective solid
    surface image using SHADE_SURF
  • Form
  • SHADE_SURF, z_img,x,y, AZvar1, AXvar2,
    SHADEimg
  • Can use any image that is scaled from 0 to 255
    and that has the same size as z_img
  • Thus can make 3D topo map with image draped over
    it

10
Example Shaded Surface Plots
  • restore, 'test.data'
  • SHADE_SURF, z, x, y, shadebytscl(dist(50))

11
Example Shaded Surface Plots
  • Bad Viking image draped on MOLA topo of hematite
    region

12
Large images SLIDE_IMAGE
  • Large images are difficult to show on the screen
  • If you want to maintain full resolution, you may
    desire a scrolling window and a shrunken image
  • Form
  • SLIDE_IMAGE, Image, FULL_WINDOWvariable,
  • SLIDE_WINDOWvariable, SHOW_FULL0,
    TITLEstring,
  • XVISIBLEwidth, YVISIBLEheight, XSIZEwidth,
  • YSIZEheight
  • Where
  • Image is optional
  • FULL_WINDOW and SLIDE_WINDOW are used with WSET
  • SHOW_FULL0 results in only a scrolling window
  • XVISIBLE/YVISIBLE are the size of the windows
  • XSIZE/YSIZE is the size of the scrolling image

13
SLIDE_IMAGE Examples
  • xdist(1000,1000)
  • slide_image, x

14
SLIDE_IMAGE Examples
  • xdist(1000,1000)
  • slide_image, x, show_full0

15
SLIDE_IMAGE Examples
  • xdist(1000,1000)
  • slide_image, full_windowfw, slide_windowsw,
  • xvisible600, yvisible600, xsize1000,
    ysize1000
  • wset, sw
  • tvscl, x

16
Reading Images from a Device
  • If you have built a complex image composed of
    many plot, tvscl, and contour calls, you may want
    to read that image and store it
  • Fundamentally limited by the number of pixels on
    the screen
  • Useful for writing bitmap or raster images, or
    images composed of pixels (instead of vector
    images which use lines, circles, etc)
  • Can be done using TVRD function
  • Form
  • Result TVRD(/ORDER)
  • On a 24 bit display
  • Result TVRD(/TRUE,/ORDER)
  • IDL can write read many types of bitmap images
    (tif, jpg, pict, bmp, pnm, etc)

17
Example TVRD an Image
  • restore, 'test.data'
  • SHADE_SURF, z, x, y, shadebytscl(dist(50))
  • imgTVRD(/TRUE, /ORDER)
  • window, 2
  • tvscl, img, /true,/order

18
Writing to Raster files
  • Many basic types of image formats can be written
    and read in IDL

19
Reading Writing 24-bit Images
  • restore, 'test.data'
  • device, decomposed0
  • loadct,5
  • SHADE_SURF, z, x, y, shadebytscl(dist(50))
  • imgTVRD(/TRUE,/order)
  • WRITE_TIFF, 'Cool.tif',img
  • rread_tiff('Cool.tif')
  • window, 2
  • tvscl, r, /true,/order

TVRD returns a 3,n,m array img0,,R img1,,
G img2,,B
20
Reading Writing 8-bit Images
  • restore, 'test.data'
  • device, decomposed1
  • loadct,5
  • SHADE_SURF, z, x, y, shadebytscl(dist(50))
  • imgTVRD(/order)
  • tvlct, r, g, b, /get
  • WRITE_TIFF, 'Cool.tif',img, redr, greeng,
    blueb
  • write_bmp, 'Cool.bmp', reverse(img,2), r, g, b

TVRD returns a n,m array must read color table to
get associated colors
21
Making PS plots
  • Postscript is a device independent plotting
    language
  • Can be shown on screen or printers
  • Can be contain both bitmap and vector graphics
  • Vector graphics inherently better resolution
    because there are no pixels, just lines, circles,
    etc.
  • Images are converted to pixels when the image is
    rendered, on whatever device is being used

22
Steps to make a PS plot
  • First, set IDL to send graphics to a PS file
    using set_plot
  • Then give IDL information about the PS file we
    will write using device
  • Do our graphics calls
  • All examples of plots, graphs, images,
    positioning, etc will work in PS files
  • Close the PS file using the device command
  • Set IDL back to the default graphics device (your
    screen)

23
Example PS Device
  • restore, 'test.data' Get some data
  • entry_device!d.name Record screen device name
  • set_plot,'ps' Tell IDL we are using PS
  • Next tell IDL about the PS file
  • device, filename'test.ps', /inches, /color,
    xsize5, ysize5, xoffset1.75, yoffset3,
    bits8, /portrait, /helvetica
  • loadct,5 Do our graphics stuff
  • SHADE_SURF, z, x, y, shadebytscl(dist(50)),/font
  • device,/close Close the PS file
  • set_plot, entry_device Tell IDL to use screen
    again
  • The file test.ps can now be printed, or viewed
    with a postscript viewer (photoshop, many others)

24
Example PS Device
25
Publication Quality Graphs
  • When making images for JGR or a talk, it can
    often be hard to read default fonts, line sizes,
    character sizes, etc
  • Try setting styles globally using
  • !p.thick4 Globally set plot line thick 4
  • !x.thick4 Globally set plot xaxis thick4
  • !y.thick4
  • Set plot commands with /font to use
  • device, /helvetica, /bold, font_size16

26
Example
  • decor2, /ps
  • pro decor2, PSps
  • if (keyword_set(PS)) then begin
  • set_plot,'ps'
  • device,/inches,xsize7.2,xoffset1
    ,ysize10, yoffset1,
  • filenameoname'.ps',/helv
    etica,/bold,font_size16
  • !P.thick4
  • !x.thick4
  • !y.thick4
  • endif else begin
  • window, 0, ysize1000, xsize800
  • endelse

27
Example
  • Plot commands here
  • plot, x, y, /font
  • if (keyword_set(PS)) then begin
  • device,/close
  • set_plot,'x'
  • !P.thick1
  • !x.thick1
  • !y.thick1
  • endif
  • end

28
Example
  • restore, 'test.data'
  • entry_device!d.name
  • set_plot,'ps'
  • device, filename'test.ps', /inches, /color,
    xsize5, ysize5, xoffset1.75, yoffset3, bits8
    ,/helvetica,/bold,font_size16
  • !P.thick4 !x.thick4 !y.thick4 !z.thick4
  • loadct,5
  • SHADE_SURF, z, x, y, shadebytscl(dist(50)),/font
  • device,/close
  • set_plot, entry_device

29
Result
30
The Z-Buffer!
  • Like plotting on the screen, but instead you
    write the image into memory called the z-buffer
  • Many images can be created stored in memory
    this way
  • These images can rapidly be transferred to the
    screen to show a movie
  • The images in the Z-buffer can be of any size
  • Large composite images can be built in the
    z-buffer and then saved to a file, without using
    the screen
  • The z-buffer is accessed like a PS file
  • The z-buffer can be read using TVRD

What is the Z-Buffer?
31
Example Z-buffer
  • restore, 'test.data' Get some data
  • entry_device!d.name Record screen device name
  • set_plot,'Z' Tell IDL we are using Z
  • Next tell IDL about the Z
  • device, set_resolution300,300
  • loadct,5 Do our graphics stuff
  • SHADE_SURF, z, x, y, shadebytscl(dist(50))
  • rtvrd()
  • device,/close Close the Z buffer
  • set_plot, entry_device Tell IDL to use screen
    again
  • tvscl, r

32
Example Z-buffer
33
Mapping
  • IDL has the capability to draw maps using a
    number of cartographic projections
  • Data can then be plotted on these maps in the
    current projection
  • Unfortunately, routines are clumsy inaccurate
  • Suggest using GMT instead
  • Easier, better results
  • Will show a few examples here

map_set, 0, 145 map_continents
34
Example Aitoff Data
  • lon randomu(-100L, 100)360.0 - 180
  • lat randomu(-200L, 100)180.0 -90
  • map_set, /aitoff, /horizon
  • map_continents
  • oplot, lon, lat, psym1
  • map_grid, /label

35
Mini-Homework
  • Go to the web, download moderately sized image of
    your favorite planet (not Earth)
  • Read it in
  • Display it following the directions in book, 297
    298, in your favorite projection (but not
    mercator or cylindrical)

36
IDL Analysis Routines
  • IDL has many analysis routines
  • Appendix B in book
  • Correlation
  • Curve surface fitting
  • Differentiation integration
  • Eigenvalue/vector
  • Gridding and interpolation
  • Hypothesis testing
  • Linear systems
  • Error assessment
  • Multivariate analysis
  • Non-linear equations
  • Optimization
  • Probability
  • Signal processing
  • Sparse arrays
  • Special functions
  • Statistics
  • Time series
  • Transcendental functions
  • Transforms

37
Least Squares Polynomial Fit
  • To calculate a least squares fit to data, use
    poly_fit
  • R POLY_FIT( X, Y, Degree, SIGMAvariable,
    YFITvariable)
  • Note Returned variable R contains line fit
    parameters following
  • yr0r1xr2x2rDeg-1xDeg
  • !p.thick3
  • xfindgen(10) yx
  • plot, x, y
  • y1x(randomu(-10L, 10)4-2)
  • oplot, x, y1, line1
  • rpoly_fit(x,y1,1, yfity2, sigmae)
  • oplot, x, y2, line2

38
Least Squares Outliers
  • To calculate a least squares fit to data, use
    poly_fit
  • Result POLY_FIT( X, Y, Degree, SIGMAvariable,
    YFITvariable)
  • xfindgen(10) yx
  • plot, x, y, yrange0,18, /ystyle
  • y1x(randomu(-10L, 10)4-2)
  • y1815
  • oplot, x, y1, line1
  • rpoly_fit(x,y1,1, yfity2, sigmae)
  • oplot, x, y2, line2

39
Min Abs Dev Fit Outliers
  • More robust fits can be had with a minimum
    absolute deviation fit routine ladfit
  • Result LADFIT( X, Y , ABSDEVvariable ,
    /DOUBLE )
  • Note Returned variable R contains line fit
    parameters following
  • yr0r1xr2x2
  • xfindgen(10) yx
  • y1x(randomu(-10L, 10)4-2)
  • y1815
  • plot, x, y1, yrange0,18, /ystyle
  • rpoly_fit(x,y1,1, yfity2, sigmae)
  • oplot, x, y2, line1
  • rladfit(x,y1,absdeve)
  • y3r0r1x
  • oplot, x, y3, line2

40
Today
  • Quiz 8 returned/Quiz 9 given
  • Finish Graphics
  • Shaded surface plots, large images
  • Copying a screen image
  • Reading and writing graphics files
  • Other devices postscript and z-buffer
  • Maps
  • Homework

41
Next Time
  • Maps and map projections
  • Useful math functions in IDL
  • Convolutions
  • Correlations
  • FFT's
  • Wavelets
  • Principle components
Write a Comment
User Comments (0)
About PowerShow.com