当前位置: 首页>>代码示例>>Python>>正文


Python support.check_plot函数代码示例

本文整理汇总了Python中support.check_plot函数的典型用法代码示例。如果您正苦于以下问题:Python check_plot函数的具体用法?Python check_plot怎么用?Python check_plot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_plot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

def test():
   import vcs_legacy,cdms2 as cdms,time,os,sys,support          # import vcs_legacy and cdms

   bg=support.bg

   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) # open clt file
   u=f('u')  			        # get slab u
   x=vcs_legacy.init()                         # construct vcs_legacy canvas
   
   x.plot(u, 'default','yxvsx','ASD7',bg=bg)	# plot slab the old way
   support.check_plot(x)
   if support.dogui:
      x.geometry(450,337,100,0)		# change the geometry and location
      x.flush()
      support.check_plot(x)
   
   a=x.getyxvsx('ASD7')		    	# get 'ASD7' yxvsx
   if not vcs_legacy.isgraphicsmethod(a):            # test object 'a' for graphics method
      raise Exception, "Error not a gm"
   else:
      if not vcs_legacy.isyxvsx(a):                  # test object 'a' if yxvsx
         raise Exception,"Error wrong type of gm"
   
   a.script('test','w')                 # save 'ASD7' yxvsx as a Python script
   
   a.xticlabels('','')                  # remove the x-axis
   support.check_plot(x)
   a.xticlabels('*')                    # put the x-axis
   support.check_plot(x)
   
   ############################################################################
   # Change the yxvsx line                                                    #
   ############################################################################
   a.line=0        			# same as 'solid'
   support.check_plot(x)
   a.line=1        			# same as 'dash'
   support.check_plot(x)
   a.line=2        			# same as 'dot'
   support.check_plot(x)
   a.line=3        			# same as 'dash-dot'
   support.check_plot(x)
   a.line=4        			# same as 'long-dash'
   support.check_plot(x)

 
   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()


   
   ############################################################################
   # Change the yxvsx line color                                              #
   ############################################################################
   a.linecolor=(77)
   support.check_plot(x)
   a.linecolor=16
   support.check_plot(x)
   a.linecolor=44  			# same as a.color=(44)
   support.check_plot(x)
   a.linecolor=None
   support.check_plot(x)
   
   ############################################################################
   # Change the yxvsx marker                                                  #
   ############################################################################
   a.marker=1                        	# Same as a.marker='dot'
   support.check_plot(x)
   a.marker=2                       	# Same as a.marker='plus'
   support.check_plot(x)
   a.marker=3                       	# Same as a.marker='star'
   support.check_plot(x)
   a.marker=4                       	# Same as a.marker='circle'
   support.check_plot(x)
   a.marker=5                        	# Same as a.marker='cross'
   support.check_plot(x)
   a.marker=6                        	# Same as a.marker='diamond'
   support.check_plot(x)
   a.marker=7                        	# Same as a.marker='triangle_up'
   support.check_plot(x)
   a.marker=8                        	# Same as a.marker='triangle_down'
   support.check_plot(x)
   a.marker=9                        	# Same as a.marker='triangle_left'
   support.check_plot(x)
   a.marker=10                       	# Same as a.marker='triangle_right'
   support.check_plot(x)
   a.marker=11                       	# Same as a.marker='square'
   support.check_plot(x)
   a.marker=12                       	# Same as a.marker='diamond_fill'
   support.check_plot(x)
   a.marker=13                       	# Same as a.marker='triangle_up_fill'
   support.check_plot(x)
   a.marker=14                       	# Same as a.marker='triangle_down_fill'
   support.check_plot(x)
   a.marker=15                       	# Same as a.marker='triangle_left_fill'
   support.check_plot(x)
   a.marker=16                      	# Same as a.marker='triangle_right_fill'
#.........这里部分代码省略.........
开发者ID:arulalant,项目名称:uvcdat,代码行数:101,代码来源:testyxvsx.py

示例2: range

import vcs
import support
bg = support.bg

tp = vcs.init()
tp.portrait()

mark = tp.createmarker('mark')
mark.x = [0.5]
mark.y = [.9]
mark.color = 242
mark.type = 'cross'
mark.size = 12
n = 4
i = 0
tp.plot(mark, bg=bg)
support.check_plot(tp)
tp.mode = 0  # no aauto update
for i in range(1, 3):
    mark.y = [1. - (i / float(n))]
    tp.plot(mark, bg=bg)
    support.check_plot(tp)
tp.update()
support.check_plot(tp)
tp.mode = 1
for i in range(1, n):
    mark.y = [1. - (i / float(n))]
    tp.plot(mark, bg=bg)
    support.check_plot(tp)
开发者ID:NESII,项目名称:uvcdat,代码行数:29,代码来源:test_marker_update.py

示例3: test

