Introduction to Oceanography – Krause/Lachenmyer/Marquez Laboratory 1a: Microsoft Excel and oceanographic data entry Why Excel? Spreadsheets are extremely valuable for data entry, manipulation and analyses. While other programs are available, Microsoft Excel is used by nearly all the oceanographic community and has the added benefit of being flexible to accommodate many file types (e.g. various text formats). Newer versions of Excel also allow you to input and manipulate considerably larger datasets (e.g. 250,000 rows x 50 columns). While not the preferred software for crunching massive datasets (e.g. numerical models, satellite and/or physical oceanography), mastery of Excel is a valuable tool for any application requiring organization of data. Additionally, most open-source spreadsheets have very similar functionality to Excel. Outcomes: - Manually inputting data - Equations - Manipulation formats - Importing data - Graphing - Manipulating data Carbon-14 example: - Manually input this table into Microsoft excel (in columns A and B), please include the column header variables 14C activity Depth (Disintegrations per (m) minute) 0 3,800 5 5,932 10 6,272 15 7,563 20 5,219 25 2,585 30 1,735 40 731 50 326.0 75 100.0 100 56.5 - Use column C to apply blank correction to carbon-14 activity measurements. Assume the blank is 56 DPM (disintegrations per minute). o In cell C2 write: “=B2-56” Note: any time you make an equation in excel, it must start with “=” Operators include (but not limited to): Addition “+” and Subtraction “-“ Multiplication “*” and division “/” Click , for Excel’s expansive list of built-in equations o Click on cell C2 and look for little black box in lower right hand corner: o Put cursor over bottom right hand corner, then click and drag box down to C12, this will auto-fill our cells with the same formula (i.e. applies the blank correction to all cells) o Type “Blank Corrected Counts” in C1 as column header o Highlight cells C2 through C12, right click and select “format cells”: o In the “Number” tab, Select “Number” category, and make “2” decimal places o Select all three columns worth of data: o On “Data” tab click “Sort” o You can use this option to sort on multiple criteria, allowing you the flexibility to organize your dataset. In this example, we sort things first by “Depth,” selecting values be oriented from largest to smallest, then a second level criteria is by 14C activity (from largest to smallest) o This yields the following: o Now you know how to manipulate/sort data, click the “undo” button in the upper left corner to turn your dataset back to its original format. - A vertical profile: o Click the “Scatter” feature in “Charts” submenu on the “Insert” tab o Right click on the empty graph and click “Select Data” o Click “Add” button in “Legend Entries (Series)” o Fill in this box: o Instead of typing you may also click each box (i.e. Series Name, Series X values, Series Y values) and click-drag the appropriate cells. o Now you have a graph o Right click anywhere on the y-axis and select “Format Axis” o Check the box that says “Values in reverse order” o o This lets you display the profile with the surface values being at the top of the yaxis and the deeper values being at the bottom (mimics the orientation of the ocean) o Select the chart, and in “Chart Tools” Layout button, add axis titles to the horizontal (i.e. x) and vertical (i.e. y) axes o Next add a line to connect all the scatter points: Right click on actual data point Select “Format Data Series” On “Line color” option, select “Solid Line” o Your final chart should look something like this: Data Import Example: - Manual entry of data is time consuming and can be boring. Such a combination makes large datasets, which were entered manually, potentially rife with errors. If an instrument gives you a dataset, it is easier (and faster) to import it directly into excel from a text file. - Put this text file (from Sharepoint) on your desktop: “Lab1a_Test.txt”, this is a tabdelimited text file, which means that in every row, individual data points (i.e. columns) are separated by a “tab” but this can also be done using a comma, semicolon, space or a user-defined separator. Using a separator is VERY important because it tells Excel how to identify individual data elements in a text file. Text files are low memory and the typical way data is archived long term. - From Excel, import this file: o On “File” tab, click “Open” o Navigate to the Desktop o Be sure “All Files” is selected in the right drop-down menu o Click on “Lab1a_Test.txt” and then click “Open” o This brings you into the “Text Import Wizard,” there are three steps you need to do. First, select “Delimited” and then click next Second, select “Tab” as the “Delimiter” (Default) and then click next Third, keep all columns in “general” format, and click “finish” Now you have imported all three columns of data, with each column having 250 rows of data following the header row. Now you may move on to the assignment. Field Data Hydrocast Assignment: - Now that you have some practice on entering/importing data, doing rudimentary equations, manipulating formats, data and graphing, it is time for your assignment. - Using this tab-delimited file: Hydrocast_Dataset.txt, please do the following: o Import into Excel o Sort data by “Hydrocast” (there are three in this file with varying amounts of rows), then depth (smallest to largest) o Make four vertical profile plots (one for temperature, salinity, density, oxygen) Have all three hydrocasts on each profile (e.g. temperature for all three hydrocasts on same plot, and so forth for salinity, density, oxygen) Add axis labels, appropriate units Because of the large number of depth points, express each profile as a line instead of a series of symbols o Calculate the gradient (rate of change per meter) of density in the upper 100 m for each profile, and insert these data in an adjacent column: For example - Use the drag down feature to fill all the cells (as above) Add another column (e.g. column G, where column H is now for oxygen), and calculate the difference in density for all depths between 3 and 100 m, relative to the value at 3 m (e.g. 4m density – 3m density, or 20m density – 3m density) Hint: for hydrocast three try using this equation in cell G3: o “=G3-$G$3” o Then use the drag down feature for the rest of the profile o By inserting the $ before and after the G, it tells excel to lock both the column and row o NOTE: because this is a gradient, you should have one less value in your new column than your original total. That is, the gradient is a calculation between two depths; therefore, you cannot calculate this at the shallowest depth (i.e. nothing shallower for comparison). o Questions: The mixed layer depth can be defined as the depth where the density difference between it and the surface is, or exceeds, 0.1 kg m-3. The pycnocline is the zone where the rate of change in density (i.e. what you just calculated) is highest. TO DO: for each profile, please indicate the depth of the mixed layer and the depth(s) of the pycnocline. For this assignment (i.e. just the “assignment” section), please put all graphs and answers in a word document and email to the instructor.