PyX example – Typecurve, Reserve

Arps typecurve

Arps typecurve

위 그림을 그리기 위한 python code는 다음과 같습니다.

from pyx import *

g=graph.graphxy(width=10,
                x=graph.axis.log(
                        title='$t_{Dd}$',min=0.01,max=1000,
                        painter=graph.axis.painter.regular(gridattrs=[color.gray(0.5)],tickattrs=[color.gray(0.5)])
                        ),
                x2=graph.axis.log(min=0.01,max=1000,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.gray(0.5)])),
                y=graph.axis.log(
                        title='$q_{Dd}$',min=0.001,max=10,
                        painter=graph.axis.painter.regular(gridattrs=[color.gray(0.5)],tickattrs=[color.gray(0.5)]))
                ,y2=graph.axis.log(min=0.001,max=10,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.gray(0.5)]))
                        )
g.plot([graph.data.file("arps.dat",x=1,y=j) for j in [3,4,5,6,8,9,10,11]],
                [graph.style.line([style.linestyle.solid,style.linewidth.Thin,color.gray(0.3)])])
g.plot([graph.data.file("arps.dat",x=1,y=j) for j in [2,7,12]],[graph.style.line([style.linestyle.solid,style.linewidth.Thick])])

g.text(5,0.5,r"$b=0.0$")
g.text(6.7,0.5,r"$b=0.5$")
g.text(8.8,0.5,r"$b=1.0$")

g.writeEPSfile('typeCurve')

그리고 데이터를 만들기 위한 code는 다음과 같습니다.

import math
fout='arps.dat'
f=open(fout,'w')

for it in range(-30,40):
        tdd=10.0**(it/10.0)
        q=range(11)
        q[0]=math.exp(-tdd)
        for ib in range(1,11):
                b=ib*0.1
                q[ib]=(1+b*tdd)**(-1/b)

        f.write("%s"%tdd)
        for j in range(0,11):
                f.write(" %s"%q[j])
        f.write("\n")

f.close()

아래의 그림들은 다음의 data를 이용하여 그렸습니다.

6 2070
12 1755
18 1510
24 1315
30 1155
36 1025
42 915

linear

linear

from pyx import *

g=graph.graphxy(width=10,
                x=graph.axis.lin(
                        title='$t \ (month)$',min=1,max=100,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange])
                        ),
                x2=graph.axis.lin(min=1,max=100,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange])),
                y=graph.axis.lin(
                        title='$q(t) \ (bbls/day)$',min=1,max=3000,texter=graph.axis.texter.decimal(),
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange]))
                ,y2=graph.axis.lin(min=1,max=15000,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange]))
                        )
g.plot( [graph.data.file("hwb05535.dat",x=1,y=2)],
                [graph.style.symbol(graph.style.symbol.circle, size=0.1,
                        symbolattrs=[deco.stroked([color.rgb.blue])])]
                )   

g.writeEPSfile('hwlin.eps')

Log scale로 그리기

logarithmic

logarithmic

from pyx import *

g=graph.graphxy(width=10,
                x=graph.axis.log(
                        title='$t \ (month)$',min=1,max=100000,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange])
                        ),
                x2=graph.axis.log(min=1,max=100000,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange])),
                y=graph.axis.log(
                        title='$q(t) \ (bbls/day)$',min=10,max=100000,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange]))
                ,y2=graph.axis.log(min=10,max=100000,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange]))
                        )

g.plot( [graph.data.file("hwb05535.dat",x=1,y=2)],
                [graph.style.symbol(graph.style.symbol.circle, size=0.1,
                        symbolattrs=[deco.stroked([color.rgb.blue])])]
                )       

g.writeEPSfile('hwlog.eps')

적분 그림 넣기

integral

integral

from pyx import *

Xmin=0
Xmax=350
Ymin=0
Ymax=2500
g=graph.graphxy(width=10,
                x=graph.axis.lin(
                        title='$t \ (month)$',min=Xmin,max=Xmax,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange])
                        ),
                x2=graph.axis.lin(min=Xmin,max=Xmax,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange])),
                y=graph.axis.lin(
                        title='$q(t) \ (bbls/day)$',min=Ymin,max=Ymax,texter=graph.axis.texter.decimal(),
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange]))
                ,y2=graph.axis.lin(min=Ymin,max=Ymax,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange]))
                        )
g.plot( [graph.data.file("hwb05535.dat",x=1,y=2)],
                [graph.style.symbol(graph.style.symbol.circle, size=0.1,
                        symbolattrs=[deco.stroked([color.rgb.blue])])]
                )
d=g.plot( graph.data.function("y(x)=2311*(1+0.0276*0.5535*x)**(-1.0/0.5535)"))
g.finish()
p=d.path        

pa=g.xgridpath(42)
pb=g.xgridpath(307)
(splita,),(splitpa,)=p.intersect(pa)
(splitb,),(splitpb,)=p.intersect(pb)
area=(pa.split([splitpa])[0] < <
                p.split([splita,splitb])[1] <<
                pb.split([splitpb])[0].reversed())
area[-1].close()
g.stroke(area,[deco.filled([color.cmyk.RoyalBlue])])

g.text(2,2.3,r"Reserves:",textattrs=[text.size.Large])
g.text(4.2,2.3,r"\int_{t_{now}}^{t_{el}}q(t)dt",textattrs=[text.size.Large,text.mathmode])
g.text(8,0.5,r"t_{el}=307",textattrs=[text.size.large,text.mathmode])

g.writeEPSfile('hwlinintegral.eps')

다음 그림은 아래의 data를 이용하여 그렸습니다.

6 39.42857
12 42.97959
18 46.46154
24 49.3125
30 53.30769
36 55.90909

Nind's method

Nind's method

from pyx import *

Xmin=0
Xmax=50
Ymin=30
Ymax=60
g=graph.graphxy(width=10,
                x=graph.axis.lin(
                        title='$t \ (month)$',min=Xmin,max=Xmax,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange])
                        ),
                x2=graph.axis.lin(min=Xmin,max=Xmax,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange])),
                y=graph.axis.lin(
                        title='$ 1/D \ (month)$',min=Ymin,max=Ymax,texter=graph.axis.texter.decimal(),
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange],tickattrs=[color.cmyk.Orange]))
                ,y2=graph.axis.lin(min=Ymin,max=Ymax,parter=None,
                        painter=graph.axis.painter.regular(gridattrs=[color.cmyk.Orange]))
                        )
g.plot( [graph.data.file("nind.dat",x=1,y=2)],
                [graph.style.symbol(graph.style.symbol.circle, size=0.1,
                        symbolattrs=[deco.stroked([color.rgb.blue])])]
                )
g.plot( [graph.data.function("y(x)=0.5535*x+36.276")]
                )

g.text(4.5,3.15,r"$1/D=0.5535t+36.276$",textattrs=[text.size.Large])
g.text(4.55,2.2,r"$b=0.5535$",textattrs=[text.size.Large])
g.text(4.2,1.65,r"$D_i=0.0276/month$",textattrs=[text.size.Large])

g.writeEPSfile('nind.eps')

0 Responses to “PyX example – Typecurve, Reserve”



  1. 댓글 남기기

댓글 남기기

아래 항목을 채우거나 오른쪽 아이콘 중 하나를 클릭하여 로그 인 하세요:

Gravatar
WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. Log Out / 변경 )

Twitter picture

Twitter의 계정을 사용하여 댓글을 남깁니다. Log Out / 변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. Log Out / 변경 )

%s에 연결하는 중





팔로우

Get every new post delivered to your Inbox.

Join 39 other followers