Home
Research Projects
Classes GEOS 293/393 Hawaii Field Course GEOS 436/636 Beyond the Mouse GEOS 602 Geophysical Fields GEOS 620 Geodynamics GEOS 655 Tectonic Geodesy GEOS 692 Geophys. Seminar
Current & Past Students
Student Opportunities
Curriculum Vitae
Recent Publications
Info for Surveyors
Personal Info

Climb higher, beyond the mouse...


Beyond the Mouse LAB 5: MATLAB I/O 1

September 26, 87

Instructor: Jeff Freymueller

x7286 Elvey 413B jfreymueller@alaska.edu

TA: Shanshan Li

Last Updated: September 12, 2017

Due: Tuesday Oct 3, before class

Lab slides

NONE.

Exercise 1:

Download the file FAIR.pfiles.txt and open it in a text editor (could be Matlab's editor) to have a look at it. It's again a file that contains daily positioning solutions for the continuous GPS site FAIR. This is a more or less typical text file, the sort will likely cross your path at some point in your future. There's one header line documenting the meaning of the columns, a bunch of columns and many, many rows of data. Here's again what the columns mean:

epoch (decimal year) | GPS Site | Tie Site | Longitude (deg) | Latitude (deg) | Height (m) | Sigma_east (mm) | Sigma_north (mm) | Sigma_vert (mm) | cov_en | cov_eu | cov_nu | path to solution file

Your job is it to write a script that reads the whole file. Skip the one headerline by setting the right parameter-value-pair (read the documentation!) -- you are not allowed to remove it manually from the data file! Then your script will write the columns epoch, lon, lat, and height into a new file FAIR2.dat. Once this works add the site 'FAIR2' to your station definition cell array from the lab 04 and run the script to plot the data. It should be fairly similar to station FAIR in the vertical. The latitude and longitude trends will be different because the reference for velocities is different -- the files we gave you earlier had the motion of the North American plate removed.

The purpose of this exercise is in having you figure out what format strings to use, how to put one together, and to decide which function to use for reading and writing your data. Plus some documentation reading.

Exercise 2:

Take the script you've just written and turn it into a function decimate_data that has two parameters, the name of the input data file and the desired name of the output file. There is no need for a return value here. Adapt your code from the script such that it uses these parameters rather than operating on hardcoded file names. Then write a script that calls decimate_data for FAIR.pfiles and creates FAIR2.dat. I encourage you to use try-catch to make sure your code does not just crash when a file does not exist.

Summary questions

(no need to implement these, think about them and write out your answers)

Assume your plotting routine from LAB 04 remains stable, but the respective station data you want to display will vary. What would be a reasonable step to avoid having to edit the gps_station cell array at the beginning of your script every time the stations you want to display change, AND you don't want to display all available stations, but only a subset of them? For example, if you want to read and plot only the ones that you have not made plots for already?

Now assume your data lives in different directories. How could your change your solution for LAB04 to accomodate such distributed data? Hint: Think back to the part of the solution for the flow chart problem from Lecture 1 and 2 that dealt with lecture number and dates.

Stuff to turn in (I recommend sending in an archive):

Helpful Matlab Functions:

Here is a list of functions that might be of help.


Dr. Jeffrey T. Freymueller
Professor of Geophysics
Geophysical Institute
University of Alaska, Fairbanks
Fairbanks, AK 99775-7320

jfreymueller -at- alaska.edu
Phone 907-474-7286
Fax 907-474-7290
Office 413B Elvey