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

1 / 39
About This Presentation
Title:

Mars Data Analysis Using IDL GG7101 Lecture 9

Description:

... drawn a plot, contour image, etc, can determine where it was drawn in pixels and ... Function to read topography file. Function to calculate Mars ASH. Main routine ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 40
Provided by: fscotta
Category:
Tags: idl | analysis | can | data | gg7101 | lecture | mail | mars | my | read | using | where | yahoo

less

Transcript and Presenter's Notes

Title: Mars Data Analysis Using IDL GG7101 Lecture 9


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

2
Review of 10/6/04
  • Finish I/O
  • Assoc, EOF, File pointers, File info, finding
    files, picking files
  • Graphics
  • Devices, Colors
  • Windows
  • Plot, oplot, plots, xyouts, !p.multi

3
Today
  • Quiz 6 returned
  • Questions from last time
  • Quiz
  • Grades
  • Graphics
  • Tv versus tvscl more keywords
  • Plot position and global variables with plot
    information
  • Contour
  • Review of homework 2
  • Review of today's class

4
Questions from 10/13
  • IDL color tables
  • In truecolor (decomposed1) mode, you can use a
    24-bit color table
  • Use the color command on a plot to set a color
    equal to hexadecimal RGB triplet
  • See page 251 of book
  • Black 000000XL
  • White FFFFFFXL
  • Etc

5
Quiz 6 Scores
  • Awesome! Keep trying!
  • Average 89
  • StdDev 11
  • Scores
  • 70 80 80 95 95 100 100

6
Quiz
  • What are two common bit depths for
    monitors/screens that IDL can use?
  • How do you open a window for plotting graphics in
    IDL that is 800 pixels across by 400 high?
  • Show the command to plot a single complete sin
    wave in IDL
  • Show the command to overplot this with the data
    points from a similar cosine wave
  • Show the command to annotate this with the text
    "Yahoo!" someplace on the previous plot
  • What command allows you to plot a 2x2 set of
    graphs in a single IDL window?

7
Quiz Answers
  • What are two common bit depths for
    monitors/screens that IDL can use?
  • 8-bit and 24-bit
  • How do you open a window for plotting graphics in
    IDL that is 800 pixels across by 400 high?
  • window, 0, xsize800, ysize400
  • Show the command to plot a single complete sin
    wave in IDL
  • plot, sin(findgen(361)2!dpi/360)

8
Quiz Answers
  • Show the command to overplot this with the data
    points from a similar cosine wave
  • oplot, cos(findgen(361)2!dpi/360), psym2
  • Show the command to annotate this with the text
    "Yahoo!" someplace on the previous plot
  • xyouts, 20, 0.7, "Yahoo!"
  • What command allows you to plot a 2x2 set of
    graphs in a single IDL window?
  • !p.multi0,2,2

9
Grades (in random order)
10
TVSCL versus TV
  • TVSCL will automatically scale your image to
    0-255 to match the r,g,b bit depth of the screen
  • TV does not - you must scale it manually
  • TV has more options however
  • Both allow values to indicate image start
    position
  • tvscl, image, x_start, y_start

11
Plot Position
  • Having drawn a plot, contour image, etc, can
    determine where it was drawn in pixels and how
    big it is in pixels
  • !x.window and !y.window provides position in
    coordinates ranging from 0 to 1 for the whole
    window
  • !d.x_vsize and !d.y_vsize provides the number of
    pixels for whole window
  • Example
  • print, !x.window gt 0.1, 0.9
  • print, !d.x_vsize gt 640 pixels

12
Example
13
Plot Position
  • To find start end pixels, just multiply
  • print, !x.window !d.x_vsize
  • gt 64, 576
  • To find image size in pixels, just subtract
  • Image width 576 - 64 512
  • Can use the image size, and start location with
    TVSCL/TV to place a contour map in alignment with
    an image
  • tvscl, congrid(image, 512, ysize), 576, y_start

