EAS-591T –Space Geodetic Measurements of Active Crustal
Motions
LAB 1
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.
See:
http://www.geek-girl.com/Unixhelp/
http://www.mesagroup.com/html/unix_commands.html
http://www.nmt.edu/tcc/help/unix/unix_cmd.html
http://www.emba.uvm.edu/CF/basic.html
http://www.isu.edu/departments/comcom/unix/workshop/unixindex.html
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
if $day == 2 then
echo
“you win”
else
echo
“you loose”
endif
while
set day = 1
while
($day < 10)
echo
“This is file $day” > file.$day
@
day ++
end
foreach
foreach f (file.*)
echo
–n $f
cat
$f
end
grep
grep SJDV
itrf2000.txt
awk
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
^C
netscape
&
fg
^Z
bg
jobs –l
kill
job_number
ps –elf
ps –elf |
more
ps –elf |
grep your_name
vi
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
else
echo “I don’t know you, bye.”
endif
Run your script:
csh my_script
Make it executable and run it:
chmod +x my_script
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
where:
y = Y –1 and m = M + 12 if M < 2 or M = 2
y = Y and m = M if M > 2
then:
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: §
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.