def test():
    import vcs_legacy, cdms2 as cdms, time, os, sys, support  # import vcs_legacy and cdms

    bg = support.bg

    f = cdms.open(os.path.join(cdms.__path__[0], "..", "..", "..", "..", "sample_data", "clt.nc"))
    s1 = f.getslab("clt")  # get slab clt
    s2 = f.getslab("clt", 4, 4, -45, 45, -90, 90)
    s3 = f.getslab("clt", 6, 6, 0, 90, 0, 180)
    x = vcs_legacy.init()  # construct vcs_legacy canvas

    p1 = x.plot(s1, bg=bg)  # plot slab the old way
    support.check_plot(x)
    x.plot(s2, bg=bg)  # plot slab the old way
    support.check_plot(x)

    p2 = x.getplot("dpy_plot_2")  # get display plot s2

    if not vcs_legacy.queries.isplot(p1):  # check for display plot object
        raise exception, "Error, p1 not a display!"

    if not "--extended" in sys.argv:
        print "\n************* PARTIAL TEST *****************"
        print "FOR COMPLETE TEST OF THIS MODULE USE "
        print "   -F (--full) or -E (--extended) option"
        print "************* PARTIAL TEST *****************\n"
        sys.exit()

    p2.name = "p2_name"  # change display plot's (p2) name
    p2.off = 1  # undisplay display plot (p2)
    support.check_plot(x)
    p2.off = 0  # redisplay display plot (p2)
    support.check_plot(x)

    p1.priority = 1  # bring display plot (p1) to the front
    support.check_plot(x)

    p2.off = 1  # undisplay display plot (p2)
    p1.template = "default_dud"  # change display plot (p1) template
    support.check_plot(x)

    x.mode = 0  # turn atomatic update off
    p1.template = "default"  # change display plot (p1) template
    p1.g_type = "isoline"  # change display plot (p1) graphics type
    support.check_plot(x)
    x.update()  # view changes now
    support.check_plot(x)

    x.mode = 1  # turn atomatic update mode back on
    p1.g_type = "isofill"  # change display plot (p1) graphics type
    support.check_plot(x)
    p1.g_name = "quick"  # change display plot (p1) graphics name
    support.check_plot(x)

    p1.array = ["plot_2"]  # change display plot (p1) array object
    support.check_plot(x)
    p1.array = ["plot_1"]  # change display plot (p1) array object
    support.check_plot(x)
    p1.array = [s3]  # change display plot (p1) array object
    support.check_plot(x)

    #########################################################################
    # 								           #
    # Produce an overlay plot.                                              #
    # 								           #
    #########################################################################
    x.mode = 0  # turn atomatic update mode back on
    p1.array = ["plot_1"]  # change display plot (p1) array object
    p2.off = 0  # redisplay display plot (p2)
    p2.priority = 2  # bring display plot (p2) to the front
    p2.array = [s1]  # change display plot (p2) array object
    p2.g_type = "isoline"  # change display plot (p2) graphics type
    p2.g_name = "default"  # change display plot (p1) graphics name
    x.update()  # view changes now
    support.check_plot(x)

    x.mode = 1  # turn atomatic update mode back on
    x.removeobject(p1)  # remove the display plot (p1)
    support.check_plot(x)

    print "*************************************************************************************"
    print "******                                                                         ******"
    print "******   D I S P L A Y   T E S T   C O M P L E T E D   S U C E S S F U L L Y   ******"
    print "******                                                                         ******"
    print "*************************************************************************************"
开发者ID:arulalant,项目名称:uvcdat,代码行数:85,代码来源:testdisplayplot.py

示例4: test

def test():
   import vcs,cdms2 as cdms,time,os,sys,support          # import vcs and cdms

   bg=support.bg
   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) # open clt file
   s=f('clt')                           # get slab clt
   x=vcs.init()                         # construct vcs canvas
   

   x.plot(s,'default','outfill','ASD_map',bg=bg)# plot slab the old way
   support.check_plot(x)
   if bg==0:
      x.geometry(450,337,100,0)            # change the geometry and location
      support.check_plot(x)
      x.flush()
      support.check_plot(x)
   
   
   s=f('u')	                        # get u slab
   x.clear()                            # clear the VCS Canvas
   x.plot(s,'default','outfill','ASD_map',bg=bg)# plot the surface data
   support.check_plot(x)
   
   a=x.createoutfill('quick')		# create 'quick' outfill
   if not vcs.isgraphicsmethod(a):            # test object 'a' for graphics method
      raise Exception, "Error did not retrieve the gm"
   else:
      if not vcs.isoutfill(a):		# check for isofill
         raise Exception, "Error gm is not right type"
   
   a.script('test','w')			# save 'quick' outfill as a Python script
   
  
   a.xticlabels('lon30','lon30')        # change the x-axis
   support.check_plot(x)
   a.xticlabels('','')                  # remove the x-axis
   support.check_plot(x)
   a.xticlabels('*')                    # put the x-axis
   support.check_plot(x)
   a.datawc(-45.0, 45.0, -90.0, 90.0)   # change the region
   support.check_plot(x)
   a.datawc(1e20,1e20,1e20,1e20)        # put the region back
   support.check_plot(x)
   

   cont = False
   for anarg in sys.argv:
      if anarg in ['--extended', '--full','-E','-F']:
         cont = True
         break
   if cont is False:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()
   

   x.clear()                            # clear the VCS Canvas
   x.outfill(s,a,'default',bg=bg)             # plot outfill using 'default' template
   
   a.fillareastyle='hatch'		# change the fill style to hatch
   support.check_plot(x)
   a.fillareaindex=11			# change the hatch index pattern
   support.check_plot(x)
   a.fillareacolor=(77)			# change the hatch color
   support.check_plot(x)
   a.fillareacolor=16			# chnage the hatch color
   support.check_plot(x)
   a.fillareacolor=44			# same as a.fillareacolor=(44)
   support.check_plot(x)
   a.fillareacolor=None			# use the default hatch color (black)
   support.check_plot(x)
   a.outfill=([0])			# set the outfill value
   support.check_plot(x)
   a.outfill=([1])			# set the outfill value
   support.check_plot(x)
   a.outfill=([0,1])			# set the outfill value
   support.check_plot(x)
   a.outfill=([0])			# set the outfill value
   support.check_plot(x)
   
   support.check_plot(x)
   
   objs =x.listelements('template')                   # get the list of templates
   t=x.createtemplate('test')           # create template 'test' from 'default' template
   if not vcs.istemplate(t):                  # test whether 't' is a template or not
      raise Exception,"Error template not created"
   else:
      a2 =x.listelements('template')                   # get the list of templates
      if objs==a2:
         raise Exception,"Error template not created or added to list"
   
   x.clear()				# clear the VCS Canvas
   x.plot(a, t, s,bg=bg)			# plot outfill template 't', outfill 'a', and array 's'
   support.check_plot(x)
   x.clear()				# clear the VCS Canvas
   x.outfill(a,s,t,bg=bg)			# plot using outfill 'a', array 's', and template 't'
   support.check_plot(x)
   
#.........这里部分代码省略.........
开发者ID:AZed,项目名称:uvcdat,代码行数:101,代码来源:testoutfill.py

示例5: test

