<jupyter_start><jupyter_text>Plotting CDMS data in Python Overview~~~~~~~~Data read via the CDMS Python interface can be plotted using the ``vcs``module. This module, part of the Climate DataAnalysis Tool (CDAT) is documented in the CDAT reference manual.The ``vcs`` module provides access to the functionality of the VCSvisualization program.Examples of plotting data accessed from CDMS are given below, as well asdocumentation for the plot routine keywords.Examples~~~~~~~~In the following examples, it is assumed that variable ``psl`` isdimensioned (time, latitude, longitude). ``psl`` is contained in thedataset named ``'sample.xml'``. Plotting a Gridded VariableExample: plotting a gridded variable<jupyter_code>import cdms2, vcs 
f = cdms2.open("clt.nc") 
clt = f.variables['clt'] 
sample = clt[0,:] 
w=vcs.init() 
w.plot(sample) 
f.close()<jupyter_output><empty_output><jupyter_text>**Notes:**   "3","Get a horizontal slice, for the first time point."   "4","Create a VCS Canvas ``w``."      "5", "Plot the data.  Because sample is a transient variable, it encapsulates all the time, latitude, longitude, and attribute information."   "7", "Close the file.  This must be done after the reference to the persistent variable ``ps l``."Thats it! The axis coordinates, variable name, description, units, etc.are obtained from variable sample.What if the units are not explicitly defined for ``clt``, or a differentdescription is desired? ``plot`` has a number of other keywords whichfill in the extra plot information. Using A Plot Keywords<jupyter_code>import cdms2, vcs
f = cdms2.open("clt.nc")
clt = f.variables['clt']
sample = clt[0,:]
w=vcs.init()
w.plot(sample, units='percent', file_comment='', long_name="Total Cloud", comment1="Example plot", hms="00:00:00", ymd="1979/01/01")

f.close()<jupyter_output><empty_output><jupyter_text>**Note:** Keyword arguments can be listed in any order. Plotting a Time-Latitude SliceAssuming that variable ``clt`` has domain ``(time,latitude,longitude)``,this example selects and plots a time-latitude slice:<jupyter_code>import cdms2, vcs
f = cdms2.open("clt.nc")
clt = f.variables['clt']
samp = clt[:,:,0]
w = vcs.init()
w.plot(samp, name='Total Cloudiness')<jupyter_output><empty_output><jupyter_text>"4", "``samp`` is a slice of ``clt``, at index ``0`` of the last dimension.  Since ``samp`` was obtained from the slice operator, it is a transient variable, which includes the latitude and time information."  "6", "The ``name`` keyword defines the identifier, default is the name found in the file." Plotting Subsetted DataCalling the variable ``clt`` as a function reads a subset of thevariable. The result variable ``samp`` can be plotted directly:<jupyter_code>import cdms2, vcs
f = cdms2.open("clt.nc")
clt = f.variables['clt']
samp = clt(time = (0.0,100.0), longitude = 180.0, squeeze=1)
w = vcs.init()
w.plot(samp)

f.close()<jupyter_output><empty_output>