37
Command line, Plotting, and SConstruct flow Xufei Gong 公绪飞 China University of Petroleum 中国石油大学(华东) [email protected]

Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Command line, Plotting,

and SConstruct flow

Xufei Gong 公绪飞

China University of Petroleum

中国石油大学(华东)

[email protected]

Page 2: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Outline

Using Madagascar in command-line

Plotting with Madagascar

SConstruct Flow

2

Page 3: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Outline

Using Madagascar in command-line

Plotting with Madagascar

SConstruct Flow

3

Page 4: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Using Madagascar in command-line

Finding program

Finding documentation

Running program

Examples & frequently-use programs

4

Page 5: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Finding program

All programs

sfdoc -k *

http://ahay.org/RSF

5

Search with keyword

sfdoc -k rtm

[rsf@localhost tour]$ sfdoc -k .sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf function. sfinfill: Shot interpolation. sftahremoveclick: Trace And Header REMOVE electricl CLICK....

[rsf@localhost tour]$ sfdoc -k rtmsflsrtm2d: 2-D zero-offset least-squares reverse time migration (LSRTM)sfrtmadcig: RTM and angle gather (ADCIG) extraction using poynting vectorsfgpurtm: 2D prestack GPU-based RTM using effective boundary saving.sflsprtm2d: 2-D prestack least-squares RTM using wavefield reconstruction

Page 6: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Finding doc

Run without para

6

[rsf@localhost tour]$ sfbandpass

list of parameters

reproducible examples

Page 7: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Finding doc

Access online

7

Page 8: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Finding doc

Access online

8

http://ahay.org/blog/

Page 9: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Running program

Single program

[< in.rsf] sfprog [par1=] [par2=] [...] [> out.rsf]

Single input < in.rsf

Single output > out.rsf

Multiple parameters par=val

Multiple program

[< in.rsf] sfprog1 [par=] | ... | sfprogn [par=] [> out.rsf]

ONE program ONE process

Data passed through pipes

9

Page 10: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

10

rsf-examples/basic/cmd.sh

Page 11: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Loading segy data: sfsuread, sfsegyread

sfsegyread tape=data.segy endian=y >data.rsf

SEGY data with reel header, big endian,

sfsuread <data.su endian=0 >data.rsf

SEGY data without reel header, little endian

sfsuread <Nstack.su suxdr=y tfile=tfile >stk.rsf

SEGY data without reel header, big endian

11

Page 12: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Showing the data (quick look): sfgrey, sfpen

12

<stk.rsf sfgrey | sfpen

Page 13: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Checking data: sfin, sfattr, sfheaderattr, sfdisfil

13

Page 14: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Changing data attr: sfput

14

<stk.rsf sfput d2=0.0125 unit2=km label2=distance title=NankaiStack >stk2.rsf<stk2.rsf sfgrey | sfpen

Page 15: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Windowing: sfwindow

15

sfwindow <stk2.rsf min1=5 max1=8 f2=1000 n2=501 >stk3.rsf<stk3.rsf sfgrey | sfpen

Page 16: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Processing: sfbandpass

16

sfbandpass <stk3.rsf flo=5 fhi=20 >stk4.rsf<stk4.rsf sfgrey | sfpen

Page 17: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Frequently-used programs

Outputing: sfsegyheader, sfsuwrite, sfsegywrite

17

sfsegyheader <stk4.rsf >hd.rsfsfsuwrite <stk4.rsf endian=0 tfile=hd.rsf >Nstack-part-bpf.su

Page 18: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Outline

Using Madagascar in command-line

Plotting with Madagascar

SConstruct Flow

18

Page 19: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Plotting programs

Plotting tools: rsf vpl

sfgraph

sfgraph3

sfcontour

sfcontour3

19

Pens: vpl jpg/png/tif/gif…

vppen

pspen

xtpen

……

sfwiggle

sfgrey

sfgrey3

sfgrey4

Page 20: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Plotting programs

Plotting tools: rsf vpl

sfgraph

sfgraph3

sfcontour

sfcontour3

20

Pens: vpl jpg/png/tif/gif…

vppen

pspen

xtpen

……

sfwiggle

sfgrey

sfgrey3

sfgrey4

Find doc also from sfsdtplot:

http://ahay.org/RSF/sfstdplot.html

Page 21: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Plotting programs

21

rsf-examples/basic/plot.sh

Page 22: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

sfgraph

22

sfmath n1=41 o1=-4 d1=.2 output=".5*x1" > y1.rsf< y1.rsf sfmath output="sin(x1)" > y2.rsf< y1.rsf sfmath sin=y2.rsf output="input-sin" > y3.rsf

< y3.rsf sfgraph title="0.5x-sin(x)" min1=-4 max1=4 | sfpen< y3.rsf sfgraph title="0.5x-sin(x)" symbol=o symbolsz=12 grid=y min1=-4 max1=4 | sfpen

Page 23: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

sfgraph

23

< y1.rsf sfcat y2.rsf y3.rsf axis=2 | sfgraph title="0.5x,sin(x),0.5x-sin(x)" label1=x label2=y | sfpen

Page 24: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

sfwiggle

24

sfsuread <Nstack.su suxdr=y \| sfput d2=0.0125 unit2=km label2=distance title=NankaiStack \| sfwindow min1=5.5 max1=8 f2=1000 n2=51 \| sfbandpass flo=5 fhi=20 >stk.rsf

<stk.rsf sfwiggle yreverse=y transp=y poly=y | sfpen

Page 25: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

sfgrey

25

sfsuread <Nstack.su suxdr=y \| sfput d2=0.0125 unit2=km label2=distance title=NankaiStack \| sfwindow min1=5.5 max1=8 f2=1000 n2=51 \| sfbandpass flo=5 fhi=20 >stk.rsf

<stk.rsf sfgrey | sfpen

Page 26: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

plot: sfgrey3

show example later…

26

Page 27: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

From VPL to …

27

< y1.rsf sfcat y2.rsf y3.rsf axis=2 | sfgraph title="0.5x,sin(x),0.5x-sin(x)" label1=x label2=y >graph.vplvpconvert format=png bgcolor=white graph.vpl

<stk.rsf sfwiggle yreverse=y transp=y poly=y >wiggle.vplvpconvert format=jpg olor=white wiggle.vpl

Page 28: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

From VPL to …

28

Page 29: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Outline

Using Madagascar in command-line

Plotting with Madagascar

SConstruct Flow

29

Page 30: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

TASK

30

Velocity

Modeling program

Synthetic shot gather Wave propagation

2 2 22

2 2 2

p p pv

t x z

Two dimensional acoustic wave equation

finite-difference modeling

Page 31: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

C program for modeling

Using rsf API

Similar usage with common sfprog

Suitable for light-weight tools, tools developing

from rsf.proj import *

proj = Project()

prog = proj.Program('awfmd.c')

End()

31

To compile, run scons

rsf-examples/modeling-shell/awfmd.c

Page 32: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Using shell script

32

rsf-examples/modeling-shell/shell.sh

Page 33: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

SCons

What is SCons?

Build system (Software Construction)

Written in Python

Configuration (SConstruct files) are Python scripts

Built-in support for different languages

Dependency analysis

Parallel builds

Cross-platform

33

http://www.scons.org/

Page 34: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

SCons

34

Basic methods of an rsf.proj object.

Fetch(data_file,dir[,ftp_server_info])

Downloading data_file from a specific directory dir of an FTP server

Flow(target[s],source[s],command[s][,stdin][,stdout])

Generating target[s] from source[s] using command[s]

Plot(intermediate_plot[,source],plot_command)

Plot(intermediate_plot,intermediate_plots,combination)

Generating intermediate_plot in the working directory.

Result(plot[,source],plot_command) orResult(plot,intermediate_pl

ots,combination)

Generating a final plot in the special Fig folder of the working directory.

End()

SCons in Madagascar

Page 35: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Using SCons

35

rsf-examples/modeling-scons/SConstruct

Page 36: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

Using SCons

scons data.rsf

execute till data.rsf

scons fig.view

generate & show figure fig.vpl

scons -c

clear all files generated

36

Page 37: Command line, Plotting, and SConstruct flo · sfdoc -k rtm [rsf@localhost tour]$ sfdoc -k . sfwave: Rice HPCSS seismic modeling and migration. sferf: Bandpass filtering using erf

37

Thank you