def test():
    import vcs
    import cdms2
    import os
    import support                # import vcs and cu
    bg = support.bg
    f = cdms2.open(os.path.join(vcs.sample_data, 'clt.nc'))
    u = f('u')                             # get slab u
    v = f('v')                             # get slab v
    x = vcs.init()                         # construct vcs canvas

    x.plot(u, v, 'default', 'scatter', 'quick', bg=bg)  # plot slab the old way
    support.check_plot(x)
    if bg == 0:
        x.mode = 1
        x.geometry(450, 337, 100, 0)		# change the geometry and location
        x.flush()
        support.check_plot(x)

    a = x.getscatter('quick')		# get 'quick' scatter
    # test object 'a' for graphics method
    if not vcs.isgraphicsmethod(a):
        raise Exception("Error did not retrieve the gm")
    else:
        if not vcs.isscatter(a):                # test object 'a' if scatter
            raise Exception("Error gm is not right type")

    # save 'quick' scatter as a Python script
    a.script('test', 'w')

    print 'yepp'
    a.xticlabels('', '')                  # remove the x-axis
    support.check_plot(x)
    a.xticlabels('*')                    # put the x-axis
    support.check_plot(x)

    ##########################################################################
    # Change the scatter marker type                                           #
    ##########################################################################
    # a.marker=0
    a.marker = 1				# same as a.marker='dot'
    support.check_plot(x)
    a.marker = 2				# same as a.marker='plus'
    support.check_plot(x)
    a.marker = 3				# same as a.marker='star'
    support.check_plot(x)
    a.marker = 4				# same as a.marker='circle'
    support.check_plot(x)
    a.marker = 5				# same as a.marker='cross'
    support.check_plot(x)
    a.marker = 6				# same as a.marker='diamond'
    support.check_plot(x)
    a.marker = 7				# same as a.marker='triangle_up'
    support.check_plot(x)
    a.marker = 8				# same as a.marker='triangle_down'
    support.check_plot(x)
    a.marker = 9				# same as a.marker='triangle_left'
    support.check_plot(x)
    a.marker = 10				# same as a.marker='triangle_right'
    support.check_plot(x)
    a.marker = 11				# same as a.marker='square'
    support.check_plot(x)
    a.marker = 12				# same as a.marker='diamond_fill'
    support.check_plot(x)
    a.marker = 13				# same as a.marker='triangle_up_fill'
    support.check_plot(x)
    a.marker = 14				# same as a.marker='triangle_down_fill'
    support.check_plot(x)
    a.marker = 15				# same as a.marker='triangle_left_fill'
    support.check_plot(x)
    a.marker = 16				# same as a.marker='triangle_right_fill'
    support.check_plot(x)
    a.marker = 17				# same as a.marker='square_fill'
    support.check_plot(x)

    ##########################################################################
    # Change the scatter marker size                                           #
    ##########################################################################
    a.markersize = 5
    support.check_plot(x)
    a.markersize = 55
    support.check_plot(x)
    a.markersize = 100
    support.check_plot(x)
    a.markersize = 300
    support.check_plot(x)
    a.markersize = 15
    support.check_plot(x)

    ##########################################################################
    # Change the scatter marker color                                          #
    ##########################################################################
    a.markercolor = (77)
    support.check_plot(x)
    a.markercolor = 16
    support.check_plot(x)
    a.markercolor = 44			# same as a.markercolor=(44)
    support.check_plot(x)

    ##########################################################################
#.........这里部分代码省略.........
开发者ID:NESII,项目名称:uvcdat,代码行数:101,代码来源:testscatter.py

示例6: test

def test():
    import vcs
    import cdms2 as cdms
    import os
    import support                      # import vcs and cdms

    bg = support.bg

    f = cdms.open(os.path.join(vcs.sample_data, 'clt.nc'))
    s = f('clt')                           # get slab clt
    x = vcs.init()                         # construct vcs canvas

    x.plot(s, 'default', 'isofill', 'quick', bg=bg)  # plot slab the old way
    support.check_plot(x)

    # Check the legend
    g = x.createisofill('vcsmoduletest')
    x.clear()				# clear the VCS Canvas
    x.plot(s, g, bg=bg)				# plot slab the new way
    support.check_plot(x)
    g.legend = (10, 30, 70, 120)
    support.check_plot(x)
    g.legend = {0: 'test string1', 50: 'test string2', 100: 'test string3'}
    support.check_plot(x)
    g.legend = None
    support.check_plot(x)

    if bg == 0:
        x.geometry(450, 337, 100, 0)		# change the geometry and location
        x.flush()
        support.check_plot(x)

    # open and plot a missing data with isofill
    f = cdms.open(os.path.join(vcs.sample_data, 'tas_cru_1979.nc'))
    s = f('tas', longitude=(-180, 180), latitude=(-90, 90)) + 273.15
    x.clear()				# clear the VCS Canvas
    x.plot(
        s,
        'default',
        'isofill',
        'quick',
        bg=bg)  # plot missing value slabe the old way
    support.check_plot(x)

    a = x.getisofill('quick') 		# get 'quick' isofill graphics method
    # test object 'a' for graphics method
    if not vcs.isgraphicsmethod(a):
        raise Exception("Error did not retrieve the gm")
    else:
        if not vcs.isisofill(a):		# check for isofill
            raise Exception("Error gm is not right type")

    a.script('test', 'w')			# save 'quick' isofill as a Python script

    x.setcolormap("AMIP")		# change the colormap from default to AMIP

    a.missing = 241			# change the missing background color to black
    support.check_plot(x)

    if '--extended' not in sys.argv:
        print '\n************* PARTIAL TEST *****************'
        print 'FOR COMPLETE TEST OF THIS MODULE USE '
        print '   -F (--full) or -E (--extended) option'
        print '************* PARTIAL TEST *****************\n'
        sys.exit()

    a.xticlabels('lon30', 'lon30')  # change the x-axis
    support.check_plot(x)
    a.xticlabels('', '')			# remove the x-axis
    support.check_plot(x)
    a.xticlabels('*')			# put the x-axis
    support.check_plot(x)
    a.datawc(-45.0, 45.0, -90.0, 90.0)  # change the region
    support.check_plot(x)
    a.datawc(1e20, 1e20, 1e20, 1e20)  # put the region back
    support.check_plot(x)

    a.levels = ([0, 220], [230, 240], [250, 260])  # change the isofill levels
    support.check_plot(x)
    # change the isofill levels
    a.levels = ([0, 220, 225, 230, 235, 240], [230, 240], [250, 260])
    support.check_plot(x)
    a.levels = ([0, 220, 225, 230, 235, 240],)  # change the isofill levels
    support.check_plot(x)
    # change the isofill levels
    a.levels = ([0, 220, 225, 230, 235, 240, 245, 250])
    support.check_plot(x)
    a.levels = [0, 220, 225, 230, 235, 240] 	# change the isofill levels
    support.check_plot(x)
    a.levels = (
        0.0,
        220.0,
        225.0,
        230.0,
        235.0,
        240.0,
        250.0)		# change the isofill levels
    support.check_plot(x)
    a.levels = ([1e20],)			# change back to default settings
    support.check_plot(x)
