Utility programs and scripts Thomas Herring

Slides:



Advertisements
Similar presentations
Utility programs and scripts Thomas Herring
Advertisements

Basics of GPS processing workflow
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Lecture 4 Shell environment III: - command alias & history; - job control; - editor (vim) CSE4251 The Unix Programming Environment 1.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
1 UNIX essentials (hands-on) the directory tree running programs the shell (using the T-shell) → command line processing → special characters → command.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Linux Commands LINUX COMMANDS.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Advanced File Processing
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
3 File Processing Mauro Jaskelioff. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash.
Introduction to Shell Script Programming
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Guide To UNIX Using Linux Fourth Edition
Introduction to Computer Organization & Systems Topics: Intro to UNIX COMP John Barr.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Utility programs and scripts T. A. Herring R. W. King M. A. Floyd Massachusetts Institute of Technology GPS Data Processing and Analysis with GAMIT/GLOBK/TRACK.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
GAMIT/GLOBK Utilities 1.Organization/Pre-processing sh_get_times: List start/stop times for all RINEX files sh_upd_stnfo: Add entries to station.info from.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Introduction to Unix for FreeSurfer Users
Tutorial of Unix Command & shell scriptS 5027
Utility programs and scripts
California State University Fresno
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
Utility programs and scripts
Basics of processing workflow for GAMIT/GLOBK
Utility programs and scripts
The Linux Operating System
Shell Environments.
Basics of GPS processing workflow
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
GAMIT/GLOBK Utilities
John Carelli, Instructor Kutztown University
Guide To UNIX Using Linux Third Edition
Tutorial of Unix Command & shell scriptS 5027
Utility Programs and Scripts
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
Utility programs and scripts
Utility programs and scripts
M. A. Floyd Massachusetts Institute of Technology, Cambridge, MA, USA
GAMIT/GLOBK Utilities
Basics of processing workflow for GAMIT/GLOBK
M. A. Floyd Massachusetts Institute of Technology, Cambridge, MA, USA
Basics of processing workflow for GAMIT/GLOBK
Presentation transcript:

Utility programs and scripts Thomas Herring

Utility Overview In this lecture we look at a number of utility scripts and programs used in the gamit/globk suite of programs. We examine and will show examples in the areas of – Organization/Pre-processing – Scripts used by sh_gamit but useful stand-alone – Evaluating results Also examine some basic unix, csh, bash programs and method. 11/19/12Utilities Lec 082

Guide to scripts There are many scripts in the ~/gg/com directory and you should with time looks at all these scripts because they often contain useful guides as to how to do certain tasks. – Look the programs used in the scripts because these show you the sequences and inputs needed for different tasks – Scripting methods are useful when you want to automate tasks or allow easy re-generation of results. – Look for templates that show how different tasks can be accomplished. ~/gg/kf/utils and ~/gg/gamit/utils contain many programs for utility tasks and these should be looked at to see what is available. 11/19/12Utilities Lec 083

GAMIT/GLOBK Utilities 1.Organization/Pre-processing sh_get_times: List start/stop times for all RINEX files sh_upd_stnfo: Add entries to station.info from RINEX headers convertc: Transform coodinates (cartesian/geodetic/spherical) glist: List sites for h-files in gdl; check coordinates, models corcom: Rotate an apr file to a different plate frame unify_apr: Set equal velocities/coordinates for glorg equates sh_dos2unix: Remove the extra CR from each line of a file doy: Convert to/from DOY, YYMMDD, JD, MJD, GPSW

GAMIT/GLOBK Utilities (cont) 2. Scripts used by sh_gamit but useful stand-alone sh_get_rinex: ftp a RINEX o file from remote archives ( ftp_info) sh_crx2rnx: convert to/from RINEX/Hatanaka sh_get_nav: ftp a RINEX n file from remote archives sh_get_met: ftp a RINEX m file from remote archives sh_get_hfiles: ftp h-files from SOPAC/MIT sh_update_eop: ftp an EOP file from IERS, create pmu, ut1., wob. sh_get_orbits: ftp a g-file or sp3 file from remote archives, call --> sh_sp3fit: create a g- or t-file from an sp3 file (1-3 days)

GAMIT/GLOBK Utilities (cont) 3. Evaluating results sh_oneway: Plot phase residuals (sky map; vs elevation) [ GMT] sh_plotelmean: Elevation angles average residuals plots [ GMT ] cview: Display and manipulate phase residuals [X-windows] sh_plotcrd: Plot coordinate times series [GMT] sh_tshist: Plot histogram of time-series statistics [GMT] tsview: Display and manipulate coordinate time series [MATLAB] sh_plotvel: Plot velocity maps [GMT], call --> sh_map_elements, sh_map_calif, sh_map_balkans, etc. velview: Display and manipulate velocity maps [MATLAB] sh_org2vel: Extract plate-referenced velocities from glorg print file velrot: Combine velocity fields from different analyses