14
Plot Position
  • Note We had to plot/contour first, then do
    TVSCL, overwriting the plot/contour
  • Can replot the contour image with /overplot, but
    will not redraw axes, so tickmarks may be hidden
  • Can replot with /noerase, which draws the image
    with axes and doesn't erase, but now position is
    unknown
  • However, you can create a vector with the
    normalized positions of an existing plot, and use
    it to scale other plot or contour windows
  • pos!x.window0, !y.window0, !x.window1,
    !y.window1
  • contour, data, lon, lat, /noerase, positionpos

15
Homework 2 Solutions
  • Plot the variation of pressure over a season at
    VL1 in units of 1 Ls.
  • Create a program to calculate the theoretical
    atmospheric pressure for the entire surface of
    Mars using MOLA data, the known altitude of the
    VL-1 landing site, and the known variation in
    atmospheric pressure measured at VL-1 as a
    function of season.
  • Do a screen capture of a contour map of pressure
    for Ls210
  • What is the highest and lowest surface pressure
    at this season?
  • Where are these places located in lat, lon?
  • Create an image that shows MOLA topography
    everyplace with a pressure gt 4 mbar for Ls210

16
Homework 2 Solutions
  • Ended up with 3 maps and some text
  • Pressure versus Ls
  • Global pressure contoured
  • Image of topography where P gt 4 mbar
  • Locations and values of max and min pressure

17
Homework 2 Solutions
18
Homework 2 Solutions
19
Homework Answer
  • Function to calculate pressure for a given Ls
  • Avoided loops
  • Allowed it to receive an scalar or an array
  • Function to read topography file
  • Function to calculate Mars ASH
  • Main routine
  • Calls/plots for pressure versus Ls
  • Reads topography/calculates/contours pressure
  • Determines topography were P gt 4 mbar
  • TVSCL's topo with contour overlay for axes
  • XYOUTS for location value of min/max P

20
Homework Mars Global Pressure as a function of Ls
  • Pressure at VL-1 for given Ls simplified

21
Calculate Pressure for Ls Scalar
pi
tmp
(Ls-330.2)
1
2
3
4
5
tmp
tmp
hi
x sin(2PI/360 x
)
var
var
var
pressure total(
) 7.9362
22
Calculate Pressure for Ls Array2
pi
tmp
( -330.2)
1
2
3
4
5
tmp
( -330.2)
pi
tmp
tmp
x sin(2PI/360 x
)
var
hi
pressure total(
, 1) 7.9362
var
23
Subroutine Pressure for Ls
function vl1_press, ls Arrays of
constants h 0.661, 0.574, 0.113, 0.065,
0.014 p 91.96, -129.23, -66.20, -4.04,
25.60 Resize constants to
5xn_elements(ls) p1 rebin(p, 5,
n_elements(ls)) h1 rebin(h, 5,
n_elements(ls)) The index variable in
the equation ifindgen(5)1 A
5xn_elements array of results (need to sum the
5) var h1sin( (2d!dpi/360d)(i(ls-330.2d)
p1)) Sum along the 5 axis to get
pressure vl1_presa 7.9362d total(var,1)
return, vl1_presa end
24
Subroutine Read Topography
function read_topo, filename
topointarr(1440,720) openr, ilun, filename,
/get_lun readu, ilun, topo return,
float(reverse(topo,2)) end
25
Subroutine Read Topo Calc ASH
function read_topo, filename
topointarr(1440,720) openr, ilun, filename,
/get_lun readu, ilun, topo return,
float(reverse(topo,2)) end function mash, t
return, 191.17 t / 3.72 end
26
Main Routine Graph P vs Ls
pro vl1_pressure2 device, decomposed0
loadct,2 Constants vl1_alt
-3600 tempr205 ls_single210 Set
up plot window window, 0, ysize400,
xsize1000, title'Homework 2' Plot
seasonal pressure variation lsdindgen(359)
plot, ls, vl1_press(ls),/xstyle,/ynozero,
title'Seasonal Pressure Variation at VL-1',
xtitle'L!Ls!N', ytitle'Surface
Pressure (mbar)', charsize2
27
Homework 2 Solutions
28
Scaling the axis in contour
  • Need vector the same size as array dimension to
    tell contour the values that go with each point
    on an axis