#.........这里部分代码省略.........
开发者ID:NESII,项目名称:uvcdat,代码行数:101,代码来源:testisofill.py

示例7: test

def test():
   import vcs,cdms2 as cdms,time,os,sys,support          # import vcs and cu
   bg=support.bg
   
   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) # open clt file
   s=f('clt')                   	# get slab clt
   x=vcs.init()                         # construct vcs canvas
   
   x.plot(s,'default','isoline','quick',bg=support.bg)# plot slab the old way
   support.check_plot(x)
   if bg == 0:
      x.geometry(450,337,0,0)		# change geometry and location
      support.check_plot(x)
      x.geometry(900,675,10,0)		# change geometry and location
      support.check_plot(x)
      x.flush()
      support.check_plot(x)

   
   a=x.getisoline('quick') 		# get 'quick' isoline graphics method
   if not vcs.isgraphicsmethod(a):            # test object 'a' for graphics method
      raise Exception, "Error did not retrieve the gm"
   else:
      if not vcs.isisoline(a):		# check for isoline
         raise Exception, "Error gm is not right type"
   
   a.script('test','w')                 # save 'quick' isoline as a Python script
   
   a.xticlabels('lon30','lon30')	# change the x-axis
   support.check_plot(x)
   a.xticlabels('','')                  # remove the x-axis
   support.check_plot(x)
   a.xticlabels('*')                    # put the x-axis back
   support.check_plot(x)
   a.datawc(-45.0, 45.0, -90.0, 90.0)   # change the region
   support.check_plot(x)
   a.datawc(1e20,1e20,1e20,1e20)        # put the region back
   support.check_plot(x)
	
 
   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()

  
   #########################################################################
   # Set the isoline level vales	     				   #
   #########################################################################
   a.level=([20,0.0],[30,0],[50,0],[60,0])	# change the isoline values
   support.check_plot(x)
   a.level=[[20,0.0],[30,0],[50,0]]	# change the isoline values
   support.check_plot(x)
   a.level=((20,0.0),(30,0),(50,0),(60,0),(70,0)) # change the isoline values
   support.check_plot(x)
   a.level=(25,35,45,55)		# change the isoline values
   support.check_plot(x)
   a.level=[(22,33,44,55,66)]		# change the isoline values
   support.check_plot(x)
   a.level=[(23,32,45,50,76),]		# change the isoline values
   support.check_plot(x)
   a.level=[0]      			# same as a.level=(0,)
   support.check_plot(x)
   a.level=[[0,1e20]] 			# same as a.level=((0,1e20),), use default settings
   support.check_plot(x)

   
   #########################################################################
   # Turn on and off the isoline level labels  				   #
   #########################################################################
   a.label='y'       			# same as a.label=1
   support.check_plot(x)
   a.label='n'       			# same as a.label=0
   support.check_plot(x)
   
   #########################################################################
   # Set the line style and line color        		 		   #
   #########################################################################
   a.level=((20,0.0),(30,0),(50,0),(60,0),(70,0)) # change the isoline values
   support.check_plot(x)
   a.line=[1,3,0,4]			# same as a.line=(1,3,0,4)
   support.check_plot(x)
   a.line=(['dash','long-dash','solid'])# same as a.line=([2,4,0])
   support.check_plot(x)
   a.line=[2,4,1,3,2,0]
   support.check_plot(x)
   a.linecolors=([22,33,44,55,66,77])	# change the line color
   support.check_plot(x)
   a.linecolors=(16,19,33,44)		# change the line color
   support.check_plot(x)
   a.linecolors=None			# use the default line color
   support.check_plot(x)
   a.line=None				# use the default line style, which is solid
   support.check_plot(x)
   
   #########################################################################
   # Set the text font and text color         		 		   #
   #########################################################################
#.........这里部分代码省略.........
开发者ID:AZed,项目名称:uvcdat,代码行数:101,代码来源:testisoline.py

示例8: test

def test():
   import vcs,cdms2 as cdms,time,os,sys,support			# import vcs and cdms

   bg=support.bg
   
   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc'))
   s1=f.getslab('clt')			# get slab clt
   s2=f.getslab('clt',4,4,-45,45,-90,90)
   s3=f.getslab('clt',6,6,0,90,0,180)
   x=vcs.init()				# construct vcs canvas
   
   p1=x.plot(s1,bg=bg)			# plot slab the old way
   support.check_plot(x)
   x.plot(s2,bg=bg)				# plot slab the old way
   support.check_plot(x)
   
   p2=x.getplot('dpy_plot_2')		# get display plot s2

   if not vcs.queries.isplot(p1):			# check for display plot object
      raise exception, "Error, p1 not a display!"


   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()


   p2.name='p2_name'			# change display plot's (p2) name
   p2.off=1				# undisplay display plot (p2)
   support.check_plot(x)
   p2.off=0				# redisplay display plot (p2)
   support.check_plot(x)

   p1.priority=1			# bring display plot (p1) to the front
   support.check_plot(x)

   
   p2.off=1				# undisplay display plot (p2)
   p1.template='default_dud'		# change display plot (p1) template
   support.check_plot(x)

   x.mode=0				# turn atomatic update off
   p1.template='default'		# change display plot (p1) template
   p1.g_type='isoline'			# change display plot (p1) graphics type
   support.check_plot(x)
   x.update()				# view changes now
   support.check_plot(x)

   x.mode=1				# turn atomatic update mode back on
   p1.g_type='isofill'			# change display plot (p1) graphics type
   support.check_plot(x)
   p1.g_name='quick'                    # change display plot (p1) graphics name
   support.check_plot(x)

   p1.array=['plot_2']			# change display plot (p1) array object
   support.check_plot(x)
   p1.array=['plot_1']			# change display plot (p1) array object
   support.check_plot(x)
   p1.array=[s3]			# change display plot (p1) array object
   support.check_plot(x)


   #########################################################################
   #								           #
   # Produce an overlay plot.                                              #
   #								           #
   #########################################################################
   x.mode=0				# turn atomatic update mode back on
   p1.array=['plot_1']			# change display plot (p1) array object
   p2.off=0                             # redisplay display plot (p2)
   p2.priority=2			# bring display plot (p2) to the front
   p2.array=[s1]                  # change display plot (p2) array object
   p2.g_type='isoline'                  # change display plot (p2) graphics type
   p2.g_name='default'                  # change display plot (p1) graphics name
   x.update()				# view changes now
   support.check_plot(x)

   x.mode=1				# turn atomatic update mode back on
   x.removeobject(p1)			# remove the display plot (p1)
   support.check_plot(x)

   print '*************************************************************************************'
   print '******                                                                         ******'
   print '******   D I S P L A Y   T E S T   C O M P L E T E D   S U C E S S F U L L Y   ******'
   print '******                                                                         ******'
   print '*************************************************************************************'