Unix Primer There are web resources with primer’s on the Unix system and you should consult some of these resources. Often web-searching for a unix command will yield useful results (links in notes below). Unix command are executed in a shell. The main ones are csh (or tsch) and bash. GAMIT/GLOBK scripts are all csh scripts (scripts are shell commands put in files so that they can be executed many times: Automates tasks. Your setup for your shell in defined in either ~/.cshrc or ~/.bashrc (~ is symbol for home directory). Setting up these files is needed for gamit. Looking at these scripts can give you some idea of the commands 11/19/12Utilities Lec 087

.cshrc/.bashrc CSH commands # CSH Gamit/Globk initialization # Basic setup set ggdir = $HOME/gamit_10.40 setenv HELP_DIR = ~/{ggdir}/help/ setenv GMTHOME = $HOME/GMT/GMT3.4.4 set INSTITUTE = MIT set prompt = %m"["%h"] " set noclobber # Use >! Overwrite set history=1500 set savehist=1500 BASH commands # BASH Gamit/Globk profile # Basic setip ggdir=$HOME/gamit_10.40 export HELP_DIR=${ggdir}/help/ GMTHOME=$HOME/GMT/GMT3.4.4 export GMTHOME INSTITUTE=MIT ; export INSTITUTE PS1="\h[\#] ” set -o noclobber # Use >| overwrite export HISTFILESIZE= /19/12Utilities Lec 088

.cshrc/.bashrc Path setup.cshrc set spath = ( /usr/local/bin /usr/local/sbin /usr/bin /bin \ /usr/sbin /sbin /usr/local/gfortran/bin /usr/X11R6/bin ) set gpath = ( $ggdir/com $ggdir/gamit/bin $ggdir/kf/bin \ $ggdir/matlab/tsview $ggdir/matlab/velview $ggdir/python) set lpath = (. /Users/tah/bin /opt/ibmcmp/xlf/8.1/bin) set path = ( $lpath $gpath $spath) set path = ( /sw/lib/gcc4.4/bin/ $path $GMTHOME/bin ) Path setup.bashrc spath=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin gpath=$ggdir/com:$ggdir/gamit/bin:$ggdir/kf/bin:\ $ggdir/matlab/tsview:$ggdir/matlab/velview:$ggdir/python lpath=$HOME/bin:. upath=/sw/bin:/sw/lib/gcc4.4/bin:$GMTHOME/bin PATH=$spath:$gpath:$lpath:$upath ; export PATH 11/19/12Utilities Lec 089

.cshrc/.bashrc Aliases # ALIASES alias cp 'cp -i’ alias CP \'cp\’ alias mv 'mv -i’ alias rm 'rm -i’ alias dir 'ls -la’ alias ls 'ls -F’ alias RM \'rm\’ alias pd pushd alias xt 'xterm -sb -sl 2000’ alias H 'history’ alias m more alias ll 'ls -la’ alias ne 'nedit \!* &’ alias last 'ls -lFt \!* | head -20' Aliases # ALIASES alias cp='cp -i' alias CP=\'cp\' alias mv='mv -i' alias rm='rm -i' alias dir='ls -la' alias ls='ls -F' alias RM=\'rm\' alias pd=pushd alias xt='xterm -sb -sl 2000' alias H='history’ alias m=more alias ll='ls -la’ function ne() { nedit & } alias last='ls -lFt | head -20' 11/19/12Utilities Lec 0810

Command Unix commands man to get help e.g., man ls Directory commands: – ls list directory (* and ? Match any characters (*) or any single character (?) – cd change directory – pwd print current (working) directory – mkdir make directory – rm remove file (\rm to not ask of rm aliased to rm –i (interactive remove) – rmdir remove directory (must be empty) 11/19/12Utilities Lec 0811

Unix editors Text editors: Mac textedit is OK (save as text) Other common full screen editors: – gedit (most Linux systems) – nedit (one download source: – vi or vim available on all platforms and is good to know. Line editor: Some commands (:help for help) i for insert mode, esc to exit this mode : for command mode (:w write, :q quit, :q! quit no save) o insert line start input, A append to end of line. Arrow keys to move around page / to search Start:end s / / /g Form line start (1) to line end ($ for last line), replace with. Append g for multiple replacement. 11/19/12Utilities Lec 0812

Unix csh program/commands grep – used to find content in files. We use it to extract information from files awk – used to extract column based data from files. awk has math, logical and string functions. Pipes and re-directs: These methods differ between csh and bash: – csh: >, >> and >&, >>& to re-direct stdout and stdout+stderr – csh >! will overwrite file when noclobber set – bash: >, >> and >> file 2>&1 to do the same – bash >| will overwrite file when noclobber set setenv and set allow variables to be set and differ between csh and bash (setenv and export create global variables that can be seen in other – csh: set variable = value ; setenv variable value – bash: variable=value ; export variable – In both case $variable contains the value 11/19/12Utilities Lec 0813

Summary We have looked at just some examples of common scripts and program used in gamit/globk There are many more scripts to be found in ~/gg/com and programs in ~/gg/gamit/bin and ~/gg/kf/bin A good understanding of unix csh or tcsh is very useful. The software will run from a bash shell but all the instructions are for csh 11/19/12Utilities Lec 0814