29
Scaling the axis in contour
  • If values go from 0 to 360 in 1440 points, where
    are the centers of each data point located?
  • 0, 0.25, 0.5 360? NO!
  • 0.125, 0.375,. Yes!
  • Must offset by 1/2 width of pixel to find center!
  • Node aligned (even 's of data points
  • Grid aligned (typically odd 's of data points)
  • Example 6 data points span the range from -3 to
    3

30
Calculate Press and Prep Contour
Read Topo toporead_topo('meg025t.img')
Calculate pressures scaled_topo
(topo - vl1_alt)/mash(tempr)
pressurevl1_press(ls_single)exp(-scaled_topo)
Set values of topo where P lt 4 mbar to
not a number topo(where(pressure le 4.0))
!values.f_nan Create contour array
axes latvals180.0(findgen(720)/720
1./(2720)) -90 lonvals360.(findgen(1440)/14
40 1./(21440))
31
Contour Plot
Set some contour levels
lvlsindgen(12) Set up plot window
window, 1, ysize800, xsize1000, title'Homework
2' Plot a filled contour image
contour, pressure, lonvals, latvals, title'Mars
Pressure at L!Ls!N 210',
xtitle'Longtitude', ytitle'Latitude', /xstyle,
/ystyle, charsize2, levelslvls,
/fill,/isotropic Overplot a contours
contour, pressure, lonvals, latvals, title
'Mars Pressure at L!Ls!N 210',
xtitle'Longtitude', ytitle'Latitude', /xstyle,
/ystyle, charsize2, levelslvls,
/follow, /overplot,/isotropic
32
Homework 2 Solutions
33
Prep for Topo image
window, 2, ysize800, xsize1000,
title'Homework 2' Plot contour axes to
use as border for topo image contour,
pressure, lonvals, latvals, title'Mars
Topo where Pgt4 mbar for L!Ls!N 210',
xtitle'Longtitude', ytitle'Latitude', /xstyle,
/ystyle, charsize2, levelslvls,
/nodata,/isotropic Find the
locations of the corners of the contour plot, to
scale our topo image px!x.window
!d.x_vsize py!y.window !d.y_vsize pylfloor(p
y1-py0) pxlfloor(px1-px0) pos!x.windo
w0, !y.window0, !x.window1, !y.window1
34
Topo image
Plot the Topo where Pgt 4 data, scaled and
positioned to fit on the contour graph
tvscl, congrid(topo, pxl, pyl), px01,
py01, /nan Overplot the contour graph
again, so we can see axes better contour,
pressure, lonvals, latvals,
title'Mars Topo where Pgt4 mbar for L!Ls!N 210',
xtitle'Longtitude', ytitle'Latitude',
/xstyle, /ystyle, charsize2,
levelslvls, /nodata, /noerase,
positionpos,/isotropic
35
Homework 2 Solutions
36
Add text for Min/Max
Calculate x y indices
ll_minarray_indices(pressure, index_min)
ll_maxarray_indices(pressure, index_max)
Make some strings with the min max pressure
lat lon postions min_posstring(format'("Mi
n. Pressure ", F6.3, " _at_ (", F7.3,",", F7.3,
")")', min_press, 360.(ll_min00.5)/1
440., (180.(ll_min10.5)/720.-90))
max_posstring(format'("Max. Pressure ", F6.3,
" _at_ (", F7.3,",", F7.3, ")")',
max_press, 360.(ll_max00.5)/1440.,
(180.(ll_max10.5)/720.-90))
Plot them on the last contour map xyouts,
100, 75, max_pos, charsize2 xyouts, 100, 60,
min_pos , charsize2 end
37
Homework 2 Solutions
38
Today
  • Quiz 6 returned
  • Questions from last time
  • Quiz
  • Grades
  • Graphics
  • Tv versus tvscl more keywords
  • Plot position and global variables with plot
    information
  • Contour
  • Review of homework 2
  • Review of today's class

39
Next Time
  • More on Graphics
Write a Comment
User Comments (0)
About PowerShow.com