Guide to Madagascar programs |
int | memsize=sf_memsize() | Max amount of RAM (in Mb) to be used | |
---|---|---|---|
string | opt= | If y, change o and d parameters on the reversed axis; if i, don't change o and d | |
bool | verb=n | [y/n] | Verbosity flag |
int | which=-1 | Which axis to reverse. To reverse a given axis, start with 0, add 1 to number to reverse n1 dimension, add 2 to number to reverse n2 dimension, add 4 to number to reverse n3 dimension, etc. Thus, which=7 would reverse the first three dimensions, which=5 just n1 and n3, etc. which=0 will just pass the input on through unchanged. |
Here is an example of using sfreverse. First, let us create a 2-D dataset.
bash$ sfmath n1=5 d1=1 n2=3 d2=1 output=x1+x2 > test.rsf bash$ < test.rsf sfdisfil 0: 0 1 2 3 4 5: 1 2 3 4 5 10: 2 3 4 5 6Reversing the first axis:
bash$ < test.rsf sfreverse which=1 | sfdisfil 0: 4 3 2 1 0 5: 5 4 3 2 1 10: 6 5 4 3 2Reversing the second axis:
bash$ < test.rsf sfreverse which=2 | sfdisfil 0: 2 3 4 5 6 5: 1 2 3 4 5 10: 0 1 2 3 4Reversing both the first and the second axis:
bash$ < test.rsf sfreverse which=3 | sfdisfil 0: 2 3 4 5 6 5: 1 2 3 4 5 10: 0 1 2 3 4As you can see, the which= parameter controls the axes that are being reversed by encoding them into one number.
When an axis is reversed, what happens with its axis origin and sampling parameters? This behavior is controlled by opt=. In our example,
bash$ < test.rsf sfget n1 o1 d1 n1=5 o1=0 d1=1 bash$ < test.rsf sfreverse which=1 | sfget o1 d1 o1=4 d1=-1The default behavior (equivalent to opt=y) puts the origin o1 at the end of the axis and reverses the sampling parameter d1. Using opt=n preserves the sampling but reverses the origin.
bash$ < test.rsf sfreverse which=1 opt=n | sfget o1 d1 o1=-4 d1=1Using opt=i preserves both the sampling and the origin while reversing the axis.
bash$ < test.rsf sfreverse which=1 opt=i | sfget o1 d1 o1=0 d1=1One of the three possible behaviors may be desirable depending on the application.
Guide to Madagascar programs |