Editing
Tutorial
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Interacting with files from the command line=== Ultimately though, 95% of your time using Madagascar on the command line will be to inspect and view files that are output by your scripts. Some of the key commands that are used to interact with files on the command line are: *'''sfin''' , used to get header information, *'''sfattr''' , used to get file attributes, *'''sfwindow''' , used to select portions of RSF files, *and '''sftransp''' , used to reorder files. Here are detailed usage examples and explanations of what the above programs do: '''sfin''' is one of the most used program on the command line, because most often we simply need to check the dimensionality of our files to make sure that we have them in the correct order. <pre> sfin file.rsf file.rsf: in="/var/tmp/file.rsf@" esize=4 type=float form=native n1=100 d1=0.004 o1=0 label1="Time" unit1="s" n2=34 d2=0.1 o2=0 label2="Distance" unit2="km" 3400 elements 13600 bytes </pre> '''sfattr''' is also commonly used from the command line to check files for correct values. Most often, we use sfattr to ensure that files are not filled with zeros, or with NaN's after a long computation, or to make sure that the values are reasonable. sfattr can be used to obtain basic statistics about the files as well. <pre> sfattr < file.rsf ******************************************* rms = 1 mean = 1 2-norm = 58.3095 variance = 0 std dev = 0 max = 1 at 1 1 min = 1 at 1 1 nonzero samples = 3400 total samples = 3400 ******************************************* </pre> '''sfwindow''' is used to select subsets of the data contained in an RSF file for computation elsewhere. Typically, you specify the data subset you want to keep using, the n, j, and f parameters which specify the number of indices in the arrays to keep, the jump in indices, and the first index to keep from the file in the respective dimension. For example if we want to keep the 15th-30th time samples from the first axis in <tt>file.rsf</tt>, we might use the following command: <pre> sfwindow < file.rsf f1=15 n1=15 j1=1 > file-win.rsf </pre> '''sftransp''' is used to reorder RSF files for other programs to be used. For example: <pre> sftransp < file.rsf plane=12 > file-transposed.rsf </pre> swaps the first and second axes, so that now the first axis is distance and the second axis is time. For more information about commonly used Madagascar programs please see the [[Guide_to_madagascar_programs|guide to Madagascar programs]].
Summary:
Please note that all contributions to Madagascar are considered to be released under the GNU Free Documentation License 1.3 or later (see
My wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Getting Madagascar
download
Installation
GitHub repository
SEGTeX
Introduction
Package overview
Tutorial
Hands-on tour
Reproducible documents
Hall of Fame
User Documentation
List of programs
Common programs
Popular programs
The RSF file format
Reproducibility with SCons
Developer documentation
Adding programs
Contributing programs
API demo: clipping data
API demo: explicit finite differences
Community
Conferences
User mailing list
Developer mailing list
GitHub organization
LinkedIn group
Development blog
Twitter
Slack
Tools
What links here
Related changes
Special pages
Page information