开发者ID:AZed,项目名称:uvcdat,代码行数:89,代码来源:testdisplayplot.py

示例9: test

def test():
    import vcs
    import cdms2 as cdms
    import os
    import support          # import vcs and cu
    bg = support.bg

    f = cdms.open(os.path.join(vcs.sample_data, 'clt.nc'))  # open clt file
    u = f('u')  				# get slab u
    v = f('v') 				# get slab v
    x = vcs.init()                         # construct vcs canvas

    a = x.createxvsy('quick')		# create 'quick' xvsy
    # test object 'a' for graphics method
    if not vcs.isgraphicsmethod(a):
        raise Exception("Error did not retrieve the gm")
    else:
        if not vcs.isxvsy(a):                   # test object 'a' if xvsy
            raise Exception("Error gm is not right type")

    x.plot(u, v, 'default', 'xvsy', 'quick', bg=bg)  # plot slabs the old way
    support.check_plot(x)
    if bg == 0:
        x.geometry(450, 337, 100, 0)		# change the geometry and location
        x.flush()
        support.check_plot(x)

    # save 'quick' xvsy as a Python script
    a.script('test', 'w')

    a.xticlabels('', '')                  # remove the x-axis
    support.check_plot(x)
    a.xticlabels('*')                    # put the x-axis
    support.check_plot(x)

    ##########################################################################
    # Change the xvsy line                                                     #
    ##########################################################################
    a.line = 0        			# same as 'solid'
    support.check_plot(x)
    a.line = 1        			# same as 'dash'
    support.check_plot(x)
    a.line = 2        			# same as 'dot'
    support.check_plot(x)
    a.line = 3        			# same as 'dash-dot'
    support.check_plot(x)
    a.line = 4        			# same as 'long-dash'
    support.check_plot(x)

    if '--extended' not in sys.argv:
        print '\n************* PARTIAL TEST *****************'
        print 'FOR COMPLETE TEST OF THIS MODULE USE '
        print '   -F (--full) or -E (--extended) option'
        print '************* PARTIAL TEST *****************\n'
        sys.exit()

    ##########################################################################
    # Change the xvsy line color                                               #
    ##########################################################################
    a.linecolor = (77)
    support.check_plot(x)
    a.linecolor = 16
    support.check_plot(x)
    a.linecolor = 44  			# same as a.color=(44)
    support.check_plot(x)
    a.linecolor = None
    support.check_plot(x)

    ##########################################################################
    # Change the xvsy marker                                                   #
    ##########################################################################
    a.marker = 1                        	# Same as a.marker='dot'
    support.check_plot(x)
    a.marker = 2                       	# Same as a.marker='plus'
    support.check_plot(x)
    a.marker = 3                       	# Same as a.marker='star'
    support.check_plot(x)
    a.marker = 4                       	# Same as a.marker='circle'
    support.check_plot(x)
    a.marker = 5                        	# Same as a.marker='cross'
    support.check_plot(x)
    a.marker = 6                        	# Same as a.marker='diamond'
    support.check_plot(x)
    a.marker = 7                        	# Same as a.marker='triangle_up'
    support.check_plot(x)
    a.marker = 8                        	# Same as a.marker='triangle_down'
    support.check_plot(x)
    a.marker = 9                        	# Same as a.marker='triangle_left'
    support.check_plot(x)
    a.marker = 10                       	# Same as a.marker='triangle_right'
    support.check_plot(x)
    a.marker = 11                       	# Same as a.marker='square'
    support.check_plot(x)
    a.marker = 12                       	# Same as a.marker='diamond_fill'
    support.check_plot(x)
    a.marker = 13                       	# Same as a.marker='triangle_up_fill'
    support.check_plot(x)
    # Same as a.marker='triangle_down_fill'
    a.marker = 14
    support.check_plot(x)
#.........这里部分代码省略.........
开发者ID:NESII,项目名称:uvcdat,代码行数:101,代码来源:testxvsy.py

示例10: test

def test():
   import vcs_legacy,cdms2 as cdms,time,os,sys,support          # import vcs_legacy and cu
   bg=support.bg
   
   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) # open clt file
   u=f.getslab('u',':',':',-10.,0.,0,10)# get slab u
   v=f.getslab('v',':',':',-10.,0.,0,10)# get slab v
   x=vcs_legacy.init()                         # construct vcs_legacy canvas
   
   x.plot(u, v, 'default','vector','quick',bg=bg)	# plot slab the old way
   support.check_plot(x)
   if bg==0:
      x.geometry(450,337,100,0)		# change the geometry and location
      x.flush()
      support.check_plot(x)
   
   a=x.getvector('quick')		# get 'quick' vector
   if not vcs_legacy.isgraphicsmethod(a):            # test object 'a' for graphics method
      raise Exception, "Error did not retrieve the gm"
   else:
      if not vcs_legacy.isvector(a):                 # test object 'a' if vector
         raise Exception, "Error gm is not right type"
   
   a.script('test','w')                 # save 'quick' vector as a Python script
   
   
   a.xticlabels('','')                  # remove the x-axis
   support.check_plot(x)
   a.xticlabels('*')                    # put the x-axis
   support.check_plot(x)
   
   ############################################################################
   # Change the vector scale                                                  #
   ############################################################################
   a.scale=2.0
   support.check_plot(x)
   a.scale=5.0
   support.check_plot(x)
   a.scale=1.5
   support.check_plot(x)
   a.scale=0.0
   support.check_plot(x)
   a.scale=-1.5
   support.check_plot(x)
   a.scale=-2.0
   support.check_plot(x)
   a.scale=-5.0
   support.check_plot(x)
   
   ############################################################################
   # Change the vector typeiiiiiii                                            #
   ############################################################################
   a.type=0				# same as a.type = 'arrows'
   support.check_plot(x)
   a.type=1				# same as a.type = 'barbs'
   support.check_plot(x)
