本文整理汇总了Python中vcs.testing.regression.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_a_ratio
def plot_a_ratio(s,gm,ratio):
ret = 0
x = regression.init()
x.drawlogooff()
x.open()
x.geometry(400,800)
y = regression.init()
y.open()
y.geometry(800,400)
for X in [x,y]:
X.plot(s,gm,ratio=ratio)
if X.islandscape():
orient = "ldscp"
else:
orient = "port"
fnm = "aspect_ratio_%s_%s.png" % (orient,ratio)
X.png(fnm)
src = os.path.join(pth0,fnm)
ret += regression.check_result_image(fnm, src)
return ret
示例2:
import vcs, numpy, os, sys, vcs.testing.regression as regression
s = numpy.sin(numpy.arange(100))
s = numpy.reshape(s,(10,10))
x = regression.init()
x.plot(s, bg=1)
regression.run(x, "test_vcs_boxfill_10x10_numpy.png")
示例3: dataFile
import cdms2, os, sys, vcs, cdtime, vcs.testing.regression as regression
# Test that we can restrict the plot using datawc along a time axis
dataFile = cdms2.open(os.path.join(vcs.sample_data, "clt.nc"))
clt = dataFile("clt")
clt = clt(latitude=(-90.0, 90.0), longitude=(0.), squeeze=1,
time=('1979-1-1 0:0:0.0', '1988-12-1 0:0:0.0'))
# Initialize canvas:
canvas = regression.init()
# Create and plot quick boxfill with default settings:
boxfill=canvas.createboxfill()
# Change the type
boxfill.boxfill_type = 'custom'
boxfill.datawc_y1 = 12
canvas.plot(clt, boxfill, bg=1)
# Load the image testing module:
# Create the test image and compare:
regression.run(canvas, "test_vcs_boxfill_datawc_time.png")
示例4: range
import cdms2
import os
import sys
import vcs.testing.regression as regression
import vcs
import numpy
data = sys.argv[2]
level = sys.argv[3]
levels = {'0': range(-5,36,5),
'1': [-1000, -15, 35],
'2': [-300, -15, 0, 15, 25],
'3': range(190, 320, 10)}
x=regression.init(bg=1)
f=cdms2.open(data)
if (level == '3'):
s=f("test")
else:
s=f("sst")
iso=x.createisofill()
iso.levels=levels[level]
x.plot(s,iso)
regression.run(x, "test_vcs_isofill_level%s.png"%level)
示例5: int
# Tests if ratio=autot works correctly for background and foreground plots
bg = int(sys.argv[2])
plot = sys.argv[3]
x_over_y = sys.argv[4]
if (x_over_y == '0.5'):
xSize = 250
ySize = 500
else:
xSize = 800
ySize = 400
pth = os.path.join(os.path.dirname(__file__), "..")
sys.path.append(pth)
f = cdms2.open(vcs.sample_data + "/" + testConfig[plot][0])
s = f(testConfig[plot][1])
x = regression.init(bg=bg, geometry=(xSize, ySize))
# graphics method
if (plot.find('boxfill') != -1):
gm = x.getboxfill(plot)
elif (plot.find('meshfill') != -1):
gm = x.getmeshfill(plot)
elif (plot.find('isofill') != -1):
gm = x.getisofill(plot)
elif (plot.find('isoline') != -1):
gm = x.getisoline(plot)
else:
print "Invalid plot"
sys.exit(13)
x.setantialiasing(0)
示例6:
import os, sys, cdms2, vcs, vcs.testing.regression as regression
testConfig = {'a_boxfill': ('clt.nc', 'clt', (200, 200)),
'a_mollweide_boxfill': ('clt.nc', 'clt', (222, 322)),
'a_isofill': ('clt.nc', 'clt', (200, 200)),
'a_isoline': ('clt.nc', 'clt', (200, 200)),
'vector_default': ('clt.nc', ('u', 'v'), (200, 200)),
'a_meshfill': ('sampleCurveGrid4.nc', 'sample', (222, 322)),
'a_robinson_meshfill': ('sampleCurveGrid4.nc', 'sample', (222, 322))}
# Tests if the info produced when clicking on a map is correct.
src = sys.argv[1]
plot = sys.argv[2]
x = regression.init(bg=False, geometry=(800, 600))
vector = False
# graphics method
if (plot.find('boxfill') != -1):
gm = x.getboxfill(plot)
elif (plot.find('meshfill') != -1):
gm = x.getmeshfill(plot)
elif (plot.find('isofill') != -1):
gm = x.getisofill(plot)
elif (plot.find('isoline') != -1):
gm = x.getisoline(plot)
elif (plot.find('vector') != -1):
gm = x.getvector(plot[plot.index('_') + 1:])
vector = True
else:
print "Invalid plot"
sys.exit(13)
示例7: f
import vcs
import cdms2
import sys
import os
import vcs.testing.regression as regression
pth = os.path.join(os.path.dirname(__file__), "..")
sys.path.append(pth)
x = regression.init(bg=1, geometry=(1620, 1080))
f = cdms2.open(vcs.sample_data + "/clt.nc")
s = f("clt")
iso = x.createisoline()
iso.level = [5, 50, 70, 95]
iso.linetypes = ["dot", "dash", "dash-dot", "long-dash"]
x.plot(s, iso, continents=0)
name = "test_vcs_line_patterns.png"
regression.run(x, name)
示例8:
import os, sys, numpy, cdms2, MV2, vcs, vcs.testing.regression as regression
# We have to specify the geometry to make sure that the size of the canvas doesn't change between the init and the plot functions
x = regression.init(bg=True, geometry=(1200, 1091))
text = x.createtext()
text.string = ["A very very very very long string", "A\nmult-line\nstring", "Short"]
# Use any value for initial; then we'll manually "right align" using the text extents
text.x = [0.1]
text.y = [0.1, 0.5, 0.9]
# This function only gets the extents for the *current* size
extents = x.gettextextent(text)
# Now we'll manually populate this with the desired values
text.x = []
for min_x, max_x, min_y, max_y in extents:
w = max_x - min_x
# h = max_y - min_y
text.x.append(1 - w)
x.plot(text, bg=1)
regression.run(x, "test_textextents.png")
示例9: f
import vcsaddons, numpy
import cdms2
f = cdms2.open(data)
rms_xyt = f("rms_xyt")
ax1 = cdms2.createAxis(['0071-0100' ,'ACCESS1-0' ,'ACCESS1-3' ,'CCSM4' ,'CESM1-BGC' ,'CESM1-CAM5',
'CESM1-FASTCHEM' ,'CESM1-WACCM' ,'CSIRO-Mk3-6-0' ,'FGOALS-g2' ,'GFDL-CM3',
'GFDL-ESM2G' ,'GFDL-ESM2M' ,'HadGEM2-AO' ,'MIROC4h' ,'bcc-csm1-1',
'bcc-csm1-1-m'],id="models")
ax2 = cdms2.createAxis(['pr', 'prw', 'psl', 'rltcre', 'rlut', 'rstcre', 'ta-200', 'ta-850', 'tas', 'ua-200',
'ua-850', 'va-200', 'va-850', 'zg-500'],id="statistic")
rms_xyt.setAxisList([ax2,ax1])
x = regression.init(geometry=(1200,600))
import vcsaddons
bg = False
gm = vcsaddons.createparallelcoordinates(x=x)
t = vcs.createtemplate()
to=x.createtextorientation()
to.angle=-45
to.halign="right"
t.xlabel1.textorientation = to.name
t.reset('x',0.05,0.9,t.data.x1,t.data.x2)
#t.reset('y',0.5,0.9,t.data.y1,t.data.y2)
ln = vcs.createline()
ln.color = [[0,0,0,0]]
t.legend.line = ln
t.box1.priority=0