EAS-591T –Space Geodetic Measurements of Active Crustal Motions




Unix: basic commands

UNIX is an operating system, i.e. it manages the way the computer work by driving the processor, the on-board memory, the disk drives, keyboards, video monitors, etc. and by performing useful tasks for the users (if asked to do so!). UNIX was created in the late 1960s as a multiuser, multitasking system for use by programmers. The philosophy behind the design of UNIX was to provide simple, yet powerful utilities that could be pieced together in a flexible manner to perform a wide variety of tasks.









Basic tasks:

Login, logout, the working environment

uname, hostname, whoami, who

File management: ls, cp, rm, mkdir, rmdir, compress (permissions)

Man pages

Ssh (telnet) and ftp


variables, echo, @

     set day = 1

     echo $day

     echo $day > junk

     echo $day > /dev/null

     @ day = $day + 1

     echo $day >> junk

     cat junk



     if $day == 2 then

           echo “you win”


           echo “you loose”




     set day = 1

     while ($day < 10)

           echo “This is file $day” > file.$day

           @ day ++




     foreach f (file.*)

           echo –n $f

           cat $f




     grep SJDV itrf2000.txt



     grep SJDV itrf2000.txt | awk ’{print $0}’

     grep SJDV itrf2000.txt | awk ’{print $1, $2, $3}’

grep SJDV itrf2000.txt | awk ’{printf(“%s ve=%.1f vn=%.1f\n”, $1, $2, $3)}’


     echo 3 2 | awk ’{print $1/$2}’

     echo 3 2 | awk ’{print int($1/$2)}’

     echo 4 | awk ’{print sqrt($1)}’


     echo 1234567890 | awk ’{print substr($0,1,5))}’

     echo 1234567890 | awk ’{print substr($0,6,5))}’


     set a = `echo 1234567890 | awk ’{print substr($0,1,5))}’`

     set b = `echo 1234567890 | awk ’{print substr($0,6,5))}’`

     set c = $a$b

     echo $c


background/foreground tasks



     netscape &




     jobs –l

     kill job_number


     ps –elf

     ps –elf | more

     ps –elf | grep your_name




CSH scripting

Use vi (or another editor) to write the following file, save it as my_script (note interactive user input):

#!/bin/csh -f

echo –n “What is your name? ”

set name = $<

if ($name == “eric”) then

     echo Hello $name


     echo “I don’t know you, bye.”


Run your script:

csh my_script

Make it executable and run it:

chmod +x my_script



Write a non-interactive csh script for converting Julian date (and modified Julian date) to  civil date, and vice-versa, using the following formulas (Hoffman-Wellenhof, p.41-42):


For a civilan date (year Y, month M, day D, time UT), conversion to JD given by:

JD = int(365.25 y) + int[30.6001(m+1)] + D + UT/24 + 1 720 981.5


            y = Y –1          and       m = M + 12     if M < 2 or M = 2

            y = Y               and       m = M              if M > 2



MJD = JD – 2 400 000.5


Inverse conversion, from JD to civilian date:

a = int(JD + 0.5)

b = a + 1537

c = int[(b-122.1)/365.25]

d = int(365.25 c)

e = int[(b-d)/30.6001]

D = b – d – int(30.6001 e) + frac(JD + 0.5)

M = e –1 –12 int(e/14)

Y = c – 4715 – int[(7 + M) / 10]


Day of the week (Monday = 0):

N = modulo{int(JD + 0.5), 7}


GPS week:

GPS_WEEK = int[(JD – 2 444 244.5) / 7]


Verify that:

JD = 2 444 244.5 is January 6, 1980 (GPS standard epoch)

JD = 2 451 545.0 is January 1, 2000 (Current standard epoch J2000.0)


The script should be smart enough to recognize whether your input is Julian date or civil date!


See “A Practical Introduction to Matlab”, attached.

Write a non-interactive Matlab program for converting Julian date (and modified Julian date) to  civil date, and vice-versa, using the following formulas (Hoffman-Wellenhof, p.41-42).


Write a matlab program to:

  • Extract time series for latitude, longitude, and height from the file provided [= day, N component, sigma N, E component, sigma E, Up component, sigma Up. One position is calculated every day, using 24 hours of GPS data. The N, E, U components are actually the difference to the mean position of the entire time series, expressed in meters].

§         Plot the latitude, longitude, and height time series (on the same page, in landscape format), with their corresponding 1-sigma error bar, excluding data if sigmaN and sigmaE are greater than 5 mm.

§         Compute the regression line through each component and plot it on top of the time series

§         Add a title and a legend on the axes.

§         Briefly comment the features that you see on the time series.