##    a.type=2				# same as a.type = 'solidarrows'
##    support.check_plot(x)
##    raw_input("Done...")


   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()


 



   ############################################################################
   # Change the vector reference                                              #
   ############################################################################
   a.reference=10.
   support.check_plot(x)
   a.reference=100.
   support.check_plot(x)
   a.reference=4.
   support.check_plot(x)
   a.reference=5.
   support.check_plot(x)
   
   ############################################################################
   # Change the vector alignment                                              #
   ############################################################################
   a.alignment='head'      		# same as a.alignment=0
   support.check_plot(x)
   a.alignment='center'    		# same as a.alignment=1
   support.check_plot(x)
   a.alignment='tail'      		# same as a.alignment=2
   support.check_plot(x)
   
   ############################################################################
   # Change the vector line                                                   #
   ############################################################################
   a.line=0        			# same as 'solid'
   support.check_plot(x)
#.........这里部分代码省略.........
开发者ID:arulalant,项目名称:uvcdat,代码行数:101,代码来源:testvector.py

示例11: test

def test():
   import vcs,cdms2 as cdms,time,os,sys,support		# import vcs and cdms
   bg=support.bg

   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc'))
   s=f('clt')			        # get slab clt
   x=vcs.init()				# construct vcs canvas
   
   x.plot(s,'default','boxfill','quick',bg=bg)# plot slab the old way
   #support.check_plot(x)
   if bg==0:
      x.geometry(450,337)                  # change the geometry
      x.flush()
      #support.check_plot(x)
   
   a=x.getboxfill('quick') 		# get 'quick' boxfill graphics method
   if not vcs.isgraphicsmethod(a):            # test object 'a' for graphics method
      raise Exception, "Error did not retrieve the gm"
   else:
      if not vcs.isboxfill(a):		# check for boxfill
         raise Exception, "Error gm is not right type"

   # Change boxfill's legend
   a.legend={0:'Great',20:'Outstanding',40:'Wonderful',60:'Happy',80:'Exciting!',100:'Best'}
   support.check_plot(x)
   a.legend={0:'100',20:'80',40:'60',60:'40',80:'20',100:'0'}
   support.check_plot(x)
   a.legend={0:'Blue',20:'Green',40:'Yellow',60:'Red',80:'Burgundy',100:'Magenta'}
   support.check_plot(x)
   a.legend=(90)
   support.check_plot(x)
   a.legend=[10,90]
   support.check_plot(x)
   a.legend=(1.5,45.8,89.7)
   support.check_plot(x)
   a.legend=None
   support.check_plot(x)

   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()

   a.color_1=50				# change color_1 index attribute
   support.check_plot(x)
   
   a.xticlabels('lon30','lon30')	# change xlabels attribute
   support.check_plot(x)
   a.xticlabels('','')			# change remove xlables from plot
   support.check_plot(x)
   a.datawc(-45.0, 45.0, -90.0, 90.0) 	# change region
   support.check_plot(x)
   a.datawc(1e20,1e20,1e20,1e20)	# change region back
   support.check_plot(x)
   a.xticlabels('*')			# change attribute labels back
   support.check_plot(x)
   
   x.mode=0				# turn atomatic update off
   a.color_1=100			# change color_1 attribute
   a.color_2=200			# change color_2 index value
   a.xticlabels('lon30','lon30')	# change attribute
   a.yticlabels('','')			# change y-labels off attribute
   a.datawc(-45.0, 45.0, -90.0, 90.0) 	# change region
   support.check_plot(x)
   x.update()				# view changes now
   support.check_plot(x)
   
   # Test log10 boxfill plot
   x.clear()				# clear the VCS Canvas
   a.boxfill_type = 'log10'             # Change the Boxfill type to log10
   a.datawc(1e20,1e20,1e20,1e20) 	# change region
   a.level_1=1e20			# change level_1
   a.level_2=1e20			# change level_2
   a.color_1=16				# change color_1 attribute
   a.color_2=239			# change color_2 index value
   x.boxfill(s,a,bg=bg)		        # plot using default template
   support.check_plot(x)


   # Test custom boxfill plot
   x.clear()				# clear the VCS Canvas
   a.boxfill_type = 'custom'            # Change the Boxfill type to custom 
   a.levels=(0,20,35,40,75,100)         # Set the custom ranges
   a.fillareacolors=(16,25,38,55,100,166) # Set the color indices
   x.boxfill(s,a,bg=bg)		        # plot using default template
   support.check_plot(x)

   # Test legend with fillareacolors boxfill plot
   x.clear()				# clear the VCS Canvas
   a.boxfill_type = 'linear'            # Change the Boxfill type back to linear 
   a.fillareacolors=(254,)           # Set the color indices
   a.level_1=0				# change level_1
   a.level_2=0				# change level_2
   x.boxfill(s,a,bg=bg)		        # plot using default template
   support.check_plot(x)
   
   a.script('test','w')			# save 'quick' boxfill as a Python script
   
#.........这里部分代码省略.........
开发者ID:AZed,项目名称:uvcdat,代码行数:101,代码来源:testboxfill.py

示例12: test

