Selected Topics in Geol Scienc
Selected Topics in Geol Scienc GEOL 5215
Popular in Course
verified elite notetaker
Popular in Geology
This 64 page Class Notes was uploaded by Miller Berge on Thursday October 29, 2015. The Class Notes belongs to GEOL 5215 at University of Texas at El Paso taught by Bridget Konter in Fall. Since its upload, it has received 40 views. For similar materials see /class/231279/geol-5215-university-of-texas-at-el-paso in Geology at University of Texas at El Paso.
Reviews for Selected Topics in Geol Scienc
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/29/15
cond contour convab corrcoef cov cputime cumprod cumsum deconv de12 delete det diag diff dir disp echo eig else elseif end eps erf erfinv exist expm eyen is 39s jth column of A 39s ith row of A U is SUMMARY OF SOME MATLAB COMMANDS regularly spaced vector i ij i2j k ajraj1r I ak vector with all elements of A end to end places axes on figure see manual for details axis scaling and appearance exit for or while loop as in C change working directory clear current axis contour plot elevation labels clear command window clear memory remove variables clear current figure clf reset for total clear matrix condition number make contour plot see manual convolve vectors a and b correlation coefficients see manual covariance matrix see manual elapsed CPU time cumulative produce cumulative sum deconvolution five pint discrete Laplacian delete files and graphic objects matrix determinant diagonal matrices and diagonals of matrix differences and approximate derivatives list files in current directory display text or matrix echo M files during execution eigenvalues and eigenvectors see manual used in if statements as in C see above terminate for while else statements as in C returns floating point accuracy error function inverse error function check if variable exists matrix exponential n by n identity matrix fclose fft fft2 figure fill find finite fix fliplr flipud floor flops fmin fmins fopen for format fplot fprintf fread fscanf fwrite fzero ginput gradient grid gtext help hist hold if ifft ifft2 image imagesc input interpl interp2 inv 339 length line load loglog lookfor close file 1 D fast Fourier transform see manual 2 D fast Fourier transform open new graphics window see manual fill 2 D polygons find indices and values of nonzero elements detect infinities round to integer by going toward zero flip matrix left right flip matrix up down round to integer by going toward infinity counts floating point operations minimize a function of one variable minimize a function of several variables open a file similar to C for loop similar to C control output display format plot the graph of a function see manual write formatted data to file see manual read binary data from file read formatted data from file write binary data from matrix to file zero of a function of one variable graphical input using mouse compute gradient of 2 D array grid lines for 2 D and 3 D plots mouse placement of text on a graph online documentation histogram plot hold the current graph so new stuff plots on top conditionally execute statements as in C inverse 1 D FFT inverse 2 D FFT display image display image scaled to use full color map request user input 1 D data interpolarion 2 D data interpolation matrix inverse complex number i length of a vector create line object retrieve contents of a file make log log scale plot keyword search through help entries DIP Lab Introduction to MATLAB Goal In this lab we will become familiar with the MATLAB programming environment You will learn the basics of MATLAB syntax and functionality You will also write your own program to do simple manipulations to an image in MATLAB Introduction MATLAB is a mathematical computer package from The MathWorks quotMATLABquot stands for quotMatrix Laboratoryquot MATLAB s functions operate on matrices and vectors as well as scalar numbers so it is very useful for linear algebra applications With it you can perform any number of simple or complicated mathematical operations including image processing As a generalpurpose programming language it is easy to learn and use but powerful enough for a wide range of science and engineering applications The best way to learn MATLAB is by using it which is what we will be doing in this lab and throughout the semester The builtin and online documentation is excellent and there is also a complete set of manuals for you to use Please keep the manuals in the lab To access MATLAB log in to one of the PCs and doubleclick on the MATLAB icon on the desktop or the Windows Start Menu The MATLAB environment will open It is a window with several panes The largest one is the command line The others allow you to view the current directory see what variables are in memory etc The menu bar at the top and the Start menu at the bottom of the window allow you to access many of MATLAB s functions as well as help and tutorials For our purposes MATLAB is ideal since an image is basically a matrix Remember that digital images have been discretized and are composed of pixels that can be thought of as rectangular 2 D arrays of small dots on the screen Each dot has a particular location associated with it its coordinates expressed as a pair of numbers in the rectangular array Each of the dots also has a value associated with it a number stored at that location that specifies the brightness or color of that dot These values DN or digital numbers are the elements of the matrix The matrix has a size m x n which represents the number of rows m and the number of columns n Each pixel also has a size related to the quantization eg how many binary digits 0 s and 1 s it takes to record the number stored Note that this is different than a physical or spatial size For example to record grayscale between 0 and 255 256 total possible values in this case shades of gray you need to quantize the image at 8bit 28 256 Thus if you multiply the number of bitspixel by the total number of pixels m x n you can gure out how much memory or disk space your image will fill Since we can treat our image as a matrix a mathematical object we can do all sorts of things to it Essentially any matrix and scalar operation can be done We can multiply add divide subtract etc images We can apply transformations in shape size quantization etc Digital images can be mathematically manipulated as we see fit Instructions l E 4 Log in and start MATLAB The first thing you should do when starting MATLAB is to navigate to your home directory on geobase in order to set the correct working directory In the following commands to type into the MATLAB command line are in this font Terminology you should understand the specific meaning are given in italics see below and above A note on help If you type help followed by the name of a command you will get a detailed description of the command what it does and how to use it Note also that MATLAB is case sensitive Create a matrix with the following line A l I 2 3 I 4 Note that commas separate elements and semicolons separate rows Calculate the square of your matrix Asquare A A Note that using as opposed to simply forces MATLAB to perform the operation element by element Try the command with and see what happens You will have performed a conventional matrix multiplication I make a habit of always using unless I specifically want matrix multiplication The same holds for division vs and for raising to a power quot vs quot Addition and subtraction are always elementbyelement operations As you can see MATLAB prints the result of everything you do This can slow things down however especially in a long program You can suppress the output by placing a semicolon at the end of the line If you type B1I23I4 the matrix B will not be printed If you now type B 9 O gt1 W gt0 the matrix will be printed Large matrices can be easily constructed without typing in every element Below are some examples Try them and see what they do Before doing so though you will need to define the matrix dimensions In and n which denote the number of rows and columns respectively Diagonal matrices are also easy to create F diag v k Before using this command you need to define the vector v that you want on the diagonal of F Vector v should have at least 2 elements and you may want to play with this value as you vary k You also need to specify k which tells MATLAB which diagonal to use k 0 is the main diagonal k l is 1 spot above k l is one spot below etc Note that MATLAB automatically adjusts the size ofF size depending on how you specify k To create vectors you can type all the elements in manually or use the tricks you learned in step 5 The following example will create a vector of 1 s of m x 1 dimensions 9 09 ones m l The vector 9 you just made is a column vector You can make it into a row vector by transposing it Transposition can be done using the 39 operator or with transpose command hg39 or h transpose g This trick also works with matrices Try it Note that we have been using lower case variable names for vectors and upper case for matrices If you use your matrix F which you will note is still in MATLAB s memory you get a transposed matrix eg F 39 if vector v that you used to create it was not located on the main diagonal So you may need to redef1ne k and recreate F make the result of transposing F more interesting Now the power of MATLAB is that you can string together commands like this MATLAB s builtin functions into prewritten programs your own functions each stored in a simple text file that you can invoke with a single command You can write functions using MATLAB s builtin text editor which is very useful because it colorcodes your program or any other text editor Moreover these functions can be used on any platform that MATLAB runs on Windows Mac OS X UNIX etc Try writing the program below It computes the mean and standard deviation of a series function mean stdev stat x Comments look like this They are not interpreted by MATLAB They are handy for putting notes in your program The quotfunctionquot line above defines your program as a function that accepts input x returns two outputs mean and stdev The name of the function is stat You invoke the program by typing statx at the command line The program will then compute the mean and standard deviation of x o Po Po Po Po Po Po Po Po Po Po P 0 0 The next line returns the number of rows and columns in x 0 0 m n size x Below is a structure called an if then else statement The double equal sign does not assign a value to m I is a test of equality Indenting makes your program easier to read 0 0dede if m end What do you think these next two lines do mean sum x m stdev sqrt sum x mean A 2 m l At this point the program stops and has returned two values the mean and standard deviation When you are done typing it in save it in your working directory as statm But don t run it yet 10 Again using MATLAB s text editor write a second program see below and call it quart m Save it but don t run it yet function quartl quart3 quart x This function returns the first and third quartiles of the vector x ymed median x What do these lines do yl x x lt ymed y2 x x gt ymed quartl median yl quart3 median y2 11 In the MATLAB command window type clear This will clear all the variables currently in memory If you type c lc you will clear the command line window so that you have a fresh slate Don t worry though there are ways to save variables in memory to disk too 12 Now create a series of numbers x 1 48 81 2 1o 25 14 18 53 41 13 Run the statm program Remember this program is a MATLAB function thus it needs an argument to execute the desired computations Since we want to obtain statistics for vector x we run the command statx 14 It turns out that MATLAB has a lot of builtin functions and toolboxes Among these are functions that calculate the mean and the standard deviation both part of the Statistics Toolbox Use them to check the results of your stat m program mean x std x 15 Another builtin statistical function is the median median x This should give you the number halfway between the largest and smallest in the series An intuitive way to check the output of median is with y sort x which will return a vector y that includes the elements of x sorted from largest to smallest Since there are 10 elements in x and in y the median value is halfway between the 5Lh and 63911 elements of y 16 Now try your quart m program To check the answers look at your vector y The first quartile should be the 3rd element in y The third quartile should be the 8 element in y 17 Finally here are some notes on working with an image basically just a matrix a Fquot MATLAB has builtin functions through the Image Processing Toolbox for opening displaying and writing images See the handout and this url for more information http amath colorado educourses472 OZOOOSprLabsWo rksheetsMatlab tutorialmatlabimEr html However some of the images you may work with are in file formats other than those that the functions discussed at that website can handle eg ENVI format Here is a snippet of code for opening an ENVI format image fid fopen myimage fread fid fclose fid 39 myfile 39 39 r 39 39 l 39 n m 39uint839 The first line opens the file containing your image The fid is a number that MATLAB assigns to the file as a reference The second line reads the file and puts the contents into the variable myimage The variables n and m denote the size of the image in rows and columns and uint8 denotes the type of data 8bit unsigned integers in this case The third line closes the file Similarly to save an image in ENVIformat fid fopen 39outputfilename39 39 wb 39 fwrite fid myimage 39intl639 fclose fid See the MATLAB help for more information on save load fopen fread fwrite and folose To display images or any other data as a gure MATLAB has tons of builtin functions Here is a snippet of code with just one example Makes a new figure window Allows the figure to be figure 1 hold off COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 DO s AND DON Ts OF POWERPOINT DO use JPGs When working with different image types JPG is often most compatible however TIFF has better resolution DO not interact directly with a file on a USB or network drive Never open a PowerPoint file m or save to a USBnetwork drive directly Always copy presentations to your desktop open them save them to your desktop and then copy back to a drive if necessary DO save regularly and OFTEN Every time you re about to make any MAJOR changes choose File 9 Save As and give the file a new name DON T copy and paste pictures and other content from the Internet into PowerPoint Instead rightclick the picture choose Save Picture As and save it to your hard drive Then use Insert 9 Picture 9 From File to bring the picture into PowerPoint If you copy paste from the web you run the risk of creating a hardtoremove link from the Internet from your presentation This may cause PowerPoint to try to connect to the Internet every time anyone opens the presentation which is a real annoyance DON T link images When you use Insert 9 Picture 9 from File to insert a picture into PowerPoint or may notice an option to Link to the file Do not link unless you have a good reason for doing so PowerPoint s image links break very easily It s generally safer and more effective to embed the les in other words insert them normally not linked This is analogous to copyingpasting an image into Illustrator versus placing an image DO test movies Imbedding movies in PowerPoint is getting more reliable but still tricky In fairly new computers with recent versions of software movies usually work well but never trust PowerPoint bottom line ALWAYS TEST YOUR MOVIES well before you give your presentation DO make your presentation legible Always remember that most presenters make their lettering too small Big is better This also applies to gures in your thesis and for subsequent publications If you are using diagrams from the literature with small lettering highlight the things you want the audience to see and mention that the other portions are not meant to be readable Or even better try to block out anything that you do not need your audience to see To check on readability look at your presentation as it appears when projected in a room not just on your computer screen DO try out other presentation software PowerPoint has close to a monopoly in the world of presentation software although many other packages and approaches are possible For example Macs have Keynote which is an up and coming competitor to PowerPoint Other minimalists are beginning to use Adobe Reader to present slides You should be openminded to all of these types of presentation software With that said though as PPT is still very popular as are EosVol 85 No 40 5 October 2004 The End of the Rainbow Color Schemes for Improved Data Graphics PAGES 385391 Modern computer displays and printers enable the widespread use of color in scientific com munication but the expertise for designing effective graphics has not kept pace with the technology for producing them Historically even the most prestigious publications have tolerated high defect rates in figures and illus trations Cleveland 1984 and technological advances that make creating and reproducing graphics easier do not appear to have decreased the frequency of errors Flawed graphics con sequently beget more flawed graphics as authors emulate published examples Color has the potential to enhance communication but design mistakes can result in color figures that are less effective than gray scale displays of the same data Empirical research on human subjects can build a fundamental understanding of visual perception Ware 2004 and scientific methods can be used to evaluate existing designs but creating effective data graphics is a design task and not fundamentally a scientific pursuit Like writing well creating good data graphics requires a combination of formal knowledge and artistic sensibility tempered by experience a combination of substance statistics and designquot Tufte 1983 p 51 Unlike writing however proficiency in creating data graphics is not a main component of secondary or postsecondary educationThis article provides some concrete suggestions to help geoscientists use color more effectively when creating data graphicsThe article explains factors to consider when designing for color blind viewers offers some example color schemes and provides guidance for constructing and selecting color schemes in the form of design patterns Because scientific authors frequently misuse spectral color the particular focus here is on better alternatives to such schemes Designing for Colorblind Viewers One of the commonly overlooked considerations in scientific data graphics is perception by individuals with color deficient visionThe significance of color blindnessquot increases for geoscience publications whose readers are disproportionately male because while 04 of women exhibit some form of color vision deficiency the figure is approximately 8 for Caucasian menAmong the predomi nantly male readership of Eos as many as one in fifteen may have difficulty interpreting the rainbow hues frequently used in maps charts and graphs Figure 1 simulates how BY A LIGHT AND PJ BARTLEIN one spectral color scheme and a better alter native may appear to color blind readers Color blind individuals see some colored data graphics quite differently from the general populationThe human visual system normally perceives color through photosensitive cones in the eye that are tuned to receive wavelengths in the red green and blue portions of the visible spectrum People who lack cones sensitive to one of the three wavelengths are called dichromats Fortner and Meyer 1997 lndividuals whose o5 fICl receptors are shifted toward one or the other end of the spectrum are called anomalous trichromats The term color deficientquot encom passes dichromats and anomalous trichromats as well as those who exhibit rarer forms of impaired color vision Because a sex linked recessive gene is implicated in the condition color vision deficiency is far more common in men than in women Algorithms based on psychophysical obser vations make it possible to simulate the appearance of colored images to colordefi cient viewers Brettel et al 1997 Data maps of the type shown here serve two main purposes detection of large scale patterns and determi nation of specific grid cell or point valuesThe saturated spectral scale Figure 1a creates a region of confusion centered on the North American continent where achieving either purpose becomes nearly impossible for dichromat b 5 02 00 02 0 E 2 00 02 05 10 20 500 tilmi Fig l Twometer air temperature anomalies i e differences from the 1971 2000 mean for January 1998 during a recent El Nino using two different color schemes A Data using a saturated spec tral scheme similar to those used by many geoscience authors B A simulation of the spectral image as it might appear to individuals with protanopic vision one of the most common types of colorvision deficiency in which the retina lacks redsensitive cones C The same data mapped using a redwhiteblue diverging scale and D The corresponding simulation for colordeficient readers NCEPNCAR reanalysis data readers Large negative temperature anomalies keyed to violet and blue appear on the map adjacent to large positive temperature anom alies depicted in red and orange but to the color deficient viewer the hues form a contin uous progression of blue such that they can not distinguish large positive anomalies from large negative anomalies Figure 1bThe two hued red and blue image Figure 1c displays the same map region such that both colordefi cient Figure 1d and normally sighted readers can detect patterns and look up values Improving Color Schemes While Accomodating Color De ciency Designing effective color schemes demands attention to the needs of readers who are unable to perceive certain colors Color schemes that accommodate red or green blind dichromats will accommodate most other forms of color deficiency Rigden 2002 By designing with the severest forms of red and green color blindness in mind authors can create data graphics that work for all readers The following suggestions can help authors make rainbow colored graphics accessible to more of their readers and can be used to improve both spectral and nonspectral color schemes 1Avoid the use of spectral schemes to rep resent sequential data because the spectral order of visible light carries no inherent mag nitude message Readers do not automatically perceive violet as greater than red even though the two colors occupy opposite ends of the color spectrum Rainbow color schemes are therefore not appropriate if the data to be mapped or graphed represent a distribution of values ranging from low to highWith suit able modification however Brewer 1997 spectral schemes can work for continuously distributed diverging data such as anomalies and residuals Figure 2c and for the display of categorical data Figure 2e 2 Use yellow with care and avoid yellow green colors altogether in spectral schemes Readers with color deficient vision often confuse yellow green with orange colorsYellow appears brightest among the primary colors and stands out visually for color impaired and normally sighted readers alikeThe yellow portion of the scheme should therefore be aligned with the midpoint of the data distribution if emphasizing the midpoint of a diverging distribution is a clear goal of the presentation However yellow may lead to misperceptions when the midpoint critical value of the data is not significant to the presentation or is not precisely known 3 Use color intensity or value to reinforce hue as a visual indicator of magnitude Hue is what we typically refer to as color red blue green and orange are all hues lntensity or value may also be referred to as lightness brightness or luminosityWhile it is possible to select hue sequences that are distinguishable by individuals with either colordeficient or normal vision intensity readily provides perceptual ordering for all readers Using intensity as well as hue also makes the quality of color reproduction less critical to the EosVol 85 No 40 5 October 2004 A Singlehue progression to purplishblue iii B Diverging progression from blue to gray C Orangewhitepurple diverging scheme iii 1 ii D Modified spectral scheme Fig 2 Color schemes of one or two hues progressing from light to dark convey sequential data effectively A A single hue progression suitable for sequential data Diverging color schemes mcu be constructed by combining pairs of sequential schemes at the midpoint B How color can extend a simple intensity scale making it twosided and therefore suitable for displcuing either sequential or diverging data C Combination of an orangetowhite sequence with a whiteto purple sequence a scheme that appears very similar to both colordeficient and normally sighted readers The rainbow spectrum appeals visually to many authors and readers but an unmodified spectral color sequence proves ineffective for most purposes The color scheme depicted in Figure 2D avoids yellowgreen and varies intensity as well as hue employing spectral color while avoiding the shortcomings of rainbow displcus For authors wishing to depict categorical rather than continuously distributed data Figure 2E combines 12 bright colors that are mutually distin guishable from one another presentation and helps make even gray scale photocopies somewhat legible Design Patterns The results of human subject studies may inform designers but design skill comes pri marily from experience and example Design patterns Alexander 1979 Gamma et al 1995 for data graphics can communicate experience to nonexpert designers and may help integrate scientific knowledge into the design process Design patterns make well proven design knowledge explicit using a specific literal form Each pattern is a three part rulewhich expresses a relation between a certain context a problem and a solution Alexander 1979 p 247Table 1 documents two design patterns for the use of color in data graphics Every design pattern carries a descriptive name in bold italic in Table 1 and contains instructions to the designer for creating a specific instance of the pattern Collectively the names form a shared vocabulary for communicating about designs Example Color Schemes Computer graphics tools make changing color palettes easy but devising new color schemes for effective data graphics remains a challenging design taskThe color schemes in Figure 2 have been tried and tested for print and online display and evaluated for legibility by readers with color deficient visionThey should work well with a range of Earth science dataAccurate reproduction of color for print and computer displays is a complex problem in its own right Computer displays typically reproduce colors using an additive RGB color model while print reproduction usually uses a subtractive CMYK color model Fortner and Meyer 1997 Detailed specifications for reproducing these and other color schemes using both RGB and CMYK models are available on the Web site httpgeographyuoregon edudatagraphics Others are provided by Brewer et al 2003 Acknowledgments The authors gratefully acknowledge the contributions of Aileen Buckley Peter Killoran Sarah Shafer and Jacqueline Shinker to this work and the improvements to the manuscript suggested by Cindy Brewer and Henry Shaw National Centers for Environment Prediction NCEP reanalysis data were provided by the National Oceanic and Atmospheric Administra tion Cooperative Institute for Research and Envi ronmental Sciences Climate Diagnostics Center COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 GMT GMT stands for quotGeneric Mapping Toolsquot It is a set of UNIX tools for making map plots that was written by Paul Wessel and Walter Smith This software is in the public domain and is still maintained by Wessel and Smith The lastest update Version 431 was released in 2007 There is a GMT website at httpgmtsoesthawaiieduthat contains links to manuals and tutorials for the programs Unfortunately I have generally found these manuals to be pretty worthless both for learning how to use GMT and as a reference to learn about specific commands Once you have learned a little bit about how to use GMT it39s better to use the online manuals as your primary reference You can access these at the UNIX command level by simply entering man pscoast man psxy etc Unfortunately GMT is not a very quotuser friendlyquot program If you are unfamiliar with some of the features of the UNIX environment like piping output etc you may nd it fairly intimidating at rst However it is extremely powerful in the number of things that it can do and the time spent learning how it works will not be wasted as you will become familiar with many useful UNIX tools GMT is capable of producing very nice maps and plots Let39s start with an example You will ALWAYS want to run GMT as a UNIX script dogmt1 Ibincsh pscoast R03609090 JQ1806i B60g30 P Dc G200 gtmapps In this case we begin with quotIbincshquot to invoke the Cshell environment or a Ibinbash to invoke the bashshell environment Next we enter quotpscoastquot which is the GMT program that draws coastlines This program has various options that in UNIX style are invoked with a dash and a letter on the same line eg P Dc etc The output of the program is directed to the Postscript le quotmappsquot Now let us examine the arguments R03609090 This sets lon10 lon2360 lat190 lat290 Note that we could have written this with a space between the quotRquot and the zero quot0quot immediately following Most people leave this space out to more easily separate the different commands JM1806i This specifies the map projection to be cylindrical equidistant a simple linear scaling of latlon The center meridian is set to 180 degrees the plot width is set to 6 inches the means inches A very large number of different map projections are available look through the manual B60g30 This sets the labeled latlon lines to 60 degree intervals and the unlabeled lines to 30 degree intervals COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 P Specifies quotportraitquot mode so that the plot is not rotated by 90 degrees as in quotlandscapequot mode default Dc Sets the resolution of the coastline to quotcquot for crude This is all that is required for a small map of the whole globe For larger maps or closeups higher resolution will be required The available options are full high intermediate Dow and crude Note that the full resolution les require over 55Mb of data and provide great detail This generally should only be used for extreme close ups Default is low resolution G200 Specifies the grayshade level for the continent shading from 0 black to 255 white These nonintuitive units are a Postscript convention How might we improve on this plot The plot is not centered on the page because the default position for the lower left corner is at x1inch y1inch We can change this by specifying the x and y positions directly X12i Y4i Set the lower left corner to 12 inches from the left edge and 4 inches from the bottom We may decide that we don39t want latlon lines drawn on the plot so we remove the quotg30quot from the B command B60 label latlon every 60 degrees We may prefer a smaller font We can do this with a different program which we run before calling pscoast gmtset ANOTFONTSIZE 10 The resulting script is dogmt2 Ibincsh gmtset ANOTFONTSIZE 10 pscoast R03609090 JM1806i B60 P Dc G200 X12i Y4i gt mapps Next suppose we have a file containing the coordinates of some seismic stations which we wish to plot on this map The le is called stationlist and its rst ve lines are 902920 3876560 2442 AAE 4263900 7449400 1645 AAK 3793040 5811890 678 ABKT 5188370 17668440 116 ADK 1390930 17177730 706 AFI Here is a script that will plot these points on our map COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 dogmt3 Ibincsh gmtset ANOTFONTSIZE 10 pscoast R03609090 JM1806i B60 P Dc 43200 X12i Y4i K gt mapps psxy O R JM1806i St006i GO stationlist gtgt mapps The rst part of the script is the same as before except that the K is necessary to tell GMT to keep the Postscript le open ie don39t do a quotshowpagequot so that more can be added to the le Next we use quotpsxyquot to read and plot the xy points from le stationlist We use quotgtgtquot to append the output onto the end of the mapps le Note that quotgtquot would not work here The arguments of psxy are as follows 0 Indicates that this is a overlay onto an existing Postscript le to avoid the initializations at the beginning of the le R Sets the plot boundaries defaults to those set by pscoast or previous command JM1806i Sets the map projection according to the manual this should work without the 1806i but I do not always nd this to be true St006i Plots xy points as triangles of 006 inch width Other options are circle diamond square inverted triangle xcross and vector In the case of the vector the direction and length are also read from the file see manual GO Set fill parameter to 0 black This will fill in the triangles The number varies from 0 black to 255 white Alternatively color can be speci ed as the Postscript redbluegreen values eg quot325500quot for red This tells the program that the data are to be read as yx pairs The default is xy or longlat in our case For seismology this option is very useful because coordinates are usually given as latlon rather than the other way around Note that the program automatically converts the longitude convention of the data points 180 to 180 to the longitude convention of the map 0 to 360 This is a nice feature of GMT Next let39s try a different map projection plot the points in red and add a title dogmt4 bin csh gmtset ANOTFONTSIZE 10 pscoast R1801809090 JHO6i Bg0quotRS FARM stationsquot P Dc 3150 X12i Y4i K gt mapps psxy O R JH St006i 325500 stationlist gtgt mapps COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 The changed commands are as follows JHO6i Invokes the equalarea Hammer projection with 6 inch width Bg0quotIRIS FARM stationsquot The 0 results in no grid lines or labels The title is set off with and quot weird 325500 De ne the ll for the xy plot as red255 green0 blue0 To my taste the title is way too big This can be changed using the gmtset HEADERFONTSIZE command see below Next let39s look at a closeup of these stations in southern California dogmt5 Ibincsh gmtset HEADERFONTSIZE 20 gmtset ANOTFONTSIZE 10 pscoast R1211143237 JM6i Blg1quotIRIS FARM stationsquot P Di 1 2 3 N1 N2 0255200200 X12i Y4i K gt mapps psxy O R JM St006i GO stationlist gtgt mapps Changes are gmtset HEADERFONTSIZE 20 Set font size for title to 20 R1211143237 Set lon1lon2lat1lat2 to S California JM6i Use Mercator projection width 6 inches Blg1quotIRIS FARM stationsquot Label and draw grid lines every 1 degree Use same title 1 Plot permanent major rives 2 Plot additional major rivers 3 Plot additional rivers N1 Plot national boundaries N2 Plot state boundaries within the Americas 3255200200 Fill land areas with red255 green200 blue200 Next let39s add lines that show the traces of mapped faults in southern California For this we use a file called quotcalif tsquot that has the following format COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 3700000 990000 1155496 329312 1155419 329142 1155358 329029 1155276 328890 3700000 990000 1159218 329916 1159096 329849 1158936 329745 1158729 329655 1158398 329498 1158216 329410 1157983 329295 1157796 329228 3700000 990000 1158391 330127 1158205 330069 1158017 330015 1157892 329973 etc The faults are defined as lonlat pairs A value of 37099 is used to separate the different faults To plot these faults on our map of the southern California stations we can use the psxy command a second time dugmt6 Ibincsh gmtset HEADERFONTSIZE 20 gmtset ANOTFONTSIZE 10 pscoast R1211143237 JM6i B1quotIRIS FARM stationsquot P Di 1 2 3 N1 N2 G255200200 X12i Y4i K gt mapps psxy O R JM M3937039 W825500 calif ts K gtgt mapps psxy O R JM St015i GO0255 stationlist gtgt mapps Changes are BlquotIRIS FARM stationsquot We removed the g0 so we don39t plot grid lines which might get confused with the faults We plot the faults using psxy O R JM M3937039 W825500 califflts K gtgt mapps In this command we use the M option to flag the segment boundaries Introduction to GMT Generic Mapping Tools Nmespmwueu by a KuntevandA GuudWe UA What is GMT A mapping tool commonly used by geophysicists for manipulating and visualizing data Free Has a steep learning curve but worth the climb Available from httpgmtsoesthawaiiedu in a number of flavors There are other programs that will do the same sort of thing but none have the same flexibility Building on your UNIX lesson we will use GMT to create a simple topography map of California Where does the topography data come from Space Shuttle Radar Topography Mission SRTM data ocean floor bathymetry 1 Arcsecond 30 m grids 1km digitized Downloaded from httptopexucsdeduNVWWhtmsrtm30pushtml and converted to a GMT format NetCDF grid B39eseu39d39aoedaoedsyd11q UJOJ Iwius39zexew39wusspMueAo Space Shuttle 39 SRTM A transmit antenna illuminates the terrain with a radar beam which is scattered by the surface Both arrays receive the reflected signal The signal coming to one antenna may have traveled slightly further than that arriving at the other This translates into a phase difference By measuring the phase difference we can determine the angle from which the signal came When combined with travel time we can determine the distance to that point Getting grid grd topography data Mount the geobasegeo5215 server and navigate to the Data folder same folder as your user directories and copy to your desktop the file for the western US topography named w140n40Bathymetrysrtmgrd This file contains data from longitudes 140W to 100W and latitudes 4ON to 108 o Note when you are done for today make a new lab folder on geobase in your personal Labs folder new lab Lab 7 and copy all of your GMT work there Open a UNIX terminal PC users Launch Cygwin then type startxwinbat Use the white bash window that appears to type in the remaining commands Change directories to your Desktop cd Desktop where your grd file should be Type Is to make sure it is there Mac users Launch X11 When the window opens type the following Cp UsersSharedtcshrc you need to copy the le tcshrc to your home directory ls a tcshrc check that it is there tcsh launch the cshell source tcshrc this tells your computer where to find all of the GMT software Now Quit X11 and restart it again Now you are ready to go Change directories to your Desktop cd Desktop where your grd file should be Also type tcsh in your terminal window to launch the cshell again Getting info about your grid grd grdinfo To figure out what the current dimensions of your grd file are use the grdinfo command In you terminal window type grdinfo w140n40Bathymetrysrtmgrd This should generate some vital statistics about the file including the minmax of the x longitude y latitude and z elevation values in addition to the x amp y increments in degrees and the number of x amp y grid cells w140n40Bathmetrysrtmgrd xmin 140 xmax 100 xinc 000833333 units userxunit nx 4800 w140n40Bathmetrysrtmgrd ymin 10 ymax 40 yinc 000833333 units useryunit ny 6000 w140n40Bathmetrysrtmgrd zmin 6031 zmax 4228 units userzunit w140n40Bathmetrysrtmgrd scalefactor 1 addoffset 0 Cut you grd file down to size grdcut Now we can manipulate the grd file in a variety of ways First we39ll chop off some of the data since we39re just interested in plotting California topography for now California is roughly defined by lat 325 to 40 and long 125 to 114 We will use the GMT command 39grdcut39 to chop this grid down to size to make a new g called Californiagrd Type the following grdcut w140n40Bathymetrysrtmgrd GCaliforniagrd R12511432540 V o the R WlongElongSlatNlat flag speci es the boundaries that you want to keep the G ag speci es the name ofthe new grid the V ag means verbose or tell me what you are doing Check what you did by typing grdinfo Californiagrd Note If you have more than one topography data le that you need to stitch together with another if your area of interest falls along an edge ofthe le you can use the 39grdpaste39 command to easily do this as long as the two les have one common edge for more info on grdpaste type 39man grdpaste39 Note For more info on grdcut type 39man grdcut orjust grdcut in yourterminal window Make a shaded illumination le grdgradient To make a nice topography map you ll need to add some information to the map about the slope of the topography GMT allows you to compute a gradient file of the topography that you will use to quotilluminatequot you topography essentially make it look more 3D Type the following grdgradient Californiagrd A0 GCaiforniagradientgrd the A sets the azimuth angle from which to illuminate the topography 0360 CW from North the G ag speci es the name ofthe new grid Just keep this file around we ll need it later Note For more info on grdgradient type 39man grdgradient orjust grdgradient in your terminal window Making a color pallet cpt file grd2cpt Lastly you need to make a color pallet cpt file for you map which will define the color scales to plot your topography data You can define these values by hand but GMT offers a way to directly evaluate your topography file and use these values to make a cpt file Type the following grd2cpt Californiagrd Cseaand Z gt Californiacpt the C sets color table sealand in this case that is stored in GMT s library Type grd2cpt to see a list of these the Z flag speci es a continuous smooth color pallet Note that a new cpt le was generated gt Californiacpt Try other color tables GMT has many available for you to use Type grd2cpt to see a quick list You can also open up the Californiacpt file you made use nedit and edit the numbers by hand if you wish You can also make fancier cpt files with GMT s makecpt command Note For more info on grd20pt type 39man grd20pt orjust grd20pt in yourterminal window Summary So Far grdcut w140n40Bathymetrysrtmgrd GCaiforniagrd R125l114l325l40 V grdinfo Californiagrd grdgradient Californiagrd A0 GCaiforniagradientgrd grd2cpt Californiagrd Cseaand Z gt Californiacpt Don t stop now You re on a roll 11 Make a GMT command le Use the UNIX editor nedit to create a file named maketopomapgmt nedit maketopomapcom amp Reminderthe 8quot at the end puts the nedit command in the background so that you get your prompt back You will now enter all of the commands for making a map in this file You can also enterthe previous grdinfo grdcut grdgradient and grd2cpt commands here too however you ll probably want to comment them out use a sign in front as there is no need to repeat them In the first line of your file type the following lbinlbash PC users lbinlcsh Mac users Stuff that s about to go into your le Draws t basemap VRV 78gt meahs dr makeruuum3p om r UsersBrdq2JDeskKoprsnmtc FHe Edit gearch Ereferences Sheil Mago indows i 5 7 z A hdrcates that the schpt rs a bash or casheH b sb mm MT DEGREE mum ddd m m Sets the format of the map ahhotatroh WSW Apalaasemap R 125 1143254u m15 332f1q1WSen p K vm gt mymapp Name ofoutput postscnpt re e postschpt and the three Shrfts the ptot up by 0 mcrements sometrmes need thrs to center varrabtes 7P pray portrart Keep ithe We open more to ptot J t r N t rthe ter marks on the map 7 annotatrons every 2 degree ter marks f and grrd marks every degree Sets a varabte for the area of the map Sets a varrab e jfor the map PI OJECUOH and state 7 m thrs case the proJectron rs Mercator and the scare rs set at 5 Commands executing and viewing Enter the following commands in your file gmtset PLOTDEGREEFORMAT dddmmssF psbasemap R12511432540 Jm15 Ba2f1g1WSen P K Y10 gt mymapps Macs psbasemap R12511432540 Jm05 Ba2f1g1WSen P K Y1 gt mymapps PCs Now save your file and compile it the first an only time by typing the following commands in your terminal window chmod X maketopomapcom To execute run the program in your terminal window type maketopomapcom Macs bash maketopomapcom PCs To view the current version of your map type gs mymapps Hopefully your map looks something like this depending on the default settings in your 35w version of GMT CtrlC should exit out ofthe map You can edit your maketopomapgmt file for other settings 8 in particular 7 Note to nd other options in psbasemap 124 W 122 W lZD39W HB39W HE W H4 W man psbasemap display the help pages Add Topography mak r L7 manxomr Elle Edit earcn Ereferences Snell Mago indows grdlnfa Canfarnzagr grdgradlent Calzfarnzagrd 7A0 7 7N GCalzfarnzaigr 4 4 grchpt Calzfarnlagrd Csealand 72 gt Calzfarnzacpt Wbmbash gtgt indicates We mmmmmm m m m postscript code pshasem R 125m325Au ms Eazf1g1wsen p K Y1n gt Miami is bein gmng Emma R i E mahmmcpt K u gtgt wisp pi appended to the file created by the previous grdimage will draw a color image of the topography in com Californiagrd using the color 0 means overlay the plot palette C Californiacpt K indicates that this is a layer in a multi layer image Note that the R J B ags are needed but if no change is made simply enter the letters With no additional info Commands executing and viewing Enter the following command in your file grdimage Californiagrd R J B CCaiforniacpt K 0 gtgt mymapps Save your file run it and view it maketopomapcom Macs bash maketopomapcom PCs gs mymapps The Map Changing the Color Palette a O makgmuo apmm UsersEndgetl esktnpsrlmri 4 39N file Edit gearch rsferenbes Snell Macro 39ndows w140n405 hymetry5rtmgrd 7r 511farniagrd 7 g 7 Cali farm gra t Cali ma 9rd 7A0 41 7 t flycgnzamla gr gdeCpt Cahinnumgxd Cxeluf z gt C xfnxmampt fl minbash gmcset may me T aaa m as psbasemap x 125 11 327540 m15 EaZflq1WSen P K v1n gt mvmapvps frillng Callfurnagr a z a Ccahfnm13pt xlt u gtgt WW4 In this case l have used the relief color palette experiment with other palettes You can either enter this command in the terminal window copy and paste or you can issue it in your file and execute all the commands again from there Add Illumination The grchpt command has been commented back out this does not need to be run any more 8 e 8 m3 2 a ma wm muo Elle Edit earch Ereferences Shell Mago indows grdcut wZ40n40BathyInetrysrtmgrd GCalzfarnzagrd 7127125721432 4 grdznfa Calzfarnzagra grdgradlen Calzfarnlagrd 7A0 7 7N GCallfarnzaigradzentgra grchpt Calzfarnlagrd Crelzef 72 gt Calzfarnzacpt Ubznbash gmtset mummjmm mm mm ss pshesemep R125 11A325AEI ms Eer1g1WSen p K mu gt MW grdlmage mhmmmm mahmmigmmtgm x J CCelfarnecpt K u gtgt MW grdimage has had the paramter I added to it This indicates that the resultant image will be illuminated with the le Californiagradientgrd The Map NEW 115w There is now a lot more information in the map you can start to see structures and river channels By changing the A option in grdgradient try recreating the image with different illumination angles Does one angle help us to visu alize structures better than another Add Contours r V 397 7 make to a quot121er ouo EHe gun earch Ereferences She Mago mdows d iGCalzfarnzagrd 7R712571143Z grdznfa Callfarnlagra grdgradlent Calzfarnzagrd 7A0 7 7N GCalzfarnzaigradzent9rd grchpt Calzfarnzagrd Crelzef 72 gt Calzfarnzacpt Ubznbash gmtset PLUTinEGREEJ EImT aaa mm ss pshasemap R125 11A325AEI m15 E32f1glwsen p K m gt mymapps C ahfaxmacpt xlt u gtgt mymapps grdlmage Cahfarmagrd ICalfaxna gradentgxd x J grdcantaur Cahfarmagrd c5nn x V K gtgt mymapps grdcontour creates a layer in the postcript le that will display contours every 500 m 05 The Map Add A Color Scale tom r7 r makemumll le Edit earch Ereferences Shell Macro M dows 4 grdcut wZ40n40Bathymetrysrtm9rd GCalzfarnlagrd 7127125711432 4 grdznfa Calzfarnlagra 4 grdgradzent Calzfarnlagrd 7A0 7 7N GCallfarnlaigradzent9rd 4 grchpt Calzfarnlagrd Crelzef 72 gt Calzfarnzacpt Ubznbash gmtset PLEITinEGRlZEJ EIMT aaa mm ss pshasemap R125 11A325AEI m15 E32f1glwsen p xlt m gt mymapps grdlmage Cahfarmagrd mamamnignmencgm x J CCalfarnacpt xlt u gtgt mymapps grdcantaur Cahfarmagrd c5nn x J u v xlt gtgt mymapps pascale CCalfarnacpt n8 2 l U5h Eznnn meters u xlt gtgt mymapps The bar is labeled every 2000 m and annotated with meters psscale draws a color bar using the color palette CallfornIacpt This Is the location In the plot space x 8 increments y 2 increments and size 10 x 05 increments h indicates that the bar is horizontal The Map HB W 11s w 11 mews 74000 720m 0 2000 4000 Add the Location of a Study Site ya egapajupmm r insersiggaqstinsskmpismquot l k File Edit earcli Ereferel ices Shell Mago windows SX lots 7 p yp t 2 MW 2r trysrtmzzd a ijnrJJarjrd a pomts on i m m ii 1 a 51 gums Adam sng 40 w 7N lyCall IrI Ilaiyr maps usmg a grchpt Calzfarnzagrd Crelzef 72 gt Calzfarnzarpt number of awbznbash different when mammajnmw add mm 351 methods see pshssmp R125 114325AEI ms Eazf1g1wsen p K nn gt mapps an psxy was mummy ushnmwsmmgm R J msmumws i Typically we grdcnntnur Dahfnrmatgrd c5uu 39R J u v ilt gt3 wisp would read Wests msmmmcps n8 21Un5h mum Mm u K gtgt may these points psxy siteilacatmnniat R 1 sau7 w1pEI n255 u K gtgt impps fro sitelocation A star sa with a The line The color fill is den psxy can 07 inch diameter thickness of the the Star 395 Wh39te also be used is drawn star is 1 point 2 to plot 3 1p and the line regular graph is black 0 Data inside sitelocationdat 120 37 take a look this le is also on geobaselsz15Datal The Map Note that colors in GMT are specified in RGB format thus 25500 is red 02550 is green etc You can mix colors to create the color of your choice By changing the G option in psxy change the color of the star for example GZ5500 would make the We star red 74000 720m 0 2000 4mm HB W Add a Title 39 39 and m o n 39 ak u m7 EHe gdn earch Ereferences She Mago mdows grdcut WZ40n40BathyInetry5rtIn9rd GCallfurnlagrd R39 4 grdznt a Calzfarnzagra 4 grdgradzent Callfarnzagrd 7A0 7 7N iGCalzfarnlaigraz 4 grchpt Callfarnzagrd argue 72 gt Callfarnzacpt Wbmbash gmtset pLuummgumw mm mm ss pshasemap R125 11A325AEI m15 E32f1glwsen p K mu gt MW grdlmage Cahfarmagrd ICalfaxna gradentgxd x CCalfaxna up gxdcantaur Cahfarmagrd c5nn x V K gtgt mymapps pascale CCalfarnacpt DE21EID5h Eznnn meters xlt gtgt mymapps psxy slteilacatmndat x SEEIJ 39WlpU 3255 xlt gtgt mymapps pshasemap x J a Chfaxma Tapagxaphy u xlt gtgt mymapps Add a map title using the psbasemap command enter it a er the B ag The Map California Topography WN Ita w 116W 114W mexers 4mm 720 a 2m 4mm Add Some Text to the Map ptext plots text Typically we read text strings from a file textdat This is the longitude and latitude at which the text will be plotted is 14 points plotted horizontally 0 degrees make to L7 39 Elle gait earch Ereferences Shell Mago windows 4 grdcut WZ40n40BathyInetrysrtIn9rd GCalzfarnzagrd 7 4 grdznfa Calzfarnzagra 4 grdgradzent Calzfarnzagrd 7A0 7 7N GCalzfarnzaigrt 4 grchpt Calzfarnzagrd Crelzef 72 gt Callfarnlacpt Ubznbash gmtset PLEITinEGREXZJ EIRMAT aaa mm ss pshasemap R125 114325AEI m15 E32f1g1WSen p K mu gt MW grdlmage Calfaxnagxd mahmmigmencgm x J CCalfarnacpt xlt grdcantaur Calfaxnagxd n5nn x J u v K gtgt MW pas2312 CCalfarnacpt DB 21UD5h Eznnn meters u K gtgt MW psxy slteilacatlandat x J san7 W1pE n255 u K gtgt MW pshasemap x J a Cahfaxma Tapagxaphy u xlt gtgt mymapps pstext textudat x J G255nn u xlt gtgt mymapps The text will be red 25500 Data in side textdat take a iuuk misme lS alsu un genbaseSZlEData 12200 380014 01 CM SanFrancisco 11800 345014 01 CM LosAngeles kl Text to plot 11700 330014 01 CM anDiego Font number 1 helvetica will be used The font size The 9 Will be The text will be centered CM on the point 30 COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 POWERPOINT PRESENTATION TIPS Both GSA and AGU have standard recommendations regarding structuring a scientific presentation Gen They suggest the following slide structure A title An outline of the talk An introduction background Material and methods or approach Results Discussion of results Conclusions and sometimes acknowledgements eral tips Graphics must be well designed simple and legible to everyone in the audience It is important to know your audience and prepare accordingly The shorter the presentation time the greater the effort required in preparing supporting PowerPoint slides and in practicing the presentation If given 15 minutes for a presentation one should take no longer than 1011 minutes so that there is time for questionsdiscussion This means that each slide must have maximum impact in helping you communicate with the audience A general rule of thumb in preparing PowerPoint slides is no more than one slide a minute one idea per slide and as few lines of text per slide as possible Presentations are most readable on a dark background blue for example and bright lettering yellow or white It is helpful to step 810 feet back from your computer screen and make sure your slides are legible Avoid using small fonts that will be illegible from the back of the room and break up a complex slide into a series of slides Devote each graphic to a single fact idea or finding Illustrate major points or trends not detailed data Avoid long or complicated formulas or equations Each graphic should remain on the screen for at least 20 seconds Use the minimum number of words possible in titles subtitles and captions Standard abbreviations are acceptable Use bold characters instead of fancy fonts Table preparation Use not more than three or four vertical columns or more than six or eight horizontal rows Information is hard to read with more columns or rows Avoid vertical or horizontal rules as they distract the eye and clutter the graphic Whenever possible present data using bar charts or graphs instead of tables MATLAB Quick Guide Symbol Name Description Example Command help help Help menu for any command or Help symbol in MATLAB Help sum comment MATLAB comment symbol 1 comments herem MATLAB will skip any line this will all beginning with the symbol a be ignored a except for the a l multiply Symbol for multiplication i divide Symbol for division b 5 1 I semicolon 1 Tells MATLAB to suppress the g g i 2 a a output do not print value A l I 2 I 3 4 I equation etc to screen 2 I 0 1 2 Also used to separate rows in a matrix plot plot Plot a 2D grapth xy PlOtXryr 0 clear clear Clears all variables in memory if Clear given an arguments will just Clear f g h 3 clear those speci ed variables clc command Will clear the command line Clc line clear display but will not erase You Will be given a Clean memory command line fopen fopen Commands for opening a le See examples in Lab fprintf printf close printing to it and closing the le fclose hist histogram Command for plotting a j hist g histogram from the input values quot caret hat Raised to the power oF C a A 2 sqrt square root Command for computing the e sqrt C square root pi 7 Mathematical symbol for a Pi 31415926 whos whos Command that lists all of the Whos variables de ned in your current Prints information for MATLAB session a b C A C 639 em inv inverse Computes the inverse of a matrix D inquot C i 39 transpose Computes the transpose of a D C39 matrix shortcut for D tranSpose c transposex Introduction to Adobe Photoshop m l Raster Images vs Vector Graphics Raster images are made up of a grid of dots known as pixels When working with raster images you edit pixels rather than objects or shapes Raster images are the most common electronic medium for continuoustone images such as photographs or scanned images because they can represent subtle gradations of shades and color Raster images can lose detail when scaled onscreen because they are resolution dependent they contain a xed number of pixels and each pixel is assigned a speci c location and color value Raster images can lookjagged if they39re printed at too low a resolution because the size of each pixel is increased 3924 Example of a raster image at different levels of magni cation Vector graphics are made up of mathematically de ned lines and curves called vectors This means that you can move resize or change the color of a line Without losing the quality of the graphic Vector graphics are resolutionindependent that is they can be scaled to any size and printed at any resolution without losing detail or clarity As a result vector graphics are the best choice for representing bold graphics that must retain crisp lines when scaled to various sizes logos for example 24 Example of a vector graphic at different levels of magni cation Pixel Dimension and Image Resolution The resolution of an image is determined by the number of pixels per inch ppi printed on a page In Photoshop you can Change the resolution of an image by using the menus Image gt Image Size Example of an image at 72ppi and 300ppi A a c Printing the same lowresolution image at different sizes A Small print size B Medium print size C Large print size Create a Transparent Image using Adobe Photoshop 1 Open your image in Photoshop Launch Photoshop Select FileOpen Choose the le logobmp and click Open The le opens in a separate document window 2 Now select the background area of the image the area you wish to remove If the image background has a solid color white in our example select the Magic Wand Tool W or click in the toolbox Be sure to specify Tolerance10 Antialiased and Contiguous in the selection options dialog box on top under the menu You may need to adjust the tolerance value it depends on your image When done click in the bac gro area f the image 6 3 A selection dashedline appears around the logo and around the square border of the image It means that the background is selected not the logo If the background is not ade of a solid color you can select it by using the Polygonal Lasso Tool L or click It39s a bit more dif cult but that39s the only way to proceed 4 Now we select the logo only To do so choose SelectInverse ShftCtrlI It39s almost unchanged but the dashedline around the square border of the image has disappeared 5 Choose EditCopy CtrlC then EditPaste CtrlV to create a new layer with the quotextrudedquot logo in it The quotlayersquot list has been updated see below The new layer which is selected appears at the top of the list 8 The original image is present in the background 9 Now we39ll hide the original image by clicking on the quoteyequot button of the background layer 9 If you want you can also delete it by draganddrop it on the trash at the rightbottom corner of the list Checker ad I iron 6 9m ren39i quotIquot quotquot0quotquot quot9 irm emet l ind325 6 The image document now looks like shown below The background area which was White has disappeared Now you see a graycheckboardlike texture around the logo 0 indicating that this area is in fact transparent 7 I recommend to save the image to another le to keep the original one intact Select quotFileSave Asquot In Format box select quotPNGquot Click Save Select Interlace quotNonequot click OK Manipulating Graphics 1 Adjusting the Brightness and Contrast a o Some images can be improved by simply adjusting the brightness and contrast Click Image in the top menu choose Adjust and select BrightnessContrast A window like the one below appears Move the sliders right to increase Hquot hme ft nha brightness or contrast left to decrease Check the Preview box to see what your image will look like Uncheck it to see the original image Click OK when you are happy with the adjustments 2 Auto Contrast DJ o A simple way to adjust the contrast is to let the program choose the correct contrast Click the Image in the top menu choose Adjust and select Auto Contrast The contrast of the image has been changed If you are not satis ed with the results click Edit on the top menu and choose Undo Auto Contrast Levels One of the most powerful tools in Photoshop is the ability to manipulate the light and dark portions of your picture This provides much more control that the BrightnessContrast adjustments Click Image on the top menu choose Adjust and then select Levels A picture appears like the one below This is visual representation of the darkness and lightness in your picture Move the light arrow left to make the lightest areas of the picture even lighter Move the dark arrow right to make the darkest areas of the picture even darker Move the middle arrow to change the midtone colors in the picture Leftlighter rightdarker Click the Preview checkbox to see the effect on your actual picture Click off the Preview checkbox to see your original picture If you are not satis ed with the results click the Cancel button to return to your original picture If you are satis ed with the results click the OK button to accept your changes 4 Auto Levels A simple way to adjust the levels of a picture is by using the Auto Levels command The program makes the adjustments for you Usually the results look great Sometimes however the picture ends up being worse than when you started Click Image in the top menu choose Adjust and select Auto Levels 39 The levels of the image have been changed If you are not satis ed with the results click Edit on the top menu and choose Undo Auto Levels Adobe Photoshop 5 COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 LAEI MATLA MATLA INTRQUCTION Matlab is a commercial product that is used widely by students and faculty and researchers at UTEP It provides a highlevel programming environment for computing with a special emphasis on matrix operations Many specialized functions are hard wired into Matlab so there is no need to use subroutine libraries for these tasks It is also very easy to make plots of Matlab output many plotting functions are also built into the program Matlab is available for PCs Macs and UNIX workstations The student version of Matlab currently sells for about 100 at the UTEP bookstore We have a site license for Matlab on the department network however this is limited to university computers only Matlab is more userfriendly and easier to learn than standard languages like Fortran and C It is good for many problems but ultimately does not have the flexibility of C or Fortran Complicated Matlab scripts will often run much slower than the Fortran or C equivalent Matlab is well documented with online help look to the menu bar when you are running the program There are also many books written about Matlab that you may nd useful if you become a serious user The following is a brief introduction to help you get started and to demonstrate some of Matlab s capabilities Matlab can be used interactively as a super hand calculator or more powerfully run using scripts ie programs gt PCs A Matlab icon can be found on your desktop gt Macs Go to Macintosh H gt Applications 9 Matlab 9 and drag the Matlab icon to your doc for future use Start Matlab and several blank screens including a Command Window should appear Notes compiled by B Konter UTEP andP Shearer UCSD COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 MAi 743 RZUDFAT File Edit View Graphics Debug Desktop Window Help DE Shortcuts 3 How to Add 1 What39s New 511 1 Name A X H G 7 v ri v 5 Value LranstormaLion iqurm Lranszoz maLio i m 4 1 I 4 Start 10 gtgt At the gtgt prompt one can directly enter commands following is one way to compute 22 compuLECDvarlance i u CompuLeicovariance G El 2 Current Directory lApplrcauonsMATLABM Ll Q E x a v x a Til 39 Stack 0 To get started select MATLAB Help or Demos from the Help menu X Min M 2 Command w1ndow 4 gt 1 v D Prompt and easy addition As an example the Try it you enter the bold black info and Matlab returns the gray info gtgt 2 COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 2 The semicolon It is often annoying to have Matlab always print out the value of each variable To avoid this put a semicolon after the commands gtgta2 gtgtb2 gtgtcab gtgtC 3 Only the final line produces output Semicolons can also be used to string together more than one command on the same line gtgta2b2cabc 3 More complicated math Now try an example for computing a quadratic equation which includes multiplication division squareroot sqrt and powers A Also note that parentheses are used to determine the order of operations gtgta2 COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 gtgt b 12 gtgt c 16 gtgt quadl b sqrtb 2 4ac 2a quadl 4 More complicated math Trig functions Trig functions are also supported by Matlab Note that the arguments of trig functions must be in radians not degrees gtgt y sin pi6 y 05000 Note that pi is hardwired to the value of pi 314 you don39t have to set this 5 Whos what are my variables To see all the variables currently de ned in Matlab s current session that you entered use the whos command gtgt whos Mame Size Bytes Class a 1X 8 double array 13 1X 8 double array r 1X 8 double array quad 12X 8 double array y 12X 8 double array To remove all variables from memory use the clear command gtgt clear COMPUTER APPLICATIONS IN THE CEOSCIENCES quot FAH2008 quot gtgt whos gtgt iii 6 Using a Matlab script Wm file A script is a text file containing lines of Matlab commands eg testscriptm To run a script simply type the name of your script but without the suffix at the Matlab prompt gtgt testscript By doing this Matlab simply executes each line one at a time exactly as if you had typed each line into the command window In your script you can create lines beginning with a sign which are understood by Matlab to be comments about the code and are ignored Example o At the first line of my code I should always put my name At the second line of my code I should enter a description of what the program is going to do o o A script can be written with the builtin Matlab Editor or you can open up an existing script that someone gave you Here you will do both First make a new Lab6 folder in your geobase directory and copy to the Lab6 folder yes please copy the following file from Bridget s geobase folder bkonterMatlabstufftestscriptm To run a script you need to tell Matlab where to look for the m files that you want to run To do this you ll want to set the Current Directory to your working folder so for this exercise it will be your Lab6 folder on geobase In the top Matlab window look for the icon see below and click on it to navigate to your Lab6 folder File Edit Debug Desktop Window Help DE E fa CurrentDnectoryEGEOSZleyourdirecmwLabbi Shortcuts Howm Add 1 What39s New I v a L Next you will need to open up the Matlab Editor window Window 9 Editor COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 A new separate window should appear Now open the testscriptm le File 9 Open 9 select testscriptm Familiarize yourself with the content of the script read through it then run the program in the Matlab window by typing gtgt testscript What did this program do Draw a sketch of the resulting gure of testscriptm program below 7 Creating a new Matlab script m file Next you will create a new Matlab script to plot an example set of xy data points The le with these example points is called testdatadat and is located in Bridget s Matlab folder Copy this le to your own Lab6 folder Open up testdatadat le in the Matlab Editor to inspect its contents File 9 Open 9 testdatadat The rst column of the data will be the x column pretend it is earthquake COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 depths and the second column of data will be the y column pretend it represents earthquake magnitudes You will use these values to create an xy pbt Contents of testdatadat 100 30 150 33 50 13 200 59 220 67 40 11 300 58 100 39 120 72 60 33 140 22 First open a new Matlab file in the Editor window File New MFile Type the following commands in the Matlab file yes all of them Matlab script to practice loading a simple data file and creating an x y plot first load the sample data file named testdatadat load testdatadat assign the first column of this file to be quotxquot values The following syntax says grab quotall rowsquot of the quotfirst columnquot 1 of the file testdata x testdatal next assign the second column of the file to be quotyquot values y testdata2 now check to make sure the data was loaded properly whos now plot x vs y and label each data point with a red COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 symbol I can type quothelp plotquot for other symbols and colors to use figurel opens up the first figure window plot x y r plot x vs y grid this enters a grid in the figure xlabel earthquake depths km label the x axis ylabel earthquake magnitudes label the y axis title Earthquakes in the xxx add a title Save your Matlab file with the name myscriptm File 9 SaveAS Now copy each line line by line that does not begin with a sign into the Matlab window Observe what each line does Next clear Matlab type clear and close the Figure window Now run the entire script at once by typing the name of your script without the m into the Matlab window and hit return Congratulations you have just created and executed a Matlab scriptlllll To save your Figure to a le click on the following in the Figure window File 9 SaveAs 9 name it myscriptfigure and select pdf option for File Format 7 Performing math operations on a column of data Now you will practice a few math operations just like you did in Excel by treating each of your data values as a column that you will operate on In the previous step you stored all of the rst column of data as x and the second column as Below are the steps for calculating the average of each and then normalizing dividing your data by the average Matlab has a builtin function for computing the average or mean of a data set First calculate the average of the xvalues you can handtype these in or append them to your Matlab script above gtgt avgx meanx Matlab returns enter it here COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 Now calculate the average of the yvalues gtgt avgy meany Matlab returns enter it here Divide x by avgx and call this a new variable gtgt normx xavgx Do the same for the y values gtgt normy yavgy Now print your new and old values to the screen gtgt x y normx normy To save these values to a file assign all of them one name newvals and print the 4 columns to a file Below are the commands to use You will need to transpose your data columns using the 39 command to ensure that the fprintf command below writes the data in the correct order gtgt newvals x y normx normy transpose here gtgt fid fopen39mytestdatadat w gtgt fprintffid 62f 62f 62f 62fn newvals gtgt fclosefid Note that in the above fprintf statement you rst give Matlab the command to open up a new empty le You specify the name of the new le with the rst entry mytestdatadat You also tell Matlab that you want to write to the new le with the w entry Then you issue the printtothisfile statement with the fprintf command The d entry just reminds Matlab where it stored the name of the new le in memory A series of 62f are entered which represents the format of each column that you are saving to the le along with how many decimals to round to If you were going to save 5 columns to a le you d include 5 62f entries with the last one followed by a n as in the example above this means start a new line after the last column Last you enter the name of the COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 variable in Matlab that you want to print to the le In this case you assigned the name newvals for the variable holding the 4 columns of data For more information on the fprintf command type help fprintf Finally you close the le that you rst opened with the fclose command 8 Now you39re on your own Following the steps above you will now use a real data le the earthquakes you retrieved from the USGS website for the Excel Lab to load into Matlab plot the data calculate the normalized depths and magnitudes print the new values to a new le First copy the le called USGSearthquakesdat from Bridget s geobase Matlab folder to your Lab6 folder Open this file up in Matlab s Editor window and review the contents The columns are arranged in the following order Date YYYYMMDD Latitude Longitude Depths km Magnitudes Step 0 Write a Matlab script name it m that contains the commands for performing the following steps Make sure you check your script by running it in Matlab Also make sure to provide thorough comments in the script denoted with a symbol that tell me what you are doing at each step Step 1 Load the USGSearthquakesdat file in Matlab and assign variable names to each column of data Hint gtgt date USGSearthquakes 1 Step 2 Plot the Magnitudes vs Depths of you data Magnitudes should be along the horizontal axis and Depths along the vertical Plot each data point as a magenta m diamond Give your plot x and ylabels a title and a grid Save this plot as a pdf le Step 3 Calculate the average of both your magnitudes data and your depth data Then use these values to calculate normalized magnitudes and depths COMPUTER APPLICATIONS IN THE CEOSCIENCES FALL 2008 exactly as you did in Excel and in the previous example Step 4 Assign a variable to store all of your original data plus the two new columns of data normalized values you calculated Hint gtgt newdat date latitude longitude mag depth normmag normdepth Step 5 Print the above original data new data variable to a file Use the fprintf commands as given in the previous example Step 6 Post the following les to your ComputerClass folder on the web myscript gurepdf the figure resulting from running myscriptm mytestdatadat the new test data le you printed with the normalized values Earthquake Figure the gure resulting from above Section 8 Step 2 New Earthquake le the new le resulting from above Section 8 Step 5 Extra Credit 1 What significant event is captured with this data How do you know Extra Credit 2 Try using the histogram function of Matlab Look up the histogram function hist with the help command and then use it to plot a histogram of your original earthquake depths and your original earthquake magnitudes 2 separate histograms You can choose to bin the data however you like but it should make some sense For full credit label your axes with UNITSIII give your plots sensible titles print them to pdf les and post on your website
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'