This tutorial demonstrates VCS streamline support We show randomly seeded and evenly spaced streamlines.
import warnings warnings.filterwarnings('ignore') import vcs import cdms2
The CDAT software was developed by LLNL. This tutorial was written by Charles Doutriaux. This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344.
import cdms2 import vcs
# Download the sample data if needed # vcs.download_sample_data_files() # read clt.nc f=cdms2.open(vcs.sample_data+"/clt.nc")
# read two variables u = f("u") v = f("v")
# initialize vcs x=vcs.init()
# create the streamline graphics method gm = x.createstreamline()
# we set parameters for randomly seeded streamlines gm.evenlyspaced = False # only available on releases after 2.10 or on the nightly packages. # streamlines are colored by vector magnitude gm.coloredbyvector = True # We want 10 glyphs(arrows) per streamline gm.numberofglyphs = 10 gm.filledglyph = True # we place 400 random seeds in a circle that covers the data. This means fewer seeds will be inside the data. # The number of seeds inside the data will result in streamlines. gm.numberofseeds = 400
# use the robinson projection for the data. p = x.createprojection() p.type = 'robinson' gm.projection = p
# we plot randomly seeded streamlines x.plot(u, v, gm, bg=1)
# we plot evenly spaced streamlines x.clear() gm.evenlyspaced = True # only available only on releases > 2.10 or on the nightly packages # We want the streamline to be about one cell apart from each other gm.separatingdistance = 1 # The seed for the first streamline. All other seeds are generated automatically gm.startseed = [0, 0, 0] # create an evenly spaced streamline plot x.plot(u, v, gm, bg=1)