def test():

   import vcs,support,sys
   bg=support.bg
   
   x=vcs.init()
   
   # For plotting of each test case, set the pause time to 1.
   x.pause_time=1
   
   ############################ First Test ###############################
   
   # Set the global viewport values only.
   #
   # Remember, must set global x.viewport (vp) and/or x.world coordinate (wc)
   # values before calling { [x.createline, x.createmarker, x.createfillarea,
   # x.createtext], [x.getline, x.getmarker, x.getfillarea, x.gettext],
   # [x.drawline, x.drawmarker, x.drawfillarea, x.drawtext] }.
   #
   # If the global viewport (vp) and world coordinate (wc) values are set 
   # and the, functions, listed above, do not specify them, then the global
   # settings will override the default settings.
   #
   # If the functions listed above have vp and wc set as an argument, then 
   # these vp and wc values will be used instead of the global vp and wc
   # values.
   #
   # Draw text on the screen.
   tex=x.createtext('nTtex','std','nToex','7left')
   tex.height = 25
   tex.x=[0.1, 0.1]
   tex.y=[0.97, 0.93]
   tex.string=['Example of drawing VCS low-level primitives.', 'Also, an example of using the viewport to clip graphics.']
   x.plot(tex,bg=bg)
   support.check_plot(x)
   #
   # At this point, let the world coordinate values remain at the default
   # settings [0, 1, 0, 1], but change the viewport.
   x.viewport=[0.3,0.7,0.3,0.7]
   support.check_plot(x)
   
   # Create the line, marker, fill area, and text objects
   ln=x.createline('new')
   mk=x.createmarker('new')
   fa=x.createfillarea('new')
   t=x.createtext('newTt','std','newTo','7left')
   
   # Draw a box around the entire VCS Canvas viewport. It will use the
   # global viewport set above and use the default world coordinate values:
   # Remember the default values for vp and wc are:
   #            viewport         = [0.0, 1.0, 0.0, 1.0]
   #            worldcoordinate  = [0.0, 1.0, 0.0, 1.0]
   ln.x=[0, 1, 1, 0, 0]		# x line positions
   ln.y=[0, 0, 1, 1, 0]		# y line positions
   ln.width=4  			# test width
   ln.color = 242 			# test color
   ln.type = 4			# test line type
   x.plot(ln,bg=bg)			# plot lines
   support.check_plot(x)
   
   # Draw text on the screen. Use global vp and default wc.
   t.x = [0.2, 0.7]		# x text positions
   t.y = [0.7, 0.7]		# y text positions
   t.string=['PCMDI', 'CDAT']	# text strings
   t.color=243			# text color
   t.height = 90			# text size
   x.plot(t,bg=bg)			# plot text
   support.check_plot(x)
   
   # Draw fill area on screen. Use global vp and default wc.
   fa.x=[[0.0,0.5,0.5,0.0],[0.5,1.0,0.75]]  # x fill area positions
   fa.y=[[0.0,0.0,0.5,0.5],[0.5,0.5,0.0]]   # x fill area positions
   
   # fa.color=[241,243] cannot do this! How important is this?
   
   fa.color=241				# fill area color
   fa.style='solid'			# fill area style
   fa.index=3				# fill area index
   x.plot(fa,bg=bg)				# plot fill area
   support.check_plot(x)
  
   
   # Draw marker on screen. Use global vp and default wc.
   mk.x=[[0.5,0.2],[0.3,0.7,1.0]]	# x marker positions
   mk.y=[[0.5,0.2],[0.3,0.7,0.5]]	# y marker positions
   mk.color=242			# marker color
   mk.size=50			# marker size
   mk.type='dot'			# marker type
   x.plot(mk,bg=bg)			# plot marker
   support.check_plot(x)
   
   ############################ First Test completed ######################

 
   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()
#.........这里部分代码省略.........
开发者ID:AZed,项目名称:uvcdat,代码行数:101,代码来源:testprimitives.py

示例13: test

def test():
   import vcs,cdms2 as cdms,time,os,sys,support 		# import vcs and cdms
   bg=support.bg

   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) # open clt file
   s=f('clt')                   	# get slab clt
   x=vcs.init()                         # construct vcs canvas

   tt=x.createtext()
   

   a = x.listelements('template')                   # show the list of templates
   t=x.createtemplate('test','ASD')    # create template 'test' from ASD

   t.ylabel1.texttable=tt
   t.ylabel1.textorientation=tt
   
   a2 = x.listelements('template')                   # show the list of templates
   if a2==a:
      raise Excpetion,"Error, template not added to list"
   if not vcs.istemplate(t):
      raise Exception,"Error obj created is not a template!"
   
   t.script('test','w')			# save test template as a Python script

   g=x.createisofill('test')           	# create isofill 'test' from 'default' isofill

   x.plot(g,s,t,bg=bg)			# make isofill plot
   support.check_plot(x)
   
   #############################################################################
   # Show the many different ways to show the template members (attributes)    #
   # and their values.                                                         #
   #############################################################################
##    t.list()				# list the templates members
##    t.list('text')			# list only text members, same as t.list('Pt')
##    t.list('format')			# list only format members, same as t.list('Pf')
##    t.list('xtickmarks')			# list only xtickmarks members, same as t.list('Pxt')
##    t.list('ytickmarks')			# list only ytickmarks members, same as t.list('Pyt')
##    t.list('xlabels')			# list only xlabels members, same as t.list('Pxl')
##    t.list('ylabels')			# list only ylabels members, same as t.list('Pyl')
##    t.list('boxeslines')			# list only boxeslines members, same as t.list('Pbl')
##    t.list('legend')			# list only legend member, same as t.list('Pls')
##    t.list('data')			# list only data member, same as t.list('Pds')
##    t.list('file')			# list only file member and its values
##    t.file.list()			# list only file member and its values
##    t.list('mean')			# list only mean member and its values
##    t.mean.list()			# list only mean member and its values

   #############################################################################
   # The screen x and y positions on the screen are normalized between 0 and 1 #
   # for both the x and y axis.                                                #
   #############################################################################
   t.mean.priority = 0			# remove the "Mean" text from the plot
   support.check_plot(x)
   t.mean.priority = 1			# re-display the "Mean" text on the plot
   support.check_plot(x)
   t.mean.x=0.5				# move the "Mean" text to x-axis center
   support.check_plot(x)
   t.mean.y=0.5				# move the "Mean" text to y-axis center
   support.check_plot(x)
   


   if not '--extended' in sys.argv:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()


 
   #############################################################################
   # Position the data in front of the "Mean" text, then move the "Mean" text  #
   # in front of the data.                                                     #
   #############################################################################
   t.data.priority = 2
   support.check_plot(x)
   t.data.priority=3
   support.check_plot(x)
#  The above does not work. I will fix this later when time permits.
# seems to work now 2007-07-16
   t.data.priority=1 # back to normal
   support.check_plot(x)

   #############################################################################
   # Change the font representation for the "Mean" text.                       #
   # You can set the text by using text objects or text names.                 #
   #############################################################################
   tt = x.createtexttable('test')
   to = x.createtextorientation('test')
   t.mean.texttable = tt		# set texttable by using texttable object
   support.check_plot(x)
   t.mean.textorientation = 'test'	# set textorientation by using textorientation name
   support.check_plot(x)
   t.mean.list()                        # show the mean member and their new values
   tt.font=2				# change the font 
   support.check_plot(x)
   to.height=40				# change the height
#.........这里部分代码省略.........
开发者ID:AZed,项目名称:uvcdat,代码行数:101,代码来源:testtemplate.py

示例14: test

