# Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms,vcs_legacy,sys,time,support,os bg=support.bg x=vcs_legacy.init() x.portrait() #x.setdefaultfont(2) f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','clt.nc')) s=f('clt') iso = x.createisofill('my') levs = range(0,95,5) #print len(levs) colors = vcs_legacy.getcolors(levs) hatch = [] iso.levels=levs iso.fillareacolors=colors iso.fillareastyle='pattern' iso.fillareastyle='hatch' iso.fillareaindices=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] #print iso.fillareaindices #iso.fillareaindices=[17,]*21 #print colors #iso.list() l = x.createline('my') l.x=[.001,.999,.999,.001,.001] l.y=[.001,.001,.999,.999,.001] x.plot(l,bg=bg) support.check_plot(x) x.plot(s,iso,bg=bg)
import cdms2 as cdms, vcs_legacy, sys, time, support, os bg = support.bg x = vcs_legacy.init() x.portrait() #x.setdefaultfont(2) f = cdms.open( os.path.join(cdms.__path__[0], '..', '..', '..', '..', 'sample_data', 'clt.nc')) s = f('clt') iso = x.createisofill('my') levs = range(0, 95, 5) #print len(levs) colors = vcs_legacy.getcolors(levs) hatch = [] iso.levels = levs iso.fillareacolors = colors iso.fillareastyle = 'pattern' iso.fillareastyle = 'hatch' iso.fillareaindices = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 ] #print iso.fillareaindices #iso.fillareaindices=[17,]*21 #print colors #iso.list() l = x.createline('my') l.x = [.001, .999, .999, .001, .001]
import vcs_legacy import cdms2 as cdms import sys import os import support f=cdms.open(os.path.join(cdms.__path__[0],'..','..','..','..','sample_data','meshfill.nc')) M=f('Mesh') s=f('Data') x=vcs_legacy.init() x.scriptrun(os.path.join(cdms.__path__[0],'..','..','..','..','bin','ASD.scr')) m=x.getmeshfill('ASD') m.wrap=[0,360] m.mesh='y' #mn,mx=vcs_legacy.minmax(s) levs=vcs_legacy.mkscale(-10,30) #print levs levs=vcs_legacy.mkevenlevels(levs[0],levs[-1],256) levs2=levs[::25] if levs2[-1]!=levs[-1]: levs2.append(levs[-1]) lbls=vcs_legacy.mklabels(levs2) #print levs m.legend=lbls m.levels=levs[::-1] m.fillareacolors=vcs_legacy.getcolors(levs) ## m.list() x.plot(s,M,m,bg=support.bg) support.check_plot(x)
import sys import os import support f = cdms.open( os.path.join(cdms.__path__[0], '..', '..', '..', '..', 'sample_data', 'meshfill.nc')) M = f('Mesh') s = f('Data') x = vcs_legacy.init() x.scriptrun( os.path.join(cdms.__path__[0], '..', '..', '..', '..', 'bin', 'ASD.scr')) m = x.getmeshfill('ASD') m.wrap = [0, 360] m.mesh = 'y' #mn,mx=vcs_legacy.minmax(s) levs = vcs_legacy.mkscale(-10, 30) #print levs levs = vcs_legacy.mkevenlevels(levs[0], levs[-1], 256) levs2 = levs[::25] if levs2[-1] != levs[-1]: levs2.append(levs[-1]) lbls = vcs_legacy.mklabels(levs2) #print levs m.legend = lbls m.levels = levs[::-1] m.fillareacolors = vcs_legacy.getcolors(levs) ## m.list() x.plot(s, M, m, bg=support.bg) support.check_plot(x)
import vcs_legacy ## testing color split ncols = 100 def verify_cols(colors,ok): for i in range(len(colors)): if colors[i]!=ok[i]: raise Exception,'Error colors (%s) are not matching good colors (%s)' % (colors,ok) values = [-5,-4,-3,-2,-1,0,1,2,3,4,5] ok_cols = [0, 12, 25, 37, 49, 50, 62, 75, 87, 99] cols = vcs_legacy.getcolors(values,colors=range(ncols)) verify_cols(cols,ok_cols) values = [-5,-4,-3,-2,-1,0,1,2,3] ok_cols = [0, 12, 25, 37, 49, 50, 75, 99] cols = vcs_legacy.getcolors(values,colors=range(ncols)) verify_cols(cols,ok_cols) values = [-5,-4,-3,-2,-1,1,2,3,4,5] ok_cols = [0, 16, 33, 49, 240, 50, 66, 83, 99] cols = vcs_legacy.getcolors(values,colors=range(ncols)) verify_cols(cols,ok_cols) values = [-5,-4,-3,-2,-1,1,2,3] ok_cols = [0, 16, 33, 49, 240, 50, 99] cols = vcs_legacy.getcolors(values,colors=range(ncols)) verify_cols(cols,ok_cols)