def test():
   import vcs_legacy,cdms2 as cdms,time,os,sys,support          # import vcs_legacy and cu

   bg= support.bg
   
   f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) # open clt file
   s=f('clt')                           # get slab clt
   x=vcs_legacy.init()                         # construct vcs_legacy canvas
   

   a=x.createoutline('test')           # create 'test' outline
   if not vcs_legacy.isgraphicsmethod(a):            # test object 'a' for graphics method
      raise Exception, "Error did not retrieve the gm"
   else:
      if not vcs_legacy.isoutline(a):		# check for outline
         raise Exception, "Error gm is not right type"

   x.plot(s,'default','outline','test',bg=bg)# plot slab the old way
   support.check_plot(x)
   if bg==0:
      x.geometry(450,337,100,0)            # change the geometry and location
      x.flush()
      support.check_plot(x)
   
   s=f('u')	                        # get u slab
   x.clear()                            # clear the VCS Canvas
   x.plot(s,'default','outline','test',bg=bg)# plot the surface data
   support.check_plot(x)
   
   
   a.script('test','w')			# save 'test' outline as a Python script
   
   a.xticlabels('lon30','lon30')        # change the x-axis
   support.check_plot(x)
   a.xticlabels('','')                  # remove the x-axis
   support.check_plot(x)
   a.xticlabels('*')                    # put the x-axis
   support.check_plot(x)
   a.datawc(-45.0, 45.0, -90.0, 90.0)   # change the region
   support.check_plot(x)
   a.datawc(1e20,1e20,1e20,1e20)        # put the region back
   support.check_plot(x)
   

   cont = False
   for anarg in sys.argv:
      if anarg in ['--extended', '--full','-E','-F']:
         cont = True
         break
   if cont is False:
     print '\n************* PARTIAL TEST *****************'
     print 'FOR COMPLETE TEST OF THIS MODULE USE '
     print '   -F (--full) or -E (--extended) option'
     print '************* PARTIAL TEST *****************\n'
     sys.exit()

   a.outline=([0])			# set the outline value
   support.check_plot(x)
   a.line=0        			# same as 'solid', change the line style
   support.check_plot(x)
   a.line=1        			# same as 'dash', change the line style
   support.check_plot(x)
   a.line=2        			# same as 'dot', change the line style
   support.check_plot(x)
   a.line=3        			# same as 'dash-dot', change the line style
   support.check_plot(x)
   a.line=4        			# same as 'long-dash', change the line style
   support.check_plot(x)
   a.linecolor=(77)			# change the line color
   support.check_plot(x)
   a.linecolor=16			# change the line color
   support.check_plot(x)
   a.linecolor=44  			# same as a.linecolor=(44)
   support.check_plot(x)
   a.linecolor=None			# use the default line color, black
   support.check_plot(x)
   a.line=None				# use default line style, solid black line
   support.check_plot(x)

   a.outline=([1])			# set the outline value
   support.check_plot(x)
   a.outline=([0,1])			# set the outline value
   support.check_plot(x)
   a.outline=([0])			# set the outline value
   support.check_plot(x)
   
   x.clear()                            # clear the VCS Canvas
   x.outline(s,a,'default',bg=bg)             # plot outline using 'default' template
   support.check_plot(x)
   
   objs =x.listelements('template')                   # get the list of templates
   t=x.createtemplate('test')           # create template 'test' from 'default' template
   if not vcs_legacy.istemplate(t):                  # test whether 't' is a template or not
      raise Exception,"Error template not created"
   else:
      a2 =x.listelements('template')                   # get the list of templates
      if objs==a2:
         raise Exception,"Error template not created or added to list"
   
   x.clear()				# clear the VCS Canvas
#.........这里部分代码省略.........
开发者ID:arulalant,项目名称:uvcdat,代码行数:101,代码来源:testoutline.py

示例15: test

def test():
    import vcs
    import cdms2
    import os
    import support          # import vcs and cdms

    # In the initial.attribute file the page orientation is set to
    # portrait. The test is to convert from portrait to landscape.
    # See your initial.attribute file and set "Page(portrait)".
    # This should be located at the top of the initial.attribute
    # file.
    x = vcs.init()
    x.pause_time = 2

    # Check for the canvas orientation, which should be by default 'landscape'
    if x.islandscape() == 1:              # will return 1 if true or 0 if false
        print 'landscape page mode'
    if x.isportrait() == 1:		      # will return 1 if true or 0 if false
        print 'portrait page mode'
    # will return 'landscape' or 'portrait'
    print 'The page orientation is ( %s ). ' % x.orientation()

    # Change the page orientation to portrait and print the test cases
    print '\nChange the page orientation to portrait and test'
    x.portrait()			# Change page orientation to portrait
    if x.islandscape() == 1:
        print 'landscape page mode'
    if x.isportrait() == 1:
        print 'portrait page mode'
    # will return 'landscape' or 'portrait'
    print 'The page orientation is ( %s ). ' % x.orientation()

    # Change the page orientation to landscape and print the test cases
    print '\nChange the page orientation to landscape and test'
    x.landscape()
    if x.islandscape() == 1:              # will return 1 if true or 0 if false
        print 'landscape page mode'
    if x.isportrait() == 1:		      # will return 1 if true or 0 if false
        print 'portrait page mode'
    # will return 'landscape' or 'portrait'
    print 'The page orientation is ( %s ). ' % x.orientation()

    #
    # prints in location mode
    # I feel this is correct!
    #
    f = cdms2.open(os.path.join(vcs.sample_data, 'clt.nc'))
    s = f('clt')
    x = vcs.init()
    t = x.createtemplate('new')
    to = x.createtextorientation('test')
    to.height = 30
    t.mean.y = 0.5
    t.mean.x = 0.5
    t.mean.textorientation = to
    t.mean.list()
    x.plot(s, t, bg=support.bg)
    support.check_plot(x)
    x.flush()
    support.check_plot(x)

    #
    x.portrait()           # This will clear the screen
    support.check_plot(x)
    x.plot(s, t, bg=support.bg)
    support.check_plot(x)

    #
    x.landscape()           # This will clear the screen
    support.check_plot(x)
    x.plot(s, t, bg=support.bg)
    support.check_plot(x)

    print '*************************************************************************************'
    print '******                                                                         ******'
    print '******   P A G E  O R I E N T A T I O N   T E S T   C O M P L E T E D          ******'
    print '******   S U C E S S F U L L Y    ! ! !                                        ******'
    print '******                                                                         ******'
    print '*************************************************************************************'
开发者ID:NESII,项目名称:uvcdat,代码行数:79,代码来源:testorientation.py


注:本文中的support.check_plot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。