![](media/image1.jpeg){width="2.2291666666666665in"
height="0.9166666666666666in"}

**A USER'S GUIDE TO THE**

**PCMDI CLIMATE DATA ANALYSIS TOOL (CDAT):**

**A WORKBENCH FOR CLIMATE DATA**

**ANALYSIS AND DISPLAY**

by

Dean N. Williams, James S. Boyle, Clyde G. Dease, Charles Doutriaux,

Robert S. Drach, Justin J. Hnilo, Susan M. Marlais, Charles J. O'Connor,

Gerald L. Potter, and Karl E. Taylor

Program for Climate Model Diagnosis and Intercomparison

Lawrence Livermore National Laboratory, Livermore, CA, USA

**July 1999**

# 

This guide explains how to use the Program for Climate Model Diagnosis
and Intercomparison

(PCMDI) Climate Data Analysis Tool (CDAT) that is currently being
distributed to the global

climate community. Other primary and secondary PCMDI software and
documentation will not

be included in this document, but can be obtained on the World Wide Web
at URL **http://www-pcmdi.llnl.gov/softwar**e. Users who wish to acquire
PCMDI software source code, may do so by filling out the collaboration
agreement that also may be found at this URL. This collaboration

agreement acknowledges software ownership (i.e., U.S. Department of
Energy) and restricts its

use to noncommercial applications.

A key responsibility of PCMDI is to support climate model
intercomparison projects such as the Atmospheric Model Intercomparison
Project (AMIP) and the Coupled Model Intercomparison Project (CMIP). It
is therefore CDAT's primary design goal to accommodate the needs of
these and other intercomparison projects, but it is also the hope of the
authors that the software is flexible enough to assist in other areas of
the geophysical sciences.

In order to better serve the global climate community, users are
encouraged to provide feedback

on CDAT or other PCMDI software products to:

> Program for Climate Model Diagnosis and Intercomparison (PCMDI)
>
> Lawrence Livermore National Laboratory
>
> P.O. Box 808, L-264
>
> Livermore, California (USA) 94550
>
> E-Mail: williams@pcmdi.llnl.gov
>
> Tel: (925) 422-7626
>
> Fax: (925) 422-7675

# 

Preface [1](#section)

TABLE OF CONTENTS [2](#section-1)

Abstract [4](#section-2)

Acknowledgments [1](#section-3)

Introduction [1](#section-4)

Background [1](#section-5)

Statement of the Problem [1](#section-6)

Purpose of the Project [1](#section-7)

Future Capabilities Required [3](#section-8)

SETUP [5](#section-9)

To set up CDAT & CDATGUI: [5](#section-10)

Before Running CDAT [5](#section-11)

Recommended Input Files [5](#section-12)

File for Specifying Initial Attributes [5](#section-13)

Changing the initial.attributes File [6](#section-14)

File for Printing [6](#section-15)

Setting XGKS Fonts [7](#section-16)

Setting Python Libraries [7](#section-17)

AVAILABILITY [8](#section-18)

PYTHON PROGRAMMING [8](#section-19)

Basic Statements [8](#section-20)

Reserved Programming Words [8](#section-21)

Reserved Built-In Functions [8](#section-22)

Selections [9](#section-23)

While Loops [10](#section-24)

For Loops [10](#section-25)

COMMAND MODULES EXAMPLES [12](#section-26)

CDUNIF Common Data UNiform InterFace [12](#section-27)

Creating a file object [12](#section-28)

Getting Information out of a cdunif file object [12](#section-29)

Setting defaults [17](#section-30)

Retrieving objects from a cdunif file [18](#section-31)

CDTIME [21](#section-32)

LATS - Library of AMIP II Transmission Standards [23](#section-33)

Numeric [26](#section-34)

Terminology [27](#section-35)

Constructors - creating an array object [28](#section-36)

Convenience Functions [29](#section-37)

Structural Operations on Arrays [32](#section-38)

Miscellaneous Convenience Functions [36](#section-40)

Sorting and Searching Arrays [38](#section-41)

Manipulating Arrays [39](#section-42)

Array Object Methods [41](#section-43)

Array Objects Attributes [49](#section-44)

Arithmetic and logical Operations [50](#section-45)

Ufunc Methods - Universal Functions [58](#section-46)

Numerical Functions [60](#section-47)

Random Numbers [62](#section-48)

Linear Algebra [63](#section-49)

FFT [65](#section-50)

PCMDI [67](#section-51)

VCS Visualization and Computation System [70](#section-52)

Constructor - Creating a VCS Object [70](#section-53)

VCS Object Methods [71](#section-54)

DAT\'s Graphical User Interface [78](#section-55)

CDAT Command Input Window [78](#section-56)

How to Use the CDAT Command Input Window [78](#section-57)

CDAT Output Window [79](#section-58)

How to Use the CDAT Output Window [79](#section-59)

CDAT Help Index Window [80](#section-60)

How to Use the CDAT Help Index Window [80](#section-61)

Displaying Module and Command Information [80](#section-62)

Script Editor Window [81](#section-63)

How to Use the Script Editor Window [81](#section-64)

ColorMap Editor/Table Panel [84](#section-65)

Animation Control Panel [86](#section-66)

VCS Canvas [89](#section-67)

Examples [90](#section-68)

Example 1: [90](#section-69)

Example 2: [90](#section-70)

Example 3: [91](#section-71)

Example 4: [93](#section-72)

Frequently Asked Questions (FAQs) [96](#section-73)

# 

The Climate Data Analysis Tool (CDAT) developed by the Program for
Climate Model The Climate Data Analysis Tool (CDAT) developed by the
Program for Climate Model Diagnosis and Intercomparison (PCMDI) at
Lawrence Livermore National Laboratory, with the capabilities needed to
analyze model data with little effort on the part of the climate
research scientist, while performing complex mathematical calculations,
and graphically displaying the results. This computer software meets the
demanding needs of climate research scientists by providing the
necessary tools to diagnose, validate, and intercompare large
observational and global climate model data sets.

CDAT uses Python, the interpreted, interactive, object-oriented
scripting language, as its centralized module. The learning curve for
CDAT is gradual, allowing the novice to quickly obtain useful results;
yet the modular design of CDAT and the use of Python make it easy to add
user-designed C, C++, or FORTRAN subroutines to share modules and
routines in collaborative projects. These features of CDAT provide
climate scientists with an easy and fast way of reading different file
formats and analyzing data.

# 

The development of CDAT would not have been possible without feedback
from the entire

PCMDI staff, who have indicated to the authors the type of software
needed to do their work

efficiently.

Special thanks are due to the PCMDI software design and development team
members Jim

Boyle, Clyde Dease, Robert Drach, Susan Marlais, Anna McCravy, Charles
O'Connor, Jerry

Potter, and Dean Williams. Additional thanks are due to Jerry Potter for
his unwavering support

and encouragement to the software team, and to Tom Phillips for his
editorial assistance. A final

thanks is extended to all the individuals who endured the frustrations
of beta testing this software.

This work was performed under the auspices of the U.S. Department of
Energy, Environmental

Sciences Division, by the Lawrence Livermore National Laboratory under
contract W-7405-

ENG-48.

# 

## 

The Program for Climate Model Diagnosis and Intercomparison (PCMDI) at
the Lawrence Livermore National Laboratory (LLNL) is coordinating the
Atmospheric Model Intercomparison Project (AMIP), an international
collaboration whose goal is to reduce the errors in model simulations of
climate. In this project, more than thirty climate modeling groups have
submitted their data to PCMDI. PCMDI is also coordinating the Coupled
Model Intercomparison Project (CMIP), the analog of AMIP for global
coupled ocean-atmosphere general circulation models. This project
presently has nineteen international participants. In its support for
AMIP, CMIP, and other model intercomparison experiments, PCMDI works to
improve the methods for diagnosing, validating, and intercomparing
climate model data.

## 

It is imperative that a flexible utility exist for easily ingesting,
manipulating, visualizing, and archiving massive amounts of climate
model data by a number of different techniques, as it is impractical to
convert data from one file format to another and impossible to gain
insight into these models' behavior without many graphical
representations of the data. In comparing simulations from multiple
models, it is important to have computational capability and, since most
of these models use different grids, to also have the capability to
perform grid transformations. Once a large data set has been analyzed in
a preliminary fashion, it is equally important to store it for further
evaluation.

The problem facing climate scientists is not the absence of software to
analyze their data; it is, rather, a shortage of diagnostic tools that
are consistent, flexible, portable, adaptable, efficient, and easy to
use. As a consequence, many scientists are writing their own programs to
ingest and manipulate data. Redundancy in such efforts diverts time that
otherwise would be spent on research to the debugging and enhancing of
these programs. The resulting software is often not user-friendly or
portable, and does not promote common standards within the climate
community.

Another obstacle to sharing analysis software is the wide variety of
data file formats that are in use, making it necessary to write programs
to convert data to one\'s preferred file format conventions. This data
conversion requires additional expenditure of effort on testing and
quality assurance. Software to perform such tasks transparently would
thus be a valuable asset for climate scientists, allowing them to spend
their time analyzing, rather than processing data.

## 

Therefore, the design of this application software was driven by the
need to provide climate research scientists with a means to ingest large
data sets in many different file formats, perform extensive auxiliary
data calculations, graphically display and animate data, and archive
derived data sets. In addition, the design included a scripting language
and a standalone rapid development tool to allow for rapid prototyping
and easy integration of user routines, whether they be in Python or in
some other commonly used programming language (e.g., C or FORTRAN).

To fulfill these needs of climate scientists, the Climate Data Analysis
Tool (CDAT) uses existing software products developed at PCMDI, with the
Python programming language providing the glue to coordinate this
software in a single package. Python has many built-in functions, basic
mathematical operations, an import extension language for application
modules, very clear scripting syntax, and powerful data structures.

Orbital Python modules which were written to perform the functions of
existing PCMDI software products include: the Common Data UNIform File
(cdunif) reader module, which ingests large climate datasets in netCDF,
HDF, DRS, and GrADS/GRIB format; the Visualization and Computation
System (VCS) module, visually displays and animates ingested or created
data; and the Library of AMIP Data Transmission Standards (LATS) module,
outputs data in the machine-independent netCDF or GrADS/GRIB file
formats. For further information on the software products associated
with these modules see Web site **http://www-pcmdi.llnl.gov/software**.
In addition, the Command Line Interface (CLI) module allows CDAT to
receive argument and function input via the command line and the
Graphical User Interface (GUI) allows CDAT to receive argument and
function input via a point-and-click environment.

Additional Python modules which were modified or newly developed for
climate research applications include: the Numeric module, which
supplies the mathematics functions necessary for climate data
manipulation; the PCMDI module, which contains important miscellaneous
functions like the regridder that transforms data from one model grid to
another; the CDTIME module, which includes routines for converting
different time units; and the Climate Diagnostics Routines (CDR) module,
which is a collection of climate diagnostic routines.

It is these modules that make CDAT unique. The software, which runs as a
standalone process or within PCMDI's Visualization and Computation
System (VCS), provides climate scientists with an easy and fast method
to read different file formats, and to analyze and graphically display
climate data in an integrated fashion. CDAT includes a set of
pre-defined functions to allow the user to manipulate the data and send
the output to a file which can be viewed as an image, or as a collection
of images in an animation. The software has a gradual learning curve,
allowing the novice user to quickly obtain useful results.

As the figure below indicates, the climate scientist becomes more
productive in the CDAT type of environment.

![](media/image2.png){width="6.402777777777778in"
height="4.180555555555555in"}

This user's guide explains all the commands for each of the CDAT
modules. In addition, there are examples that show how to accomplish
specific tasks. For more information on Python, see web site
**http://www.python.org**, where on-line documentation and additional
help on writing Python programs is to be found.

## 

To further accommodate the intercomparison projects and the climate
research community, a distributed computing environment is necessary for
the enhancement of collaboration. This enhancement of collaboration will
focus primarily on the software infrastructure, tool development, and
support needed to make distance computing and distributed applications
possible from the network for participating projects and climate
research institutions. The type of capabilities necessary for this type
of collaboratory (i.e., an integration of research facilities on the
Internet for remote collaboration, experimentation, production, or
measurement) are:

-   Access local or remote database servers, compute servers, and
    visualization servers

-   Select, browse, and choose database, compute, and visualization
    servers

-   Support audio and visual communication

    Through this software infrastructure, climate scientific
    collaboration will transcend geographic and organizational
    boundaries and will improve their research ability to solve and
    understand complex scientific climate problems.

    ![](media/image3.png){width="5.61875in"
    height="5.307638888888889in"}

    The figure above shows the PCMDI distributed computing environment
    software model.

    The figure above shows the PCMDI distributed computing environment
    software model.

#  {#section-9 .unnumbered}

## 

This chapter provides basic setup information, including instructions on
configuring and running CDAT from the Graphical User Interface (GUI) or
the command line interface, as well as an initial orientation to using
the software.

Other chapters of this User\'s Guide contain tutorial Examples on how to
exercise different software capabilities.

Note: In this release version, the VCS module can only be imported from
the CDATGUI executable.

## 

The steps that should be followed before running CDAT are described in
this section. These include putting in place various input files, and
setting fonts for X Graphical Kernal System (XGKS).

Note: VCS setup is only needed if the user is bringing in the VCS
graphics. If the user is not plotting the graphics, the VCS setup is
unnecessary.

## 

If the user wishes to use the VCS module, it is strongly recommended
that two input files be put in place before attempting to run CDAT.
These include a file for specifying initial attributes and a file for
printing hard copy. See also instructions on other input files for
setting XGKS fonts, mapping continents, and running scripts in
subsequent sections.

## 

CDAT reads a script file named **cdat_init.py** that defines the initial
startup of CDAT. Although not required to run CDAT, this
**cdat_init.py** file contains many predefined settings to aid the
beginning user of CDAT. The path to the file must be:

**/\$HOME/PCMDI_GRAPHICS/cdat_init.py**

where **/\$HOME** denotes the user\'s home directory. **PCMDI_GRAPHICS**
is a directory that is used by CDAT and VCS.

Also, set an environment variable called **PYTHONSTARTUP** and set it to
the full path of the **cdat_init.py** file. You must be in csh shell
mode to use the setenv command.

At initialization, the VCS module reads a script file named
**initial.attributes** which defines many predefined settings to aid the
beginning user of VCS. This initial attribut file is not required to run
VCS. The path to the file must be:

**/\$HOME/PCMDI_GRAPHICS/initial.attributes**

where **/\$HOME** denotes the user\'s home directory. (Note, when VCS is
executed for the first time, a **/PCMDI_GRAPHICS** subdirectory will be
created automatically if it has not already been created.)

## 

The contents of the **initial.attributes** file can be customized by the
user. This is most easily accomplished in interactive mode by bringing
the VCS interface to a state of having the desired attributes at
start-up, and then saving this state by accessing the Script I/O Panel
and selecting the blue 'Replace the initial.attributes File' button.
This action will place a new **initial.attributes** file with the
desired settings in the user\'s

**/\$HOME/PCMDI_GRAPHICS**

directory. For recovery purposes, the old initial.attributes file is
copied to file **initial.attributes%** in the same directory.

## 

CDAT graphical displays can be printed only if the user customizes a
**HARD_COPY** file (included with the VCS software) for the home system.
The path to the **HARD_COPY** file must be:

**/\$HOME/PCMDI_GRAPHICS/HARD_COPY**

where **/\$HOME** denotes the user\'s home directory. The **HARD_COPY**
file contains the following necessary information for printing at the
user\'s home site:

-   A list of the available home postscript printing devices.

-   The absolute path on the home system to the gplot executable
    (provided with the VCS software) that converts files in the Computer
    Graphics Metafile (CGM) format to postscript files.

-   Instructions for setting the environment aliases \`landscape\' and
    \`portrait\' that are used to generate postscript files outside
    CDAT.

-   The setting for the environment variable \`PRINTER\'. (When
    \`PRINTER\' is set to \`printer\', CDAT assumes that the printer
    manager \`lpr\' is in use; when \`PRINTER\' is unset, CDAT assumes
    that the printer manager is \`lp\'. Incidences of the message
    \"Error - In sending CGM file to printer\" are an indication of an
    incorrect setting for the \`PRINTER\' environment variable.)

Note: It is recommended that CDAT users read the entire contents of the
**HARD_COPY** file for additional information on printing in CDAT.

## 

XGKS is the XII implementation of the ANSI Graphical Kernel System. It
provides functions for picture generation, picture presentation,
segmentation, transformations and input. XGKS fonts pertain to those
used for graphical displays on the VCS Canvas.

Before running CDAT, it is necessary to set the environment variable
**XGKSFontDir**. That is, enter:

**setenv XGKSFontDir /the_absolute_path/fontdb**

where **/the_absolute_path** denotes the absolute path on the user\'s
home system to the relevant fontdb file.

It is best if this setenv statement is included in the **.login** or
**.cshrc** file located in the user\'s home directory **(/\$HOME**).

Nine XGKS font styles are currently supported:

> SanSerif Roman
>
> Serif Roman
>
> Sanserif Bold Roman
>
> Serif Bold Roman
>
> Sanserif Italic Roman
>
> Serif Italic Roman
>
> Sanserif Script
>
> Serif Script
>
> Gothic

## 

Before running CDAT, it is necessary to set the environment variable
**PYTHONPATH**. That is, enter:

**setenv PYTHONPATH /the_absolute_path/pylibs**

where **/the_absolute_path** denotes the absolute path on the user\'s
home system to the relevant python libraries directory.

It is best if this setenv statement is included in the **.login** or
**.cshrc** file located in the user\'s home directory (**/\$HOME**).

# 

CDAT is presently operable on the computing platforms listed in the
table below:

+-----------------------------------+----------------------------------+
| *Platform*                        | *Operating system*               |
+-----------------------------------+----------------------------------+
| PC                                | Linux 5.4                        |
|                                   |                                  |
| (*Portable Computer*)             |                                  |
+-----------------------------------+----------------------------------+
| SGI                               | IRIX 5.2, 5.3, or 6.2            |
|                                   |                                  |
| (*Silicon Graphics, Inc.*)        |                                  |
+-----------------------------------+----------------------------------+
| Sun                               | Solaris 5.5.1                    |
+-----------------------------------+----------------------------------+

# 

## 

In Python there are no variable or type declarations. Variables are
defined at the time they are used in a Python program. Unlike other
languages, there are no braces or semicolons used in python statements.
In Python programs the \# sign represents a comment.

Looping in Python is defined by block delimites. The block boundaries
are detected by line indentation. Indentation is any combination of
spaces or tabs, (don't mix the two together)

All loop blocks end with a blank line and a return.

## 

access and break class

continue def del elif

else except exec finally

for from global if

in is lambda not

or pass rise return

try while

## 

**Name Description**

del(x) Delete item from memory

import *module* Loads the module and it's functions for use

len(x) The number of items in a collection (sequence, mapping,
user-defined)

print *x* Prints x to output window

type(*objec*t) he type of object (object's associated type object)

Looping in Python is defined by block delimites. The block boundaries
are detected by line indentation. Indentation is any combination of
spaces or tabs, (don't mix the two together)

All loop blocks end with a blank line and a return.

## 

**General Format:**

if \<test\>:

\<statements1\>

elif \<test2\>: \# optional elif's

\<statements2\>

else: \# optional else

\<statements3\>

**Example:**

x = 'mrso'

if x == 'tas':

print 'Surface Air Temperature'

elif x == 'mrso':

print 'Soil Moisture'

else:

print 'Variable not recognized'

## 

Definitions:

> *break* jumps out of the closest enclosing loop
>
> *continue* jumps to the top of the closest enclosing loop
>
> *pass* does nothing; an empty statement placeholder
>
> loop *else* run if loop exits normally; without a 'break'

**General Format:**

while \<test\>:

\<statements1\>

else: \# optional else

\<statements2\>

or

while \<test\>:

\<statements1\>

if \<test\>: break \# exit loop now, skip else

if \<test\>: continue \# go to top of loop now

else:

\<statements2\> \# if we didn't hit a 'break'

**Example:**

a=0;b=100

while a\<b:

s=zeros(10)

print a,

a=a+1

## 

A general sequence iterator

Works on strings, lists, tuples

Replaces most 'counter' style loops

Repeatedly indexes object until IndexError detected

Range generates a list of integers to iterate over

**General Format:**

for \<target\> in \<object\>: \# assign object items to target

\<statements1\>

**Example:**

for x in \["mrso", "tas", "psl"\]:

print x,

or

X = 'Climate Data Analysis Tool'

for x in range (len(X)): print X\[x\]

# 

This section contains a brief explanation of each CDAT command, followed
by an example of its use. In these examples, \"CDAT\>\" is the user
prompt and normal typeface indicates the user input. Boldface type
indicates the output from CDAT. In the command explanations, a CDAT
object is indicated by italics typeface.

## 

The CDUNIF module is designed to provide access to different file
formats. The module contains routines to get information and data from a
file.

To use the cdunif module in CDAT, type: **import cu**

### 

[cu.open('filename')]{.underline} - Creates a file object and opens the
file through cdunif. *f* becomes the cdunif file object. filename is the
name of the file that is to be opened.

Example:

CDAT\> f=cu.open('/pcmdi/mrso/mrso_bmr.dic') #open a file

### 

[f.listall(\['variable'\])]{.underline} - Returns a Python list of the
description of a variable.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> description=f.listall(\'mrso\') #return a list of the description
of mrso

CDAT\> description #show the list that was returned

**\[\'\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable Description
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\', \'Name: mrso\', \'source: BMRC BMRC2.3
R31L19 AMIP 10 Year Simulation ( 1979-1988 )\', \'title: Monthly Mean
Soil Moisture\', \'units: cm\', \'date: 8/04/94\', \'time: 10:30:06\',
\'Data Type: Float\', \'\*\* Dimension 1 \*\*\', \'Name: longitude\',
\'Units: deg\', \'Length: 96\', \'First: 0.0000\', \'Last: 356.2500\',
\'\*\* Dimension 2 \*\*\', \'Name: latitude\', \'Units: deg\', \'Length:
80\', \'First: 88.2884\', \'Last: -88.2884\', \'\*\* Dimension 3 \*\*\',
\'Name: time\', \'Units: Month\', \'Length: 120\', \'First: 1.0000\',
\'Last: 120.0000\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\',
\'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\',
\'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\',
\'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\',
\'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\',
\'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\',
\'\', \'\', \'\', \'\', \'\', \'\'\]**

[f.listattribute(\['variable'\])]{.underline} - Returns a python list of
the attributes associated with a variable contained in the cdunif file
object.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> atts=f.listattribute(\'mrso\') #return a list of the attributes
associated with mrso

CDAT\> atts #show the list that was returned

**\[\'source\', \'title\', \'units\', \'date\', \'time\'\]**

[f.listdimension(\['variable'\])]{.underline} - Returns a python list of
the dimensions associated with a variable contained in the cdunif file
object.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> dims=f.listdimension(\'mrso\') #return a list of the dimensions
in the opened file

CDAT\> dims #show the list that was returned

**\[\'time\', \'latitude\', \'longitude\'\]**

[f.listglobal()]{.underline} - Returns a python list of the global
attributes associated with a cdunif file object.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> globals=f.listglobal() #return a list of the global attributes in
the opened file

CDAT\> globals #show the list that was returned

**\[\'format\', \'datafile\', \'version\'\]**

[f.listvariable()]{.underline} - Returns a python list of the variables
contained in the cdunif file object.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> vars=f.listvariable() #return a list of the variables in the
opened file

CDAT\> vars #show the list that was returned

**\[\'latitude\', \'mrso\'\]**

[f.showall(\['variable'\],\['all'\])]{.underline} - Shows a description
of a variable. The parameter 'all' is optional; if it is passed to the
command, a full listing of the dimension values for each dimension is
provided.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> f.showvariable() #show variables in the opened file

**\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable List
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**The variables in the file /pcmdi/mrso/mrso_bmr.dic are:**

**latitude**

**mrso**

CDAT\> f.showall(\'mrso\') #show a description of mrso

**\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable Description
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**Name: mrso**

**source: BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**

**title: Monthly Mean Soil Moisture**

**units: cm**

**date: 8/04/94**

**time: 10:30:06**

**Data Type: Float**

**\*\* Dimension 1 \*\***

**Name: longitude**

**Units: deg**

> **Length: 96**
>
> **First: 0.0000**
>
> **Last: 356.2500**
>
> **\*\* Dimension 2 \*\***
>
> **Name: latitude**
>
> **Units: deg**
>
> **Length: 80**
>
> **First: 88.2884**
>
> **Last: -88.2884**
>
> **\*\* Dimension 3 \*\***
>
> **Name: time**
>
> **Units: Month**
>
> **Length: 120**
>
> **First: 1.0000**
>
> **Last: 120.0000**
>
> CDAT\> f.showall(\'mrso\',\'all\') #show a full description of mrso
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable Description
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **Name: mrso**
>
> **source: BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**
>
> **title: Monthly Mean Soil Moisture**
>
> **units: cm**
>
> **date: 8/04/94**
>
> **time: 10:30:06**
>
> **Data Type: Float**
>
> **\*\* Dimension 1 \*\***
>
> **Name: longitude**
>
> **Units: deg**
>
> **Length: 96**
>
> **Values:**
>
> **(1): 0.0000 3.7500 7.5000 11.2500 15.0000**
>
> **(6): 18.7500 22.5000 26.2500 30.0000 33.7500**
>
> **(11): 37.5000 41.2500 45.0000 48.7500 52.5000**
>
> **(16): 56.2500 60.0000 63.7500 67.5000 71.2500**
>
> **(21): 75.0000 78.7500 82.5000 86.2500 90.0000**
>
> **(26): 93.7500 97.5000 101.250.0 105.0000 108.7500**
>
> **(31): 112.5000 116.2500 120.0000 123.7500 127.5000**
>
> **(36): 131.2500 135.0000 138.7500 142.5000 146.2500**
>
> **(41): 150.0000 153.7500 157.5000 161.2500 165.0000**
>
> **(46): 168.7500 172.5000 176.2500 180.0000 183.7500**
>
> **(51): 187.5000 191.2500 195.0000 198.7500 202.5000**
>
> **(56): 206.2500 210.0000 213.7500 217.5000 221.2500**
>
> **(61): 225.0000 228.7500 232.5000 236.2500 240.0000**
>
> **(66): 243.7500 247.5000 251.2500 255.0000 258.7500**
>
> **(71): 262.5000 266.2500 270.0000 273.7500 277.5000**
>
> **(76): 281.2500 285.0000 288.7500 292.5000 296.2500**
>
> **(81): 300.0000 303.7500 307.5000 311.2500 315.0000**
>
> **(86): 318.7500 322.5000 326.2500 330.0000 333.7500**
>
> **(91): 337.5000 341.2500 345.0000 348.7500 352.5000**
>
> **(96): 356.2500**
>
> **\*\* Dimension 2 \*\***
>
> **Name: latitude**
>
> **Units: deg**
>
> **Length: 80**
>
> **Values:**
>
> **(1): 88.2884 86.0711 83.8408 81.6074 79.3730**
>
> **(6): 77.1380 74.9027 72.6673 70.4317 68.1960**
>
> **(11): 65.9603 63.7245 61.4886 59.2528 57.0169**
>
> **(16): 54.7810 52.5451 50.3092 48.0733 45.8374**
>
> **(21): 43.6014 41.3655 39.1295 36.8936 34.6576**
>
> **(26): 32.4217 30.1857 27.9497 25.7138 23.4778**
>
> **(31): 21.2418 19.0058 16.7699 14.5339 12.2979**
>
> **(36): 10.0619 7.8259 5.5900 3.3540 1.1180**
>
> **(41): -1.1180 -3.3540 -5.5900 -7.8259 -10.0619**
>
> **(46): -12.2979 -14.5339 -16.7699 -19.0058 -21.2418**
>
> **(51): -23.4778 -25.7138 -27.9497 -30.1857 -32.4217**
>
> **(56): -34.6576 -36.8936 -39.1295 -41.3655 -43.6014**
>
> **(61): -45.8374 -48.0733 -50.3092 -52.5451 -54.7810**
>
> **(66): -57.0169 -59.2528 -61.4886 -63.7245 -65.9603**
>
> **(71): -68.1960 -70.4317 -72.6673 -74.9027 -77.1380**
>
> **(76): -79.3730 -81.6074 -83.8408 -86.0711 -88.2884**
>
> **\*\* Dimension 3 \*\***
>
> **Name: time**
>
> **Units: Month**
>
> **Length: 120**
>
> **Values:**
>
> **(1): 1.0000 2.0000 3.0000 4.0000 5.0000**
>
> **(6): 6.0000 7.0000 8.0000 9.0000 10.0000**
>
> **(11): 11.0000 12.0000 13.0000 14.0000 15.0000**
>
> **(16): 16.0000 17.0000 18.0000 19.0000 20.0000**
>
> **(21): 21.0000 22.0000 23.0000 24.0000 25.0000**
>
> **(26): 26.0000 27.0000 28.0000 29.0000 30.0000**
>
> **(31): 31.0000 32.0000 33.0000 34.0000 35.0000**
>
> **(36): 36.0000 37.0000 38.0000 39.0000 40.0000**
>
> **(41): 41.0000 42.0000 43.0000 44.0000 45.0000**
>
> **(46): 46.0000 47.0000 48.0000 49.0000 50.0000**
>
> **(51): 51.0000 52.0000 53.0000 54.0000 55.0000**
>
> **(56): 56.0000 57.0000 58.0000 59.0000 60.0000**
>
> **(61): 61.0000 62.0000 63.0000 64.0000 65.0000**
>
> **(66): 66.0000 67.0000 68.0000 69.0000 70.0000**
>
> **(71): 71.0000 72.0000 73.0000 74.0000 75.0000**
>
> **(76): 76.0000 77.0000 78.0000 79.0000 80.0000**
>
> **(81): 81.0000 82.0000 83.0000 84.0000 85.0000**
>
> **(86): 86.0000 87.0000 88.0000 89.0000 90.0000**
>
> **(91): 91.0000 92.0000 93.0000 94.0000 95.0000**
>
> **(96): 96.0000 97.0000 98.0000 99.0000 100.0000**
>
> **(101): 101.0000 102.0000 103.0000 104.0000 105.0000**
>
> **(106): 106.0000 107.0000 108.0000 109.0000 110.0000**
>
> **(111): 111.0000 112.0000 113.0000 114.0000 115.0000**
>
> **(116): 116.0000 117.0000 118.0000 119.0000 120.0000**

[f.showattribute(\['variable'\])]{.underline} - Shows the attributes
associated with a variable contained in the cdunif file object.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> f.showattribute(\'mrso\') #show the attributes associated with
> mrso
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Attribute List
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **The attributes in the file /pcmdi/mrso/mrso_bmr.dic for variable
> mrso are:**
>
> **source**
>
> **title**
>
> **units**
>
> **date**
>
> **time**

[f.showdimension(\['variable'\])]{.underline} - Shows the dimensions
associated with a variable contained in the cdunif file object.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> f.showdimension(\'mrso\') #show dimensions in the opened file
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Dimension List
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **The dimensions in the file /pcmdi/mrso/mrso_bmr.dic for variable
> mrso are:**
>
> **time**
>
> **latitude**
>
> **longitude**

[f.showglobal()]{.underline} - Shows the global attributes associated
with a cdunif file object.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> f.showglobal() #show global attributes in opened file
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Global Attribute List
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **The global attributes in the file /pcmdi/mrso/mrso_bmr.dic are:**
>
> **format**
>
> **datafile**
>
> **version**

[f.showvariable()]{.underline} - Shows the variables contained in the
cdunif file object.

Example:

CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> f.showvariable() #show variables in the opened file

**\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable List
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**The variables in the file /pcmdi/mrso/mrso_bmr.dic are:**

**latitude**

**mrso**

### 

[f.defaultvariable('variable')]{.underline} - Sets a default variable
for the cdunif file object. *f* is the file object, and 'variable' is
the variable that is to be used as the default variable for *f*. If the
default variable is set for a file and the user wants to work with that
variable, the variable does not have to be sent to routines requiring a
variable parameter. The following routines work with the default
variable: listall, listattribute, showall, and showattribute.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> f.showvariable() #show variables in the opened file

**\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable List
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**The variables in the file /pcmdi/mrso/mrso_bmr.dic are:**

**latitude**

**mrso**

> CDAT\> f.defaultvariable(\'mrso\') #set the default variable to mrso
> for the opened file
>
> **Default variable for /pcmdi/mrso/mrso_bmr.dic is being set to mrso**

[f.cleardefault()]{.underline} - Clears the default variable for the
selected file object.

> Example:

CDAT\> f.cleardefault() #clear the default variable

[cu.dimensionrange(first_value,last_value)]{.underline} - Creates a
dimension object. 'first_value' is the value that is to be used, and
'last_value' is the last value to be used.

> Example:
>
> CDAT\> lat=cu.dimensionrange(-50,50) #create a dimension object
>
> **First dimension value is being set to -50**
>
> **Last dimension value is being set to 50**

### 

[f.dimensionarray('dimension_name',\['variable'\])]{.underline} -
Returns a Python array object containing the values for the dimension
that was passed into the routine. To return a Python list, add
**.tolist()** to the end of the routine.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> f.showdimension(\'mrso\') #show dimensions in the opened file
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Dimension List
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **The dimensions in the file /pcmdi/mrso/mrso_bmr.dic for variable
> mrso are:**
>
> **time**
>
> **latitude**
>
> **longitude**
>
> CDAT\> lat=f.dimensionarray(\'latitude\') #return the latitude
> dimension in an array
>
> CDAT\> lat #show the array
>
> **(\[88.2883987427, 86.0710983276, 83.8407974243, 81.6073989868,**
>
> **79.3729934692, 77.1379928589, 74.9026947021, 72.6672973633,**
>
> **70.4316940308, 68.1959991455, 65.9602966309, 63.7244987488,**
>
> **61.4885978699, 59.2527999878, 57.0168991089, 54.78099823,**
>
> **52.5450973511, 50.3091964722, 48.073299408, 45.8373985291,**
>
> **43.601398468, 41.3654975891, 39.1294975281, 36.8935966492,**
>
> **34.6575965881, 32.4216995239, 30.1856994629, 27.9496994019,**
>
> **25.7137985229, 23.4777984619, 21.2417984009, 19.0057983398,**
>
> **16.7698993683, 14.5338993073, 12.2978992462, 10.0618991852,**
>
> **7.82589960098, 5.58999967575, 3.35399985313, 1.11799991131,**
>
> **-1.11799991131, -3.35399985313, -5.58999967575, -7.82589960098,**
>
> **-10.0618991852, -12.2978992462, -14.5338993073, -16.7698993683,**
>
> **-19.0057983398, -21.2417984009, -23.4777984619, -25.7137985229,**
>
> **-27.9496994019, -30.1856994629, -32.4216995239, -34.6575965881,**
>
> **-36.8935966492, -39.1294975281, -41.3654975891, -43.601398468,**
>
> **-45.8373985291, -48.073299408, -50.3091964722, -52.5450973511,**
>
> **-54.78099823, -57.0168991089, -59.2527999878, -61.4885978699,**
>
> **-63.7244987488, -65.9602966309, -68.1959991455, -70.4316940308,**
>
> **-72.6672973633, -74.9026947021, -77.1379928589, -79.3729934692,**
>
> **-81.6073989868, -83.8407974243, -86.0710983276, -88.2883987427\],**
>
> **Float)**
>
> CDAT\> lat=f.dimensionarray(\'latitude\').tolist() #return latitude in
> a list
>
> CDAT\> lat #show the list
>
> **\[88.2883987427, 86.0710983276, 83.8407974243, 81.6073989868,**
>
> **79.3729934692, 77.1379928589, 74.9026947021, 72.6672973633,**
>
> **70.4316940308, 68.1959991455, 65.9602966309, 63.7244987488,**
>
> **61.4885978699, 59.2527999878, 57.0168991089, 54.78099823,**
>
> **52.5450973511, 50.3091964722, 48.073299408, 45.8373985291,**
>
> **43.601398468, 41.3654975891, 39.1294975281, 36.8935966492,**
>
> **34.6575965881, 32.4216995239, 30.1856994629, 27.9496994019,**
>
> **25.7137985229, 23.4777984619, 21.2417984009, 19.0057983398,**
>
> **16.7698993683, 14.5338993073, 12.2978992462, 10.0618991852,**
>
> **7.82589960098, 5.58999967575, 3.35399985313, 1.11799991131,**
>
> **-1.11799991131, -3.35399985313, -5.58999967575, -7.82589960098,**
>
> **-10.0618991852, -12.2978992462, -14.5338993073, -16.7698993683,**
>
> **-19.0057983398, -21.2417984009, -23.4777984619, -25.7137985229,**
>
> **-27.9496994019, -30.1856994629, -32.4216995239, -34.6575965881,**
>
> **-36.8935966492, -39.1294975281, -41.3654975891, -43.601398468,**
>
> **-45.8373985291, -48.073299408, -50.3091964722, -52.5450973511,**
>
> **-54.78099823, -57.0168991089, -59.2527999878, -61.4885978699,**
>
> **-63.7244987488, -65.9602966309, -68.1959991455, -70.4316940308,**
>
> **-72.6672973633, -74.9026947021, -77.1379928589, -79.3729934692,**
>
> **-81.6073989868, -83.8407974243, -86.0710983276, -88.2883987427\]**

[f.getattribute('variable','attribute')]{.underline} - Returns an
attribute associated with a variable in a cdunif file object. 'variable'
is the variable name, and 'attribute' is the name of the desired
attribute to be returned.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> f.showvariable() #show the variables in the opened file

**\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable List
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**The variables in the file /pcmdi/mrso/mrso_bmr.dic are:**

**latitude**

**mrso**

> CDAT\> f.showattribute(\'mrso\') #show the attributes associated with
> mrso
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Attribute List
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **The attributes in the file /pcmdi/mrso/mrso_bmr.dic for variable
> mrso are:**
>
> **source**
>
> **title**
>
> **units**
>
> **date**
>
> **time**
>
> CDAT\> f.getattribute(\'mrso\',\'title\') #return the title associated
> with mrso
>
> **\'Monthly Mean Soil Moisture\'**
>
> CDAT\> title=f.getattribute(\'mrso\',\'title\') #return the title
> associated with mrso
>
> CDAT\> title #show what was returned
>
> **\'Monthly Mean Soil Moisture\'**

[f.getdimensionunit('dimname',\['variable'\])]{.underline} - Returns the
dimension units from a file or those associated with a variable
contained in a file.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> f.getdimensionunits('latitude') #get the units for latitude

> **'deg'**

[f.getglobal('attribute')]{.underline} - Returns a global attribute
associated with the cdunif file object. 'attribute' is the name of the
global attribute that is to be returned.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> f.showglobal() #show global attributes in the opened file
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Global Attribute List
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **The global attributes in the file /pcmdi/mrso/mrso_bmr.dic are:**
>
> **format**
>
> **datafile**
>
> **version**
>
> CDAT\> f.getglobal(\'format\') #return the global attribute format
>
> **\'DRS\'**
>
> CDAT\> format=f.getglobal(\'format\') #return the global attribute
> format
>
> CDAT\> format #show what was returned
>
> **\'DRS\'**

[f.getslab('variable',\[dim1\],...\[dimN\])]{.underline} - Returns a
slab, which is a Python array object. All parameters are optional except
the variable. The remaining parameters can be either ints, float, wild
cards, or dimension objects.

NOTE: the dimensions are in C order, (time,lat,lon)

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> f.showvariable() #show the variables in the opened file

**\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Variable List
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**The variables in the file /pcmdi/mrso/mrso_bmr.dic are:**

**latitude**

**mrso**

> CDAT\> s=f.getslab(\'mrso\') #get a slab of data with dimension values
> from the file
>
> CDAT\> s.shape #show the shape of s
>
> **(120, 80, 96)**
>
> CDAT\> s1=f.getslab(\'mrso\',3,3,\':\',\':\') #get a slab of data with
> dim0 values 3-3,
>
> #dim1 & dim2 use the wild card to get the

#dimension values from the file

> CDAT\> s1.shape #show the shape of s1
>
> **(1, 80, 96)**
>
> CDAT\> tme=cu.dimensionrange(5,5) #create a dimension object for time
>
> CDAT\> lat=cu.dimensionrange(-50,50) #create a dimension object for
> latitude
>
> CDAT\> lon=cu.dimensionrange(-180,180) #create a dimension object for
> longitude
>
> CDAT\> s2=f.getslab(\'mrso\',tme,lat,lon) #get a slab of data using
> the dimension objects
>
> CDAT\> s2.shape #show the shape of s2
>
> **(1, 44, 97)**

## 

The CDTIME module is designed to provide access to different CDMS time
functions. To use the cdtime module in CDAT, type: **import cdtime**

[add(value, intervalUnits,
calendar=cdtime.DefaultCalendar)]{.underline} - Adds an interval to a
time value, where

value = number of interval units (floating-point),

intervalUnits = Year(s) \| Season(s) \| Month(s) \| Week(s) \| Day(s) \|
Minute(s) \| Second(s)

calendar = calendar argument

> Example:
>
> CDAT\> from cdtime import \*
>
> CDAT\> c = componenttime(1996, 2, 28) #create a component time
>
> CDAT\> r = relativetime(28, "days since 1996-1-1") #create a relative
> time
>
> CDAT\> print r.add(1, Days) #add 1 day
>
> **29.00 days since 1996-1-1**
>
> CDAT\> print c.add(36, Hour) #add 36 hours
>
> **1996-2-29 12:0:0.0**

[cmp(t2, calendar=cdtime.DefaultCalendar)]{.underline} - Compares time
values, where

t2 = relative or component time, calendar = calendar argument

> Example:
>
> CDAT\> from cdtime import \* \# import cdtime module
>
> CDAT\> c = componenttime(1996, 2, 28) #create a component time
>
> CDAT\> r = relativetime(28, "days since 1996-1-1") #create a relative
> time
>
> CDAT\> print r.cmp(c) #compare r with c
>
> **-1**
>
> CDAT\> print c.cmp(r) #compare c with r
>
> **1**
>
> CDAT\> print r.cmp(r) #compare r with r
>
> **0**

[componenttime(year, month=1, day=1, hour=0, minute=0,
seconds=0)]{.underline} - Returns a component time object, with
year(integer), month(integer, 1..12), day(integer, 1..31),

hour(integer, 1..31),minute(integer, 0..59), second(floating-point, in
the interval \[0.0,60.0\])

> Example:
>
> CDAT\> from cdtime import \*
>
> CDAT\> c = componenttime(1996, 2, 28) #create a component time

[relativetime(value, units)]{.underline} - Returns a relative time
object, with value(floating-point), units(string)

units=second \| minute \| hour \| day \| week \| month \| season \| year

> Example:
>
> CDAT\> from cdtime import \*
>
> CDAT\> r = relativetime(28, "days since 1996-1-1") #create a relative
> time

[sub(value, intervalUnits,
calendar=cdtime.DefaultCalendar)]{.underline} - Subtracts an interval
from a time value, where

value = number of interval units (floating-point),

intervalUnits = Year(s) \| Season(s) \| Month(s) \| Week(s) \| Day(s) \|
Minute(s) \| Second(s)

calendar = calendar argument

> Example:
>
> CDAT\> from cdtime import \*
>
> CDAT\> c = componenttime(1996, 2, 28) #create a component time
>
> CDAT\> r = relativetime(28, "days since 1996-1-1") #create a relative
> time
>
> CDAT\> print r.sub(10, Days) #subtract 10 days
>
> **18.00 days since 1996-1-1**
>
> CDAT\> print c.sub(30, Days) #subratct 30 days
>
> **1996-1-29 0:0:0.0**

[tocomponent(calendar = cdtime.DefaultCalendar)]{.underline} - Converts
to component time, from relative or component time, where calendar =
calendar argument

> Example:
>
> CDAT\> from cdtime import \* #import cdtime module
>
> CDAT\> r = relativetime(28, "days since 1996-1-1") #create a relative
> time
>
> CDAT\> r.tocomponent() #convert to component time
>
> **1996-1-29 0:0:0.0**

[torelative(units, calendar = cdtime.DefaultCalendar)]{.underline} -
Convert to relative time, from relative or component time, where units =
basetime of result, calendar = calendar argument

> Example:
>
> CDAT\> from cdtime import \* #import cdtime module
>
> CDAT\> c = componenttime(1996, 2, 28) #create a component time
>
> CDAT\> c.torelative("days since 1996-1-1") #convert to component time
>
> **58 days since 1996-1-1**

## 

The LATS functions are designed to provide access to the LATS library of
I/O functions for creating lon/lat gridded datasets in the GRIB and/or
the netCDF format. To use the lats module in CDAT, type: **import lats**

[latsfile.close()]{.underline} - Closes a LATS file

> Example:
>
> CDAT\> import lats #import lats module
>
> CDAT\> basetime = cdtime.relativetime(0,'hours since 1978-12-30')
> #create a relative time
>
> #create a LATS file object
>
> CDAT\> latsfile = lats.LatsFile('test.nc', lats.Coards, lats.Standard,
> lats.Hourly, 6, basetime, 'pcmdi', 'test.py',
>
> 'LATS test')
>
> CDAT\> latsfile.close() #close the LATS file

[createvariable('name', stat, grid, \[vertdim=None\], \[missing=None\],
\[delta=None\], \['commenst'\])]{.underline} - Creates a variable
associated with a file, where name = variable name, stat = statistic,
grid = LatsGrid object, verdim = LatsVertDim object, missing = missing
data value, delta = missing value fudge factor

> Example:
>
> CDAT\> import lats #import lats module
>
> CDAT\> basetime = cdtime.relativetime(0,'hours since 1978-12-30')
> #create a relative time
>
> #create a LATS file object
>
> CDAT\> latsfile = lats.LatsFile('test.nc', lats.Coards, lats.Standard,
> lats.Hourly, 6, basetime, 'pcmdi', 'test.py',
>
> 'LATS test')
>
> CDAT\> grid= lats.LatsGrid('T21', lats.Gaussian, londim, latdim)
> #create a LATS grid
>
> #create a LATS vertical dimension
>
> CDAT\> sfc = lats.LatsVerticalDimension('surface', 'sfc',
> Numeric.array(\[0.0\]))
>
> CDAT\> pr = latsfile.createvariable('pr', lats.Instant, grid, sfc,
> 1.0e20) #create a LATS variable

[del]{.underline} - Deletes memory for a grid or a vertical dimension.

> Example:
>
> CDAT\> import lats #import lats module
>
> CDAT\> grid= lats.LatsGrid('T21', lats.Gaussian, londim, latdim)
> #create a LATS grid
>
> CDAT\> del grid #free memory for grid

[len(object)]{.underline} - Returns number of zones in grid if 'object'
is LatsGrid object, or number of levels; if 'object' is LatsVertDim
object.

> Example:
>
> CDAT\> import lats #import lats module
>
> CDAT\> grid= lats.LatsGrid('T21', lats.Gaussian, londim, latdim)
> #create a LATS grid
>
> CDAT\> n = len(grid) #return length of grid

[lats.LatsFile('path', convention, calendar, frequency, delta, basetime,
'center', 'model', 'comments')]{.underline} - Creates a LATS file, where
path = file path, convention = file convnetion, calendar = LATS
calendar, frequency = time frequency, delta = time delta, basetime =
file basetime (relative or component), center = modeling center, model =
name of model which created the data

> Example:
>
> CDAT\> import lats, cdtime #import lats & cdtime module
>
> CDAT\> basetime = cdtime.relativetime(0,'hours since 1978-12-30')
> #create a relative time
>
> #create a LATS file object
>
> CDAT\> latsfile = lats.LatsFile('test.nc', lats.Coards, lats.Standard,
> lats.Hourly, 6, basetime, 'pcmdi', 'test.py',
>
> 'LATS test')

[lats.LatsGrid('name', gridtype, lons, lats)]{.underline} - Creates a
LATS grid, where name = grid name, gridtype = grid type, lons =
longitude array, lats = latitude array

> Example:
>
> CDAT\> import lats #import lats module
>
> CDAT\> grid= lats.LatsGrid('T21', lats.Gaussian, londim, latdim)
> #create a LATS grid

[lats.LatsVerticalDimension('name', verttype, levs)]{.underline} -
Creates a LATS vertical dimension, where

name = dimension name, verttype = dimension type, levs = level values

> Example:
>
> CDAT\> import lats #import lats module
>
> #create a LATS vertical dimension
>
> CDAT\> sfc = lats.LatsVerticalDimension('surface', 'sfc',
> Numeric.array(\[0.0\]))

[readparameter('path')]{.underline} - Reads a parameter file. This
function does not set the parameter file to the default.

> Example:
>
> CDAT\> import lats #import lats module
>
> CDAT\> parmtab = lats.readparameter('test.parms') #read the parameter
> file

[setparameterdefault('path')]{.underline} - Sets the default parameter
table. This function is optional; if it is not called, the default
parameter filepath is taken from environment variable LATS_PARMS.

> Example:

CDAT\> import lats #import lats module

CDAT\> parmtab = lats.setparameterdefault('test.parms') #set the default
parameter table

[write(time, field, \[levelValue=None\])]{.underline} - Writes a 2-D
data field, for a given time and level value.

time = time associated with the field(relative or component), field =
2-D lon-lat field,

levelValue = floating-point level associated with the field

Example:

CDAT\> import lats, cdtime #import lats & cdtime module

CDAT\> time = cdtime.relativetime(36.0,'hours since 1978-12-30') #create
a relative time

#create a LATS file object

CDAT\> var.write(time, data) #write the variable

# 

The NUMERIC module is designed to provide access to different numerical
routines, such as Arithmetic, FFT, Linear Algebra, Random Numbers, etc.
To use the numeric module in CDAT, type: **import Numeric** or **from
Numeric import \***

NOTE: When doing any computations on an array object, the dimensions
will not transfer to the new array object. Therefore the user must
either run the **copydimension** or **copydimensions** command to
transfer the dimensions of the array object.

NOTE: When performing arithmetic operations on array objects with
missing values, the objects' typecodes should be the same. For example,
suppose that 'a' is an array object of typecode Float32 (i.e., 'f') and
'b' is an array object of typecode Float64 (i.e., 'd'), where both have
their missing value attributes set to 1e+20. In practice, however,
missing values in 'a' will be defined as 1.00000002004e+20, while in 'b'
they will be defined as 1e+20.

Then, if the command c=a+b is given, the default typecode for 'c' will
be that with the larger number of significant digits (i.e., b's
typecode: Float64). Thus, missing values in 'c' will be defined as 1e+20
only, so that no missing value in 'a' (i.e., 1.00000002004e+20) will be
recognized as such.

To add array objects with missing values correctly, it is recommended
that one array object be cast to the other.

Examples:

> Cast larger to smaller:
>
> b=b.astype(Float32)).
>
> Cast smaller to Larger:
>
> a=a.astype(Float64)
>
> a=changemissing(a,1e20)

Also, care should be taken when adding an integer and a float to an
array object. In CDAT, integers are considered to be Int64 (i.e., Long),
while floats are considered to be Float64 (i.e., Double).

NOTE: Ufunc methods such as add, subtract, avg, divide, etc. operate
somewhat differently with the missing value attribute. For example,
consider the add.reduce method applied to an array object consisting of
5 one's (i.e., a=array((1,1,1,1,1),Int) with the missing value attribute
set to 2 (i.e., a.missing_value=2). Then add.reduce(a) would return the
value 2 and not 5 as one might expect. This is because, add.reduce is
equivalent to the add function applied repeatedly while checking for the
defined missing value:

> 1st time: param1 = 1 and not equal to missing_value (2)
>
> param2 = 1 and not equal to missing_value (2)
>
> return 1+1=2
>
> 2nd time: param1 = 2 and equal to missing_value (2)
>
> return missing_value=2
>
> 3rd time: param1 = 2 and equal to missing_value (2)
>
> return missing_value=2
>
> 4th time: param1 = 2 and equal to missing_value (2)
>
> return missing_value=2
>
> 5th time: param1 = 2 and equal to missing_value (2)
>
> return missing_value=2
>
> Final result: 2
>
> To avoid this problem, ensure that the defined missing value is
> different than the total sum. For example, it is recommended that the
> function a.missing_value =1e20 and/or a=changemissing(a,1e20) be used.

## 

The Python objects under discussion are called array objects. These
supersede the old array objects defined in the array module.

These array objects are arrays in the computer science sense of
homogeneous blocks of identical items. This is quite different from most
Python container objects, which can include heterogeneous sets. Imposing
this restriction was a necessary step for a fast implementation, and in
practice, it is not cumbersome.

Any given array object has a rank, which is the number of \"dimensions\"
or \"axes\" it has. For example, a point in 3D space \[1, 2, 1\] is an
'array' of rank 1 \-- it has one dimension. That dimension has a length
of 3.

typecode for arrays are:

Char for a character

Int8 for an 8-bit integer

Int16 for a 16-bit integer

Int32 for a 32-bit integer

Float16 for a 16-bit float

Float32 for a 32-bit float

Float64 for a 64-bit float

Complex32 for a 32-bit complex (two 16-bit floats)

Complex64 for a 64-bit complex (two 32-bit floats)

Complex128 for a 128-bit complex (two 64-bit floats)

PyObject for a generic Python object

> \'b\' indicates a byte
>
> \'c\' indicates a character
>
> \'s\' indicates a string
>
> \'i\' indicates an integer
>
> \'l\' indicates a long
>
> \'f\' indicates a float
>
> \'d\' indicates a double

If Int, Float, or Complex (that is, without a bit length qualifier) are
specified, then the largest version of the given type available on the
users hardware will be provided.

### 

The Constructor functions are designed to create array objects. Arrays
can be created from the different routines by specifying the shape and
typecode.

[array(sequence, typecode=None, copy=1)]{.underline} - Creates an array
object from the given sequence.

> Example:
>
> CDAT\> x,y,z=1,2,3 #set x, y, & z
>
> CDAT\> a=array(\[1,2,3\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[1, 2, 3\], Long)**
>
> CDAT\> b=array(\[x,y,z\],Float16) #create an array using x, y, & z
>
> CDAT\> b #show the array
>
> **(\[1.0, 2.0, 3.0\], Float)**

[arrayrange(start=0,stop,step=1,typecode=None)]{.underline} - Creates an
array object with specified start, stop, step, and typecode.

Note: the **arange** function is equivalent to **arrayrange**.

Example:

> CDAT\> a=arrayrange(10) #create an array from 0 up to 10
>
> CDAT\> a #show the array
>
> **(\[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\], Long)**

CDAT\> a=arrayrange(0,20,2,Float16) #create an array from 0 up to 20,
increments of 2

CDAT\> a #show the array

**(\[0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0,14.0, 16.0, 18.0\],
\'Float\')**

[fromstring(string,typecode)]{.underline} - Creates an array object
formed by the binary data given in the string of the specified typecode.

Example:

> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a #show the array
>
> **(\[0, 1, 2, 3, 4, 5, 6, 7, 8\], Long)**
>
> CDAT\> type(a) #show the type of a
>
> **\<type \'array\'\>**
>
> CDAT\> s=a.tostring() #convert array to a string
>
> CDAT\> type(s) #show the type of s
>
> **\<type \'string\'\>**
>
> CDAT\> b=fromstring(s,Int) #convert s to ints
>
> CDAT\> b #show the array
>
> **(\[0, 1, 2, 3, 4, 5, 6, 7, 8\], Long)**
>
> CDAT\> type(b) #show the type of b
>
> **\<type \'array\'\>**

[ones(shape, typecode=Int)]{.underline} - Creates an array object of
specified shape and typecode filled with ones.

Example:

> CDAT\> a=ones(\[2,3\],Float16) #create an array filled with ones
>
> CDAT\> a #show the array
>
> **(\[\[1.0, 1.0, 1.0\],**
>
> **\[1.0, 1.0, 1.0\]\], Float)**

[zeros(shape, typecode=Int)]{.underline} - Creates an array object of
specified shape and typecode filled with zeros.

Example:

> CDAT\> a=zeros(\[3,3\]) #create an array filled zeros
>
> CDAT\> a #show the array
>
> **(\[\[0, 0, 0\],**

**\[0, 0, 0\],**

> **\[0, 0, 0\]\], Long)**

### 

The Convenience functions are designed to create array objects.

[arange(size)]{.underline} - A slightly more subtle utility function is
the **arange** function, which is analogous to the **range()** function
in Python, except that it returns an array as opposed to a list. The
returned array will always be of type **long (Int32)**. For greater
flexibility in defining the array size, values, and typecode use
**arrayrange**.

Example:

CDAT\> a=arange(10) #create an array from 0 up to 10

CDAT\> a #show the array

**(\[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\], Long)**

[asarray(a, typecode=None)]{.underline} - This is not necessarily a
constructor. If its argument is an array of the right type, that
argument is returned. If its argument is anything else, it will be
passed to **array(a, typecode)**. In a function, this is a handy way to
ensure having an array without doing any unnecessary copying.

Example:

CDAT\> a=identity(4) #create an array

CDAT\> a #show the array

**(\[\[1, 0, 0, 0\],**

**\[0, 1, 0, 0\],**

**\[0, 0, 1, 0\],**

**\[0, 0, 0, 1\]\], Long)**

CDAT\> b=asarray(a,Float16) #create a new array from a

CDAT\> b #show the array

**(\[\[1.0, 0.0, 0.0, 0.0\],**

**\[0.0, 1.0, 0.0, 0.0\],**

**\[0.0, 0.0, 1.0, 0.0\],**

**\[0.0, 0.0, 0.0, 1.0\]\], Float)**

[changemissing(a, new_missing_value=1.0e20)]{.underline} - This function
will return an array object with the user specified missing value. Upon
return, the missing_value attribute is set to the new missing value and
the appropriate data values are set to the new missing value. If the
new_missing_value parameter is unset, then 1.0e20 is used.

Example:

cdat\> f=cu.open('clt.nc') #open a file

cdat\> s=f.getslab('clt') #get a slab of data

cdat\> b=changemissing(s, -999.) #change missing value

[copydimension(source, source_dim, destination,
destination_dim)]{.underline} - This function copies the dimension of
the specified target into the dimension of the destination. Lengths of
both dimensions must be the same.

Example:

CDAT\> f=cu.open('/pcmdi/mrso/mrso_bmr.dic\') #open a file

CDAT\> s=f.getslab('mrso') #get a slab of data

> CDAT\> s.shape #show the shape of the array
>
> **(120, 80, 96)**
>
> CDAT\> a=s\[:,:,0,0\] #a is a subset of s (120,46)
>
> CDAT\> copydimension(s,1,a,1) #restore a's dim 1 from s's dim 1

[copydimensions(source, destination, shape)]{.underline} - This function
copies the dimension(s) of the source into the dimension(s) of the
destination. If shape is not defined, then all possible dimensions are
copied. Shae can be a single integer or a tuple of integers.

> Example:
>
> CDAT\> f=cu.open('/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab('mrso') #get a slab of data
>
> CDAT\> s.shape #show the shape of the array
>
> **(120, 80, 96)**
>
> CDAT\> a=s\[:,:,0,0\] #a is a subset of s (120,46)
>
> CDAT\> copydimensions(s,a) #restore a's dimensions from s
>
> CDAT\> copydimensions(s,a,1) #restore only a's dimension 1 from s
>
> CDAT\> copydimensions(s,a,(0,1)) #restore a's dimension 0 & 1 from s

[fromfunction(function, shape)]{.underline} - Creates an array object of
the given shape, where 'function' is called on the indices of the array.

Example:

CDAT\> def myfunc(x,y): #create a function

CDAT\> return (x+2+y)

CDAT\>

CDAT\> m=fromfunction(myfunc,(5,5)) #create an array from the function

**(\[\[2, 3, 4, 5, 6\],**

**\[3, 4, 5, 6, 7\],**

**\[4, 5, 6, 7, 8\],**

**\[5, 6, 7, 8, 9\],**

**\[6, 7, 8, 9, 10\]\], Long)**

[identity(n)]{.underline} - Creates an n-x-n identity matrix.

> Example:
>
> CDAT\> a=identity(4) #create an identity array
>
> CDAT\> a \# show the array
>
> **(\[\[1, 0, 0, 0\],**
>
> **\[0, 1, 0, 0\],**
>
> **\[0, 0, 1, 0\],**
>
> **\[0, 0, 0, 1\]\], Long)**

[indices(shape)]{.underline} - Creates an array object of the indices
for the array of the specified shape.

> Example:
>
> CDAT\> a=indices(\[2,3,4\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[\[\[0, 0, 0, 0\],**
>
> **\[0, 0, 0, 0\],**
>
> **\[0, 0, 0, 0\]\],**
>
> **\[\[1, 1, 1, 1\],**
>
> **\[1, 1, 1, 1\],**
>
> **\[1, 1, 1, 1\]\]\],**
>
> **\[\[\[0, 0, 0, 0\],**
>
> **\[1, 1, 1, 1\],**
>
> **\[2, 2, 2, 2\]\],**
>
> **\[\[0, 0, 0, 0\],**
>
> **\[1, 1, 1, 1\],**
>
> **\[2, 2, 2, 2\]\]\],**
>
> **\[\[\[0, 1, 2, 3\],**
>
> **\[0, 1, 2, 3\],**
>
> **\[0, 1, 2, 3\]\],**
>
> **\[\[0, 1, 2, 3\],**
>
> **\[0, 1, 2, 3\],**
>
> **\[0, 1, 2, 3\]\]\]\], Long)**

[Missing.value]{.underline} - This function allows the user to change
the global missing value by importing 'Missing' and setting the
'Missing.value'. The global missing value means that all newly created
arrays will have the attribute missing_value set to Missing.value. The
default missing value is set to 1e20. Missing.value works for all the
typecodes. Missing.value also works with the following Ufuncs: 'add',
'subtract', 'multipy', 'divide', 'remainder', 'power', 'maximum',
'minimum', and 'avg'.

> Example:

CDAT\> import Missing

CDAT\> Missing.value = -999

### 

The OPERATIONS functions are designed to provide access to different
operations for redefining an array object.

[choose(a, (b0, b1, \..., bn))]{.underline} - *a* is an array object of
integers between 0 and n. The resulting array will have the same shape
as *a*, with element selected from b0, \..., bn, as indicated by the
value of the corresponding element in *a*.

Example:

CDAT\> a=array((1,2,3,4,5,6,7,8,9,10)) #create an array

CDAT\> a #show the array

**(\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\], Long)**

CDAT\> d=0,3,8 #create a tuple

CDAT\> d #show the tuple

**(0, 3, 8)**

CDAT\> c=choose(d,a) #choose the element in a corresponding to the
element in d

CDAT\> c #show the array

**(\[1, 4, 9\], Long)**

[concatenate((a0,a1, \..., an), axis=0)]{.underline} - Creates a new
array object that concatenates the specified array objects along the
specified axis.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.shape #show the shape of the array
>
> **(120, 80, 96)**
>
> CDAT\> s1=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s1.shape #show the shape of the array
>
> **(120, 80, 96)**
>
> CDAT\> c=concatenate((s,s1)) #concatenate s1 to s
>
> CDAT\> c.shape #show the shape of the array
>
> **(240, 80, 96)**

[clip(a, min, max)]{.underline} - Clips the values in *a* to lie between
'max' and 'min'. This function creates an array with the same shape and
typecode as *a*, but where every entry in *a* that is less than 'min' is
replaced by 'min', and every entry greater that 'max' is replaced by
'max'. Entries within the range ('min', 'max') are left unchanged.

> Example:
>
> CDAT\>
> a=((0,1,2,3,4),(5,6,7,8,9),(30,11,12,13,14),(15,16,17,30,19),(20,21,22,23,1))
> #create an array
>
> CDAT\> a #show the array
>
> **((0, 1, 2, 3, 4), (5, 6, 7, 8, 9), (30, 11, 12, 13, 14), (15, 16,
> 17, 30, 19), (20, 21, 22, 23, 1))**
>
> CDAT\> b=clip(a,4,12) #clip values less than 4 and greater than 12
>
> CDAT\> b #show the array
>
> **(\[\[4, 4, 4, 4, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[12, 11, 12, 12, 12\],**
>
> **\[12, 12, 12, 12, 12\],**
>
> **\[12, 12, 12, 12, 4\]\], Long)**

[diagonal(a, axis1=0, axis2=1, offset=0)]{.underline} - Returns the
entries along the given diagonal of *a*. *axis1* and *axis2* are used to
define multi-dimensional array. In a 2D array, *axis1* and *axis2* are
used to define the vector. In a 3D array, *axis1* and *axis2* are used
to define a plane. In a 4D array, *axis1* and *axis2* are used to define
a cube.

Example:

CDAT\> a=reshape(range(25),(5,5))

CDAT\> a\[0,1\]=-99

CDAT\> a\[3,4\]=-99

CDAT\> a\[2,3\]=-99

CDAT\> a\[4,2\]=-99

CDAT\> a.missing_value=-99

CDAT\> a

> **(\[\[0, -99, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[10, 11, 12, -99, 14\],**
>
> **\[15, 16, 17, 18, -99\],**
>
> **\[20, 21, -99, 23, 24\]\], Long)**

CDAT\> diagonal(a)

> **(\[0, 6, 12, 18, 24\], Long)**

CDAT\> diagonal(a,0,1,1)

> **(\[-99, 7, -99 -99\], Long)**

CDAT\> diagonal(a,0,1,3)

> **(\[3, 9\], Long)**

CDAT\> diagonal(a,0,1,-1)

> **(\[5, 11, 17, 23\], Long)**

CDAT\> diagonal(a,0,1,-2)

> **(\[10, 16, -99\], Long)**

[repeat(a, repeats, axis=0)]{.underline} - Each element in *a* is
repeated as often as indicated by the corresponding elements in
'repeats'.

> Example:
>
> CDAT\> d=0,1,2,3 #create a tuple
>
> CDAT\> f=1,2,3,4 #create a tuple
>
> CDAT\> d #show the tuple
>
> **(0, 1, 2, 3)**
>
> CDAT\> f #show the tuple
>
> **(1, 2, 3, 4)**
>
> CDAT\> a=repeat(d,f) #repeat the elements in d, the elements in f
> times
>
> CDAT\> a.shape #show shape of a
>
> **(10,)**
>
> CDAT\> a #show the array
>
> **(\[0, 1, 1, 2, 2, 2, 3, 3, 3, 3\], Long)**

[reshape(a,shape)]{.underline} - Changes the shape of *a* to be given by
the new shape, where 'shape' is a tuple of the dimensions of the array.

> Example:
>
> CDAT\> a=array((1,2,3,4,5,6,7,9,9,10)) #create a 1D array
>
> CDAT\> a #show the array
>
> **(\[1, 2, 3, 4, 5, 6, 7, 9, 9, 10\], Long)**
>
> CDAT\> b=reshape(a,(2,5)) #create a 2D array
>
> CDAT\> b #show the array
>
> **(\[\[1, 2, 3, 4, 5\],**
>
> **\[6, 7, 9, 9, 10\]\], Long)**

[resize(a, shape)]{.underline} - Exactly like **reshape**, except the
new size of the array object can be anything. NOTE: this can produce
strange results unless care is execised.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.shape #show the shape of s
>
> **(120, 80, 96)**
>
> CDAT\> a=resize(s,(80,96)) #resize s to 2D
>
> CDAT\> a.shape #show the shape of a
>
> **(80, 96)**
>
> CDAT\> b=resize(s,(2,6,78)) #resize s to different 3D
>
> CDAT\> b.shape #show the shape of b
>
> **(2, 6, 78)**

[take(a, indices, axis=0)]{.underline} - This function is like a slice
operation. It selects the elements of

the array object specified as first argument, based on the indices
specified as a second

argument.

> Example:
>
> #create an array
>
> CDAT\>
> a=array((\[0,1,2,3,4\],\[5,6,7,8,9\],\[10,11,12,13,14\],\[15,16,17,18,19\],\[20,21,22,23,24\]))
>
> CDAT\> a #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[10, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 18, 19\],**
>
> **\[20, 21, 22, 23, 24\]\], Long)**
>
> CDAT\> c=take(a,(0,)) #take the first row
>
> CDAT\> c #show the array
>
> **(\[\[0, 1, 2, 3, 4\]\], Long)**
>
> CDAT\> d=take(a,(0,3)) #take the first and fourth rows
>
> CDAT\> d #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[15, 16, 17, 18, 19\]\], Long)**

[transpose(a, axis=None)]{.underline} - Swaps the axes of *a* so that
their new order is that of the given axis. If axis is not given, then it
will be set to **range(len(a.shape)).reverse()**.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of date
>
> CDAT\> s.shape #show the shape of s
>
> **(120, 80, 96)**
>
> CDAT\> b=transpose(s,\[2,1,0\]) #transpose dimensions
>
> CDAT\> b.shape #show shape of b
>
> CDAT\> c=transpose(s,\[1,2,0\]) #transpose dimensions
>
> CDAT\> c.shape #show shape of c
>
> **(80, 96, 120)**

### 

### 

[compress(condition, a, axis=0)]{.underline} - Returns those elements of
*a* corresponding to those elements of 'condition' that are nonzero.
'condition' must be the same size as the given axis of *a*.

> Example:
>
> CDAT\> a=0,-2,0,0,0,2,0,4,0,6 #create a tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 0, 0, 2, 0, 4, 0, 6)**
>
> CDAT\> b=compress(a,a) #default removes all zeros
>
> CDAT\> b #show the array
>
> **(\[-2, 2, 4, 6\], Long)**
>
> CDAT\> c=compress(equal(a,0),a) #return zeros
>
> CDAT\> c #show the array
>
> **(\[0, 0, 0, 0, 0, 0\], Long)**
>
> CDAT\> d=compress(less_equal(a,-2),a) #return values \<= -2
>
> CDAT\> d #show the array
>
> **(\[-2\], Long)**

[nonzero(a)]{.underline} - Returns the indices of the elements in *a*
that are nonzero. This only makes sense for 1D arrays.

> Example:
>
> CDAT\> a=0,-2,0,0,0,2,0,4,0,6 #create a tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 0, 0, 2, 0, 4, 0, 6)**
>
> CDAT\> b=nonzero(a) #get the indices of the nonzero values
>
> CDAT\> b #show the array
>
> **(\[1, 5, 7, 9\], Long)**

[ravel(a)]{.underline} - Returns *a* as a 1D array. The result is
equivalent to use of functions **reshape(a,(-1))** and **a.flat**

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.shape #show the shape of the array
>
> **(120, 80, 96)**
>
> CDAT\> a=ravel(s) #create a 1D array
>
> CDAT\> a.shape
>
> **(921600,)**

[trace(a, axis1=0, axis2=1, offset=0)]{.underline} - Returns the sum of
the elements in *a* along the given axes diagonal. *axis1* and *axis2*
are used to define multi-dimensional array. In a 2D array, *axis1* and
*axis2* are used to define the vector. In a 3D array, *axis1* and
*axis2* are used to define a plane. In a 4D array, *axis1* and *axis2*
are used to define a cube.

> Example:

CDAT\> a=reshape(range(25),(5,5))

CDAT\> a\[0,1\]=-99

CDAT\> a\[3,4\]=-99

CDAT\> a\[2,3\]=-99

CDAT\> a\[4,2\]=-99

CDAT\> a.missing_value=-99

CDAT\> a

> **(\[\[0, -99, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[10, 11, 12, -99, 14\],**
>
> **\[15, 16, 17, 18, -99\],**
>
> **\[20, 21, -99, 23, 24\]\], Long)**
>
> CDAT\> trace(a)
>
> **60**
>
> CDAT\> trace(a,0,1,1)
>
> **-99**

[tracemissing(a, axis1=0, axis2=1, offset=0)]{.underline} - Returns the
sum of the elements in *a* along the given axes diagonal. axis1 and
axis2 are used to define multi-dimensional array. In a 2D array, *axis1*
and *axis2* are used to define the vector. In a 3D array, *axis1* and
*axis2* are used to define a plane. In a 4D array, *axis1* and *axis2*
are used to define a cube.

> Example:

CDAT\> a=reshape(range(25),(5,5))

CDAT\> a\[0,1\]=-99

CDAT\> a\[3,4\]=-99

CDAT\> a\[2,3\]=-99

CDAT\> a\[4,2\]=-99

CDAT\> a.missing_value=-99

CDAT\> a

> **(\[\[0, -99, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[10, 11, 12, -99, 14\],**
>
> **\[15, 16, 17, 18, -99\],**
>
> **\[20, 21, -99, 23, 24\]\], Long)**
>
> CDAT\> trace(a,0,1,1)
>
> **-7**

[where(condition, x, y)]{.underline} - Returns an array object shaped
like the specified 'condition' and having elements of 'x' and 'y', where
'condition' is respectively true or false.

> Example:
>
> CDAT\> a=0,-2,0,0,0,2,0,4,0,6 #create a tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 0, 0, 2, 0, 4, 0, 6)**
>
> CDAT\> b=where(a,2,7) #where a has a value set it to 2 else set it to
> 7
>
> CDAT\> b #show the array
>
> **(\[7, 2, 7, 7, 7, 2, 7, 2, 7, 2\], Long)**
>
> CDAT\> c=where(equal(a,0),1,0) #where a equals 0 set it to 1, else set
> it to 0
>
> CDAT\> c #show the array
>
> **(\[1, 0, 1, 1, 1, 0, 1, 0, 1, 0\], Long)**

### 

The SORT/SEARCH functions are designed to provide different methods for
sorting and searching arrays.

[argmax(a, axis=-1), argmin(a, axis=-1)]{.underline} - The **argmax()**
function returns an array with the argu­ments of the maximum values of
its input array *a* along the given axis. The returned array will have
one less dimension than *a*. **argmin()** which, is just like
**argmax()**, except that it returns the indices of the minima along the
given axis.

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> argmax(b) #return the indices of the maximum element in each
> row
>
> **(\[4, 4, 0, 3, 3\], Long)**
>
> CDAT\> argmax(b,0) #return the indices of the maximum element in each
> column
>
> **(\[2, 4, 4, 3, 3\], Long)**
>
> CDAT\> argmin(b) #return the indices of the minimum element in each
> row
>
> **(\[0, 0, 1, 0, 4\], Long)**
>
> CDAT\> argmin(b,0) #return the indices of the minimum element in each
> column
>
> **(\[0, 0, 0, 0, 4\], Long)**

[argsort(a, axis=-1)]{.underline} - Returns the indices of the elements
of *a* needed to produce **sort(a)**.

ie. take(a, argsort(a)) == sort(a).

> Example:
>
> CDAT\> a=0,-2,0,10,6,0,0,2,0,4,0,7 #create a tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 10, 6, 0, 0, 2, 0, 4, 0, 7)**
>
> CDAT\> b=argsort(a) #sort the elements in the tuple
>
> CDAT\> b #show thearray
>
> **(\[1, 5, 8, 10, 6, 2, 0, 7, 9, 4, 11, 3\], Long)**

[searchsorted(a, values)]{.underline} - *a* must be sorted in ascending
order and be 1D. This will return the indices of the positions in *a*
where the corresponding values would fit.

> Example:
>
> CDAT\> a=0,-2,0,10,6,0,0,2,0,4,0,7 #create a tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 10, 6, 0, 0, 2, 0, 4, 0, 7)**
>
> CDAT\> b=sort(a) #sort the tuple
>
> CDAT\> b #show the array
>
> **(\[-2, 0, 0, 0, 0, 0, 0, 2, 4, 6, 7, 10\], Long)**
>
> CDAT\> c=searchsorted(b,(-1,1,8)) #find the indices positions
>
> CDAT\> c #show the array
>
> **(\[1, 7, 11\], Long)**

[sort(a, axis=-1)]{.underline} - Will sort the elements of *a* along the
given axis.

> Example:
>
> CDAT\> a=0,-2,0,10,6,0,0,2,0,4,0,7 #create a tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 10, 6, 0, 0, 2, 0, 4, 0, 7)**
>
> CDAT\> b=sort(a) #sort the elements in the tuple
>
> CDAT\> b #show the array
>
> **(\[-2, 0, 0, 0, 0, 0, 0, 2, 4, 6, 7, 10\], Long)**

### 

The MANIPULATING functions are designed for indexing and slicing array
objects.

[indexing]{.underline} - Returns an array with the specific elements of
the original array

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> b\[1:5\] #get rows 1 through 5
>
> **(\[\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> b\[0\] #get row 0
>
> **(\[0, 1, 2, 3, 4\], Long)**
>
> CDAT\> b\[0,1\] #get row 0 column 1
>
> **1**

[NewAxis]{.underline} - Returns an array with a new axis added added to
the original array.

> Example:
>
> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a #show the array
>
> **(\[0, 1, 2, 3, 4, 5, 6, 7, 8\], Long)**
>
> CDAT\> a.shape #show the shape of a
>
> **(9,)**
>
> CDAT\> b=a\[NewAxis,:\] #create a NewAxis
>
> CDAT\> b.shape #show the shape of b
>
> **(1, 9)**
>
> CDAT\> c=a\[:,NewAxis\] #create a NewAxis
>
> CDAT\> c.shape #show the shape of c
>
> **(9, 1)**
>
> CDAT\> d=a\[\...,NewAxis,NewAxis\] #create two NewAxis
>
> CDAT\> d.shape #show the shape of d
>
> **(9, 1, 1)**
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**

[slicing]{.underline} - Returns an array with the specific elements of
the original array

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> b\[:,1\] #selected column 1
>
> **(\[1, 6, 11, 16, 21\], Long)**
>
> CDAT\> b\[::2\] #select rows by 2
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> b\[\...,2\] #select column 2
>
> **(\[2, 7, 12, 17, 22\], Long)**
>
> CDAT\> b\[0,:\] #select row 1
>
> **(\[0, 1, 2, 3, 4\], Long)**

### 

The METHODS functions are designed to provide access to the methods that
operate on arrays. These methods return information about an array, and
can also manipulate the attributes associated with an array.

[a.astype(typecode)]{.underline} - Calling an array's 'astype()' method
returns a new array with the same shape as *a* but with the specified
typecode, and with all its elements (necessarily) cast to the new type.

Example:

CDAT\>

a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1

> #create a tuple

CDAT\> b=reshape(a,(5,5)) #reshape the tuple

CDAT\> b #show the array

**(\[\[0, 1, 2, 3, 4\],**

**\[5, 6, 7, 8, 9\],**

**\[30, 11, 12, 13, 14\],**

**\[15, 16, 17, 30, 19\],**

**\[20, 21, 22, 23, 1\]\], Long)**

CDAT\> f=b.astype(Float16) #create a new array,

store values as Floats

CDAT\> f #show the new array

**(\[\[0.0, 1.0, 2.0, 3.0, 4.0\],**

**\[5.0, 6.0, 7.0, 8.0, 9.0\],**

**\[30.0, 11.0, 12.0, 13.0, 14.0\],**

**\[15.0, 16.0, 17.0, 30.0, 19.0\],**

**\[20.0, 21.0, 22.0, 23.0, 1.0\]\], Float)**

[a.byteswapped()]{.underline} - The 'byteswap()' method performs a
byte-swapping operation on all the elements in the array. This is useful
in handling an array which was written on a machine with a different
byte order.

Example:

> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> f=b.astype(Float16) #create a new array, store values as Floats
>
> CDAT\> f #show the new array
>
> **(\[\[0.0, 1.0, 2.0, 3.0, 4.0\],**
>
> **\[5.0, 6.0, 7.0, 8.0, 9.0\],**
>
> **\[30.0, 11.0, 12.0, 13.0, 14.0\],**
>
> **\[15.0, 16.0, 17.0, 30.0, 19.0\],**
>
> **\[20.0, 21.0, 22.0, 23.0, 1.0\]\], Float)**
>
> CDAT\> c=f.byteswapped() #swap bytes on f
>
> CDAT\> c #show new array
>
> **(\[\[0.0, 4.60060298822e-41, 8.96831017168e-44, 2.30485571412e-41,
> 4.60074311807e-41\],**
>
> **\[5.74868682005e-41, 6.89663052202e-41, 8.044574224e-41,
> 9.10844001811e-44, 5.83080291006e-42\],**
>
> **\[8.61868620483e-41, 1.73102399298e-41, 2.30499584397e-41,
> 2.87896769496e-41, 3.45293954594e-41\],**
>
> **\[4.02691139693e-41, 4.60088324792e-41, 4.88786917341e-41,
> 8.61868620483e-41, 5.4618410244e-41\],**
>
> **\[5.74882694989e-41, 6.03581287539e-41, 6.32279880088e-41,
> 6.60978472637e-41, 4.60060298822e-41\]\],**
>
> **Float)**

[a.createattribute('new_attribute_name')]{.underline} - Creates a new
array object attribute.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.createattribute(\'new\') #create a new attribute for s
>
> CDAT\> s.showattributes() #show the attributes associated with s
>
> **\*\*\*\*\* S t a r t A t t r i b u t e I n f o \*\*\*\*\***
>
> **Name= mrso**
>
> **File = /pcmdi/mrso/mrso_bmr.dic**
>
> **source = BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**
>
> **title = Monthly Mean Soil Moisture**
>
> **units = cm**
>
> **date = 8/04/94**
>
> **time = 10:30:06**
>
> **grid_type = gaussian**
>
> **new =**
>
> **\*\*\*\*\* E n d A t t r i b u t e I n f o \*\*\*\*\***

[a.deleteattribute('attribute_name')]{.underline} - Removes a given
attribute from the array object's attribute list.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.createattribute(\'new\') #create a new attribute for s
>
> CDAT\> s.deleteattribute(\'new\') #delete the new attribute
>
> CDAT\> s.showattributes() #show the attributes associated with s
>
> **\*\*\*\*\* S t a r t A t t r i b u t e I n f o \*\*\*\*\***
>
> **Name= mrso**
>
> **File = /pcmdi/mrso/mrso_bmr.dic**
>
> **source = BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**
>
> **title = Monthly Mean Soil Moisture**
>
> **units = cm**
>
> **date = 8/04/94**
>
> **time = 10:30:06**
>
> **grid_type = gaussian**
>
> **\*\*\*\*\* E n d A t t r i b u t e I n f o \*\*\*\*\***

[a.getattribute('attribute_name')]{.underline} - Returns the attribute
value. Return value may be 'float', 'int', 'string', 'Python list',
'array object', etc.

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> source=a.getattribute(\'source\') #get the attribute associated
> with source
>
> CDAT\> source #show the source attribute
>
> **\'BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )\'**

[a.getdimattribute(dimension_number,
'dimension_attribute_name')]{.underline} - Given the dimension number
and attribute name, returns the dimension attribute value.

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> weights=s.getdimattribute(1,\'weights\') #get the weight
> attribute associated with dimension 1
>
> CDAT\> weights #show the weights
>
> **(\[0.00114495000319, 0.00266353358951, 0.00418031312469,**
>
> **0.0056909224514, 0.00719290476812, 0.00868394526926,**
>
> **0.0101617660411, 0.0116241141208, 0.0130687615924,**
>
> **0.0144935080405, 0.0158961835837, 0.0172746520563,**
>
> **0.0186268142083, 0.0199506108781, 0.0212440261158,**
>
> **0.0225050902463, 0.0237318828659, 0.0249225357641,**
>
> **0.0260752357676, 0.0271882275005, 0.0282598160573,**
>
> **0.0292883695833, 0.0302723217596, 0.0312101741881,**
>
> **0.0321004986735, 0.0329419393976, 0.0337332149846,**
>
> **0.0344731204518, 0.0351605290447, 0.0357943939534,**
>
> **0.0363737499058, 0.0368977146383, 0.0373654902387,**
>
> **0.037776364362, 0.0381297113145, 0.038424993007,**
>
> **0.0386617597741, 0.0388396510591, 0.0389583959628,**
>
> **0.0390178136563, 0.0390178136563, 0.0389583959628,**
>
> **0.0388396510591, 0.0386617597741, 0.038424993007,**
>
> **0.0381297113145, 0.037776364362, 0.0373654902387,**
>
> **0.0368977146383, 0.0363737499058, 0.0357943939534,**
>
> **0.0351605290447, 0.0344731204518, 0.0337332149846,**
>
> **0.0329419393976, 0.0321004986735, 0.0312101741881,**
>
> **0.0302723217596, 0.0292883695833, 0.0282598160573,**
>
> **0.0271882275005, 0.0260752357676, 0.0249225357641,**
>
> **0.0237318828659, 0.0225050902463, 0.0212440261158,**
>
> **0.0199506108781, 0.0186268142083, 0.0172746520563,**
>
> **0.0158961835837, 0.0144935080405, 0.0130687615924,**
>
> **0.0116241141208, 0.0101617660411, 0.00868394526926,**
>
> **0.00719290476812, 0.0056909224514, 0.00418031312469,**
>
> **0.00266353358951, 0.00114495000319\], Double)**

[a.iscontiguous()]{.underline} - Calling an array's 'iscontiguous()'
method returns 'true' if the memory used by array *a* is contiguous.

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> b.iscontiguous() #check if memory used by b is contiguous
>
> 1

[a.itemsize()]{.underline} - The 'itemsize()' method applied to an array
returns the number of bytes used

by any one of its elements.

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> f=b.astype(Float16) #create a new array, store values as Floats
>
> CDAT\> f #show the new array
>
> **(\[\[0.0, 1.0, 2.0, 3.0, 4.0\],**
>
> **\[5.0, 6.0, 7.0, 8.0, 9.0\],**
>
> **\[30.0, 11.0, 12.0, 13.0, 14.0\],**
>
> **\[15.0, 16.0, 17.0, 30.0, 19.0\],**
>
> **\[20.0, 21.0, 22.0, 23.0, 1.0\]\], Float)**
>
> CDAT\> f.itemsize() #number of bytes used by an element of f
>
> **4**

[a.listattributes()]{.underline} - Returns a Python list of all the
array object's names.

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> atts=s.listattributes() #return a list of the attributes
> associated with s
>
> CDAT\> atts #show the list
>
> **\[\'Name\', \'File\', \'source\', \'title\', \'units\', \'date\',
> \'time\', \'grid_type\'\]**

[a.listdimattributes(dimension_number)]{.underline} - Returns a Python
list of the given dimension's attributes.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.listdimattributes(1) #list attributes associated with
> dimension 1

**\[\'name\', \'units\', \'length\', \'dimtype\', \'values\',
\'bounds\', \'weights\', \'rank\', \'cycle\', \'start\', \'end\'\]**

[a.listdimnames()]{.underline} - Returns a Python list of the ordered
dimension names.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.listdimnames() #list dimension names associated with s
>
> **\[\'time\', \'latitude\', \'longitude\'\]**

[a.missing_value]{.underline} - The user can view and change the array's
missing_value. Although missing_value is an attribute, it is viewed a
little differently than the other attributes. If the slab does not have
a missing_value attribute, CDAT will create the missing_value attribute
and assign it a value. The missing value is always a float, if the user
wishes to change the value it will need to be cast.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data

CDAT\> s.missing_value #show s's missing_value

**1e20**

CDAT\> s.missing_value = -99 #change s's missing_value

CDAT\> s.missing_value #show s's missing_value

**-99**

[a.resetgridtype('grid_type', dimension_index)]{.underline} - Allows the
user to change the grid type after it has been retrieved via 'getslab'.
It is only intended to work with global data, and if the latitude
dimension index is not specified, it will default to -2 dimension of the
data set. The user can choose from one of the following grid types:
'linear', 'lmd', 'gis', or 'gaussian'.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.resetgridtype('linear') #change the grid type

[a.setattribute('attribute_name', value)]{.underline} - Sets (or resets)
an attribute value to any of the Python types (i.e., float, Python list,
array object, etc.).

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.createattribute(\'new\') #create a new attribute for s
>
> CDAT\> s.setattribute(\'new\',\'new attribute value\') #set the new
> attribute value
>
> CDAT\> s.showattributes() #show the attributes associated with s
>
> **\*\*\*\*\* S t a r t A t t r i b u t e I n f o \*\*\*\*\***
>
> **Name= mrso**
>
> **File = /pcmdi/mrso/mrso_bmr.dic**
>
> **source = BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**
>
> **title = Monthly Mean Soil Moisture**
>
> **units = cm**
>
> **date = 8/04/94**
>
> **time = 10:30:06**
>
> **grid_type = gaussian**
>
> **new = new attribute value**
>
> **\*\*\*\*\* E n d A t t r i b u t e I n f o \*\*\*\*\***

[a.setdimattribute(dimension_number, 'dimension_attribute_name',
value)]{.underline} - Given the dimension number and attribute name,
sets the dimension attribute value.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.setdimattribute(1,\'name\',\'my_latitude\') #set name
> attribute for dimension 1
>
> CDAT\> name=s.getdimattribute(1,\'name\') #get the attribute for name
>
> CDAT\> name #show the name attribute
>
> **\'my_latitude\'**

[a.showattributes()]{.underline} - Displays all the array object's
attributes names (if any) and their values.

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.showattributes() #show attributes associated with s
>
> **\*\*\*\*\* S t a r t A t t r i b u t e I n f o \*\*\*\*\***
>
> **Name= mrso**
>
> **File = /pcmdi/mrso/mrso_bmr.dic**
>
> **source = BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**
>
> **title = Monthly Mean Soil Moisture**
>
> **units = cm**
>
> **date = 8/04/94**
>
> **time = 10:30:06**
>
> **grid_type = gaussian**
>
> **\*\*\*\*\* E n d A t t r i b u t e I n f o \*\*\*\*\***

[a.showdim(dimension_number)]{.underline} - Displays the given
dimension's attributes and values.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> s.showdim(1) #show dimension associated with s
>
> **\*\*\*\* S t a r t D i m e n s i o n I n f o \*\*\*\*\***
>
> **name: latitude**
>
> **units: deg**
>
> **length: 80**
>
> **dimtype: Double**
>
> **start: 88.2884**
>
> **end: -88.2884**
>
> **rank: 1**
>
> **cycle: 0**
>
> **values:**
>
> **\[88.2884, 86.0711, 83.8408, 81.6074, 79.373, 77.138, 74.9027,
> 72.6673, 70.4317, 68.196, 65.9603, 63.7245, 61.4886, 59.2528, 57.0169,
> 54.781, 52.5451, 50.3092, 48.0733, 45.8374, 43.6014, 41.3655, 39.1295,
> 36.8936, 34.6576, 32.4217, 30.1857, 27.9497, 25.7138, 23.4778,
> 21.2418, 19.0058, 16.7699, 14.5339, 12.2979, 10.0619, 7.8259, 5.59,
> 3.354, 1.118, -1.118, -3.354, -5.59, -7.8259, -10.0619, -12.2979,
> -14.5339, -16.7699, -19.0058, -21.2418, -23.4778, -25.7138, -27.9497,
> -30.1857, -32.4217, -34.6576,**
>
> **-36.8936, -39.1295, -41.3655, -43.6014, -45.8374, -48.0733,
> -50.3092, -52.5451, -54.781, -57.0169,**
>
> **-59.2528, -61.4886, -63.7245, -65.9603, -68.196, -70.4317, -72.6673,
> -74.9027, -77.138, -79.373,**
>
> **-81.6074, -83.8408, -86.0711, -88.2884, \]**
>
> **bounds:**
>
> **\[90, 87.258, 84.9979, 82.7528, 80.512, 78.2731, 76.035, 73.7975,
> 71.5604, 69.3235, 67.0867, 64.8501, 62.6136, 60.3771, 58.1407,
> 55.9044, 53.668, 51.4317, 49.1955, 46.9592, 44.723, 42.4868, 40.2506,
> 38.0144, 35.7782, 33.5421, 31.3059, 29.0697, 26.8336, 24.5974,
> 22.3613, 20.1252, 17.889, 15.6529, 13.4168, 11.1806, 8.9445, 6.70837,
> 4.47225, 2.23612, 1.03766e-13, -2.23612, -4.47225, -6.70837,**
>
> **-8.9445, -11.1806, -13.4168, -15.6529, -17.889, -20.1252, -22.3613,
> -24.5974, -26.8336, -29.0697,**
>
> **-31.3059, -33.5421, -35.7782, -38.0144, -40.2506, -42.4868, -44.723,
> -46.9592, -49.1955, -51.4317,**
>
> **-53.668, -55.9044, -58.1407, -60.3771, -62.6136, -64.8501, -67.0867,
> -69.3235, -71.5604, -73.7975,**
>
> **-76.035, -78.2731, -80.512, -82.7528, -84.9979, -87.258, -90, \]**
>
> **weights:**
>
> **\[0.00114495, 0.00266353, 0.00418031, 0.00569092, 0.0071929,
> 0.00868395, 0.0101618, 0.0116241, 0.0130688, 0.0144935, 0.0158962,
> 0.0172747, 0.0186268, 0.0199506, 0.021244, 0.0225051, 0.0237319,
> 0.0249225, 0.0260752, 0.0271882, 0.0282598, 0.0292884, 0.0302723,
> 0.0312102, 0.0321005, 0.0329419, 0.0337332, 0.0344731, 0.0351605,
> 0.0357944, 0.0363737, 0.0368977, 0.0373655, 0.0377764, 0.0381297,
> 0.038425, 0.0386618, 0.0388397, 0.0389584, 0.0390178, 0.0390178,
> 0.0389584, 0.0388397, 0.0386618, 0.038425, 0.0381297, 0.0377764,
> 0.0373655, 0.0368977, 0.0363737, 0.0357944, 0.0351605, 0.0344731,
> 0.0337332, 0.0329419, 0.0321005, 0.0312102, 0.0302723, 0.0292884,
> 0.0282598, 0.0271882, 0.0260752, 0.0249225, 0.0237319, 0.0225051,
> 0.021244, 0.0199506, 0.0186268, 0.0172747, 0.0158962, 0.0144935,
> 0.0130688, 0.0116241, 0.0101618, 0.00868395, 0.0071929, 0.00569092,
> 0.00418031, 0.00266353, 0.00114495, \]**
>
> **\*\*\*\*\* E n d D i m e n s i o n I n f o \*\*\*\*\***

[a.tolist()]{.underline} - Calling an array's 'tolist()' method returns
a hierarchical python list

version of the same array object.

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> list=b.tolist() #convert b to a list
>
> CDAT\> list #show the list
>
> **\[\[0, 1, 2, 3, 4\], \[5, 6, 7, 8, 9\], \[30, 11, 12, 13, 14\],
> \[15, 16, 17, 30, 19\], \[20, 21, 22, 23, 1\]\]**
>
> CDAT\> type(list) #show the type of list
>
> **\<type \'list\'\>**

[a.tostring()]{.underline} - The 'tostring()' method returns a string
representation of the data portion

of the array object it is applied to.

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> string=b.tostring() #convert b to a string
>
> CDAT\> type(b) #show the type of b
>
> **\<type \'array\'\>**
>
> CDAT\> type(string) #show the type of string
>
> **\<type \'string\'\>**

[a.typecode()]{.underline} - The 'typecode()' method returns the
typecode of the array to which it is applied.

Example:

> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2, 3, 4\],**
>
> **\[5, 6, 7, 8, 9\],**
>
> **\[30, 11, 12, 13, 14\],**
>
> **\[15, 16, 17, 30, 19\],**
>
> **\[20, 21, 22, 23, 1\]\], Long)**
>
> CDAT\> b.typecode() #show the typecode for b
>
> \'l\'

### 

The Attribute functions are designed to provide access to attributes of
an array object.

[a.flat]{.underline} - Returns the flattened, or ravel()'ed version of
an array, without having to do a function call.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> fl=s.flat #break down the 3D array to 1D
>
> CDAT\> fl.shape #show the shape of fl
>
> **(921600,)**

[a.imaginary]{.underline} - Returns the imaginary part of a complex
array, and raises an exception for a real array.

> Example:

#create an array

> CDAT\>
> a=array(\[(0.54030231+0.84147098j),(-0.41614684+0.90929743j),(-0.9899925
> +0.14112001j),
>
> (-0.65364362-0.7568025j)\])
>
> CDAT\> a #show the array
>
> **(\[(0.54030231+0.84147098j), (-0.41614684+0.90929743j),**
>
> **(-0.9899925+0.14112001j), (-0.65364362-0.7568025j)\], \'D\')**
>
> CDAT\> c=a.imaginary #get the imaginary part of a
>
> CDAT\> c #show the array
>
> **(\[0.84147098, 0.90929743, 0.14112001, -0.7568025\], Double)**

[a.real]{.underline} - Returns the real part of an array. For
non-complex arrays, this is identical to the array itself.

Example:

#create an array

> CDAT\>
> a=array(\[(0.54030231+0.84147098j),(-0.41614684+0.90929743j),(-0.9899925
> +0.14112001j),
>
> (-0.65364362-0.7568025j)\])
>
> CDAT\> a #show the array
>
> **(\[(0.54030231+0.84147098j), (-0.41614684+0.90929743j),**
>
> **(-0.9899925+0.14112001j), (-0.65364362-0.7568025j)\], \'D\')**
>
> CDAT\> b=a.real #get the real part of a
>
> CDAT\> b #show the new array
>
> **(\[0.54030231, -0.41614684, -0.9899925, -0.65364362\], Double)**

[a.shape]{.underline} - Returns a tuple of the lengths of *a* along each
of its dimensions. Similar to **shape(a)**.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get slab of data
>
> CDAT\> s.shape #show the shape of s
>
> **(120, 80, 96)**

### 

The Arithmetic functions are designed to provide access to Universal
Functions.

The LOGICAL functions are designed to provide access to the different
logical operators.

**Unary Ufuncs (takes only one argument)**

[arccos(a)]{.underline} - Returns the arc cosine of *a*.

> Example:
>
> CDAT\> arccos(.5) #return the arc cosine
>
> **1.0471975512**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> arccos(a) #return the arc cosine
>
> **(\[\[1.47062890563, 1.369438406, 1.26610367278\],**
>
> **\[1.0471975512, 0.927295218002, 0.795398830184\]\], Double)**

[arcsin(a)]{.underline} - Returns the arc sine of *a*.

> Example:
>
> CDAT\> arcsin(1) #return the arc sine
>
> **1.57079632679**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> arcsin(a) #return the arc sine
>
> **(\[\[0.100167421162, 0.20135792079, 0.304692654015\],**
>
> **\[0.523598775598, 0.643501108793, 0.775397496611\]\], Double)**

[arctan(a)]{.underline} - Returns the arc tangent of *a*.

> Example:
>
> CDAT\> arctan(1) #return the arc tangent
>
> **0.785398163397**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> arctan(a) #return the arc tangent
>
> **(\[\[0.0996686524912, 0.19739555985, 0.291456794478\],**
>
> **\[0.463647609001, 0.540419500271, 0.610725964389\]\], Double)**

[arctan2(a,b)]{.underline} - Returns the arc tangent of the line to
*a*,*b*.

> Example:
>
> CDAT\> arctan2(3,2) #retrun the arctan2
>
> **0.982793723247**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> b=array(((.5,.9,.1),(.3,.8,.2)) #create an array
>
> CDAT\> b #show the array
>
> **(\[\[0.5, 0.9, 0.1\],**
>
> **\[0.3, 0.8, 0.2\]\], Double)**
>
> CDAT\> arctan2(a,b) #return the arctan2
>
> **(\[\[0.0996686524912, 0.19739555985, 0.291456794478\],**
>
> **\[0.463647609001, 0.540419500271, 0.610725964389\]\], Double)**

[cos(a)]{.underline} - Returns the cosine of *a*.

> Example:
>
> CDAT\> cos(1) #return the cosine
>
> **0.540302305868**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> cos(a) #return the cosine
>
> **(\[\[0.995004165278, 0.980066577841, 0.955336489126\],**
>
> **\[0.87758256189, 0.82533561491, 0.764842187284\]\], Double)**

[cosh(a)]{.underline} - Returns the hyperbolic cosine of *a*.

> Example:
>
> CDAT\> cosh(1) #return the hyperbolic cosine
>
> **1.54308063482**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> cosh(a) #return the hyperbolic cosine
>
> **(\[\[1.00500416806, 1.02006675562, 1.04533851413\],**
>
> **\[1.12762596521, 1.18546521824, 1.25516900563\]\], Double)**

[exp(a)]{.underline} - Returns the exponential notation of *a*.

> Example:
>
> CDAT\> exp(1) #return the exponential notation
>
> **2.71828182846**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> exp(a) #return the exponential notation
>
> **(\[\[1.10517091808, 1.22140275816, 1.34985880758\],**
>
> **\[1.6487212707, 1.82211880039, 2.01375270747\]\], Double)**

[log(a)]{.underline} - Returns the natural logarithm of *a*.

> Example:
>
> CDAT\> log(5) #return the logarithm
>
> **1.60943791243**
>
> CDAT\> a=array(((1,2,3),(4,5,6))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2, 3\],**
>
> **\[4, 5, 6\]\], Long)**
>
> CDAT\> log(a) #return the logarithm
>
> **(\[\[0.0, 0.69314718056, 1.09861228867\],**
>
> **\[1.38629436112, 1.60943791243, 1.79175946923\]\], Double)**

[log10(a)]{.underline} - Returns the logarithm base 10 of *a*.

> Example:
>
> CDAT\> log10(5) #return the logarithm base 10
>
> **0.698970004336**
>
> CDAT\> a=array(((1,2,3),(4,5,6))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2, 3\],**
>
> **\[4, 5, 6\]\], Long)**
>
> CDAT\> log10(a) #return the logarithm base 10
>
> **(\[\[0.0, 0.301029995664, 0.47712125472\],**
>
> **\[0.602059991328, 0.698970004336, 0.778151250384\]\], Double)**

[sin(a)]{.underline} - Returns the sine of *a*.

> Example:
>
> CDAT\> sin(1) #return the sine
>
> **0.841470984808**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> sin(a) #return the sine
>
> **(\[\[0.0998334166468, 0.198669330795, 0.295520206661\],**
>
> **\[0.479425538604, 0.564642473395, 0.644217687238\]\], Double)**

[sinh(a)]{.underline} - Returns the hyperbolic sine of *a*.

> Example:
>
> CDAT\> sinh(1) #return the hyperbolic sine
>
> **1.17520119364**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> sinh(a) #return the hyperbolic sine
>
> **(\[\[0.10016675002, 0.201336002541, 0.304520293447\],**
>
> **\[0.521095305494, 0.636653582148, 0.75858370184\]\], Double)**

[sqrt(a)]{.underline} - Returns the square root of *a*.

> Example:
>
> CDAT\> sqrt(3) #return the square root
>
> **1.73205080757**
>
> CDAT\> a=array(((1,2,3),(4,5,6))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2, 3\],**
>
> **\[4, 5, 6\]\], Long)**
>
> CDAT\> sqrt(a) #show the array
>
> **(\[\[1.0, 1.41421356237, 1.73205080757\],**
>
> **\[2.0, 2.2360679775, 2.44948974278\]\], Double)**

[tan(a)]{.underline} - Returns the tangent of *a*.

> Example:
>
> CDAT\> tan(1) #return the tangent
>
> **1.55740772465**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> tan(a) #return the tangent
>
> **(\[\[0.100334672085, 0.202710035509, 0.30933624961\],**
>
> **\[0.546302489844, 0.684136808342, 0.842288380463\]\], Double)**

[tanh(a)]{.underline} - Returns the hyperbolic tangent of *a*.

> Example:
>
> CDAT\> tanh(1) #return the hyperbolic tangent
>
> **0.761594155956**
>
> CDAT\> a=array(((.1,.2,.3),(.5,.6,.7))) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[0.1, 0.2, 0.3\],**
>
> **\[0.5, 0.6, 0.7\]\], Double)**
>
> CDAT\> tanh(a) #return the hyperbolic tangent
>
> **(\[\[0.099667994625, 0.197375320225, 0.291312612452\],**
>
> **\[0.46211715726, 0.537049566998, 0.604367777117\]\], Double)**

[addmissing(a)]{.underline} - Returns the sum without adding the missing
value.

> Example:
>
> CDAT\> a=array((1,2,3),(5,7,2)) #create an array
>
> CDAT\> a.missing_value=5 #set the missing value
>
> CDAT\> addmissing.reduce(a) #sum the array
>
> **(\[1, 9, 5\], Long)**

[avg(a,axis=0)]{.underline} - Averaging function that omits missing data
(i.e., 1e20). The function adds up each node value along a given axis
and divides that number by the total number found.

> Example:
>
> CDAT\> a=array((1,2,3),(5,7,2)) #create an array
>
> CDAT\> b=avg.reduce(a) #average the array
>
> CDAT\> b #show the array
>
> **(\[3, 4, 2\], Long)**

**Binary Ufuncs (takes two arguments)**

[add(x,y)]{.underline} - Returns the sum of two arguments

> Example:
>
> CDAT\> add(5,7) #add the numbers
>
> **12**
>
> CDAT\> a=array((1,2,3),(4,2,5)) #create an array
>
> CDAT\> b=array((7,3,1),(9,0,4)) #create an array
>
> CDAT\> add(a,b) #add the two arrays
>
> **(\[\[8, 5, 4\],**
>
> **\[13, 2, 9\]\], Long)**

[Comparison Ufuncs (takes two arguments)]{.underline} - Return arrays
with the same shape as the array specified as the first argument and
with values that correspond to the result of the pairwise comparison of
its elements with the second argument.

NOTE: an array of 0s and 1s is returned, where 1 represents true and 0
false

less

greater

greater_equal

less_equal

equal

not_equal

> Example:
>
> CDAT\> f=1,2,3,4 #create a tuple
>
> CDAT\> d=7,8,9,10 #create a tuple
>
> CDAT\> a=repeat(d,f) #repeat the elements of d f times
>
> CDAT\> a
>
> **(\[7, 8, 8, 9, 9, 9, 10, 10, 10, 10\], Long)**

CDAT\> b=greater(a,9) #if true 1,if false 0

CDAT\> b #show the array

> **(\[0, 0, 0, 0, 0, 0, 1, 1, 1, 1\], Long)**
>
> CDAT\> c=less(a,10) #if true 1, if false 0
>
> CDAT\> c #show the array
>
> **(\[1, 1, 1, 1, 1, 1, 0, 0, 0, 0\], Long)**
>
> CDAT\> f=equal(a,8) #if true 1, if false 0
>
> CDAT\> f #show the array
>
> **(\[0, 1, 1, 0, 0, 0, 0, 0, 0, 0\], Long)**

[conjugate]{.underline} - Returns an array with elements that are the
conjugate of a complex number.

> Example:
>
> CDAT\> conjugate(complex(2,3)) #return the conjugate of the complex
> number
>
> **(2-3j)**

[divide(a,b)]{.underline} - Returns *a* divided by *b*

> Example:
>
> CDAT\> divide(7,5) #divide 7 by 5
>
> **1**
>
> CDAT\> a=array(((1,2,3),(4,2,5))) #create an array
>
> CDAT\> b=array(((7,3,1),(9,0,4))) #create an array
>
> CDAT\> divide(b,a) #divide b by a
>
> **(\[\[7, 1, 0\],**
>
> **\[2, 0, 0\]\], Long)**

[Logical]{.underline} - Returns an array with elements that are the
results of the following logical operations.

> logical_and
>
> logical_or
>
> logical_xor
>
> logical_not
>
> boolean_and
>
> boolean_or
>
> boolean_xor
>
> boolean_not

[maximum(a,b)]{.underline} - Returns an array with elements that are the
pairwise maximum of each element of *a* versus *b*.

> Example:
>
> CDAT\> a=(((1,2,3),(5,7,2))) #create an array
>
> CDAT\> b=(((5,3,7),(9,1,0))) #create an array
>
> CDAT\> maximum(a,b) #get the maximum of the arrays
>
> **(\[\[5, 3, 7\],**
>
> **\[9, 7, 2\]\], Long)**
>
> CDAT\> maximum.reduce(a) #reduce the array to the maximum value
>
> **(\[5, 7, 3\], Long)**

[minimum(a,b)]{.underline} - Returns an array with elements that are the
pairwise minimum of each element of *a* versus *b*.

> Example:
>
> CDAT\> a=(((1,2,3),(5,7,2))) #create an array
>
> CDAT\> b=(((5,3,7),(9,1,0))) #create an array
>
> CDAT\> minimum(a,b) #get the maximum of the arrays
>
> **(\[\[1, 2, 3\],**
>
> **\[5, 1, 0\]\], Long)**
>
> CDAT\> minimum.reduce(a) #reduce the array to the minimum value
>
> **(\[1, 2, 2\], Long)**

[multiply(a,b)]{.underline} - Returns the product of *a* and *b*.

> Example:
>
> CDAT\> multiply(5,7) #multiply the numbers
>
> **35**
>
> CDAT\> a=array(((1,2,3),(4,2,5))) #create an array
>
> CDAT\> b=array(((7,3,1),(9,0,4))) #create an array
>
> CDAT\> multiply(a,b) #multiply the arrays
>
> **(\[\[7, 6, 3\],**
>
> **\[36, 0, 20\]\], Long)**

[power(a,b)]{.underline} - Returns *a* raised to the power *b*.

> Example:
>
> CDAT\> power(3,4) #return 3 to the 4^th^ power
>
> **81**
>
> CDAT\> a=array(((1,2,3),(4,2,5))) #create an array
>
> CDAT\> b=array(((7,3,1),(9,0,4))) #create an array
>
> CDAT\> power(a,b) #return a to the b power
>
> **(\[\[1, 8, 3\],**
>
> **\[262144, 1, 625\]\], Long)**

[remainder(a,b)]{.underline} - Returns the modulus from division of *a*
by *b*.

> Example:
>
> CDAT\> remainder(7,5) #remainder division 7 by 5
>
> **2**
>
> CDAT\> a=array(((1,2,3),(4,2,5))) #create an array
>
> CDAT\> b=array(((7,3,1),(9,0,4))) #create an array
>
> CDAT\> remainder(b,a) #remainder division b by a
>
> **(\[\[0, 1, 1\],**
>
> **\[1, 0, 4\]\], Long)**

[subtract(a,b)]{.underline} - Returns *b* subtracted from *a*.

> Example:
>
> CDAT\> subtract(5,7) #subtract 7 from 5
>
> **-2**
>
> CDAT\> a=array(((1,2,3),(4,2,5))) #create an array
>
> CDAT\> b=array(((7,3,1),(9,0,4))) #create an array
>
> CDAT\> subtract(a,b) #subtract b from a
>
> **(\[\[-6, -1, 2\],**
>
> **\[-5, 2, 1\]\], Long)**

### 

The UFUNC functions are designed to provide access to the different
universal functions. The Ufunc functions are: **add**, **avg**,
**divide**, **multiply**, **power**, **remainder**, **subtract**.

[ufunc.accumulate(a,axis=0)]{.underline} - This is the same as reduce,
except that all the intermediate results are kept along the way.
**add.accumulate** is equivalent to **cumsum()**.

> Example:
>
> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a.shape=(3,3) #change the shape of the array
>
> CDAT\> a #show the array
>
> **(\[\[0, 1, 2\],**
>
> **\[3, 4, 5\],**
>
> **\[6, 7, 8\]\], Long)**
>
> CDAT\> b=add.accumulate(a) #accumulate the array
>
> CDAT\> b #show the array
>
> **(\[\[0, 1, 2\],**
>
> **\[3, 5, 7\],**
>
> **\[9, 12, 15\]\], Long)**

[ufunc.count(a,axis=0)]{.underline} - The method returns an array that
contains the number of values that were totaled at each node point. The
count method returns the total number of times the node value is added,
excluding the missing_value.

> Example:
>
> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a.shape=(3,3) #change the shape of the array
>
> CDAT\> a #show the array
>
> **(\[\[0, 1, 2\],**
>
> **\[3, 4, 5\],**
>
> **\[6, 7, 8\]\], Long)**
>
> CDAT\> a.missing_value=4 #set the missing_value
>
> CDAT\> b=avg.count(a) #count the node values that were used
>
> CDAT\> b #show the array
>
> **(\[3, 2, 3\], Long)**

[ufunc.outer(a,b)]{.underline} - Computes the outer product of *a* and
*b*.

Note: use of this function has not yet been tested.

> Example:
>
> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a.shape=(3,3) #change the shape of the array
>
> CDAT\> b=add.accumulate(a) #accumulate the array
>
> CDAT\> c=add.outer(a,b) #take the outer product of a & b
>
> CDAT\> c #show the new array
>
> **(\[\[\[\[0, 1, 2\],**
>
> **\[3, 5, 7\],**
>
> **\[9, 12, 15\]\],**
>
> **\[\[1, 2, 3\],**
>
> **\[4, 6, 8\],**
>
> **\[10, 13, 16\]\],**
>
> **\[\[2, 3, 4\],**
>
> **\[5, 7, 9\],**
>
> **\[11, 14, 17\]\]\],**
>
> **\[\[\[3, 4, 5\],**
>
> **\[6, 8, 10\],**
>
> **\[12, 15, 18\]\],**
>
> **\[\[4, 5, 6\],**
>
> **\[7, 9, 11\],**
>
> **\[13, 16, 19\]\],**
>
> **\[\[5, 6, 7\],**
>
> **\[8, 10, 12\],**
>
> **\[14, 17, 20\]\]\],**
>
> **\[\[\[6, 7, 8\],**
>
> **\[9, 11, 13\],**
>
> **\[15, 18, 21\]\],**
>
> **\[\[7, 8, 9\],**
>
> **\[10, 12, 14\],**
>
> **\[16, 19, 22\]\],**
>
> **\[\[8, 9, 10\],**
>
> **\[11, 13, 15\],**
>
> **\[17, 20, 23\]\]\]\], Long)**

[ufunc.reduce(a, axis=0)]{.underline} - Returns an array object that is
reduced along the axis. **add.reduce()** is synonymous with the
**sum()** utility function.

> Example:
>
> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a.shape=(3,3) #change the shape of the array
>
> CDAT\> a #show the array
>
> **(\[\[0, 1, 2\],**
>
> **\[3, 4, 5\],**
>
> **\[6, 7, 8\]\], Long)**
>
> CDAT\> b=add.reduce(a) #reduce the array
>
> CDAT\> b #show the new array
>
> **(\[9, 12, 15\], Long)**
>
> CDAT\> b.shape #show the shape of the array
>
> **(3,)**

[ufunc.reduceat(a, indices,axis=0)]{.underline} - This function reduces
*a* to each of the given indices so that the new size along the given
axis will be the same as the length of indices.

Note: use this function with caution.

> Example:
>
> CDAT\> a=arrayrange(9) #create an array
>
> CDAT\> a.shape=(3,3) #change the shape of the array
>
> CDAT\> a #show the array
>
> **(\[\[0, 1, 2\],**
>
> **3, 4, 5\],**
>
> **\[6, 7, 8\]\], Long)**
>
> CDAT\> d=add.reduceat(a,(0,1)) #reduce the array
>
> CDAT\> d #show the new array
>
> **(\[\[0, 3\],**
>
> **\[3, 9\],**
>
> **\[6, 15\]\], Long)**
>
> CDAT\> d.shape #show the shape of the new array
>
> **(3, 2)**

### 

The NUMERICAL functions provide access to different numerical routines.

[convolve(a,b,mode=0)]{.underline} - Returns the convolution of *a* and
*b*. This function is implemented in the standard manner, without using
Fast Fourier Transforms (FFT's). It is intended for the convolution of a
large array with a small one. The mode can be set to either 0,1, or 2.

0 - the length of the resulting array will be len(a)-len(b)+1

1 - the length of the resulting array will be len(a)

2 - the length of the resulting array will be len(a)+len(b)-1

For modes 1 and 2, the array elements are zeros padded on the left and
right sides to provide for missing elements.

> Example:
>
> #create an array
>
> CDAT\>a=array((0.027,0.05856,0.0903,0.11742,0.13567,0.14210,0.13567,0.11742,0.0903,0.05856,0.027),Float)
>
> CDAT\> a #show the array
>
> **(\[0.027, 0.05856, 0.0903, 0.11742, 0.13567, 0.1421,**
>
> **0.13567, 0.11742, 0.0903, 0.05856, 0.027\], Double)**
>
> CDAT\> a.shape #show the shape of a
>
> **(11,)**
>
> CDAT\> e=array((1,2,3,4,5),Float) #create an array
>
> CDAT\> e show the array
>
> **(\[1.0, 2.0, 3.0, 4.0, 5.0\], Double)**
>
> CDAT\> e.shape #show the shape of the array
>
> **(5,)**
>
> CDAT\> f=convolve(a,e,1) #return the convolution of a & e
>
> CDAT\> f #show the new array
>
> **(\[0.76674, 1.17798, 1.56305, 1.8446, 1.9789, 1.94484,**
>
> **1.74806, 1.4197, 1.01065, 0.5817, 0.28842\], Double)**
>
> CDAT\> f.shape #show the shape of f
>
> **(11,)**

[dot(a,b)]{.underline} - Returns the dot product of *a* and *b*. This is
equivalent to a matrix-multiply operation for 2D arrays (without
transpose).

> Example:
>
> CDAT\>
> a=0,1,2,3,4,5,6,7,8,9,30,11,12,13,14,15,16,17,30,19,20,21,22,23,1
> #create a tuple
>
> CDAT\> b=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> c=reshape(a,(5,5)) #reshape the tuple
>
> CDAT\> d=dot(b,c) #return the dot product of a & b
>
> CDAT\> d #show the array
>
> **(\[\[190, 160, 170, 216, 98\],**
>
> **\[540, 435, 470, 601, 333\],**
>
> **\[890, 730, 810, 1046, 648\],**
>
> **\[1420, 1177, 1274, 1731, 1031\],**
>
> **\[1130, 777, 864, 1227, 1015\]\], Long)**

[sum(a)]{.underline} - Adds all the elements in the array.

Note: **add.reduce()** is synonymous with the **sum()** utility
function.

> Example:
>
> CDAT\> a=0,-2,0,0,0,2,0,4,0,6 #create an tuple
>
> CDAT\> a #show the tuple
>
> **(0, -2, 0, 0, 0, 2, 0, 4, 0, 6)**
>
> CDAT\> sum(a) #calculate the sum
>
> **10**
>
> CDAT\> b=where(a,2,7) #zeros get 7, non-zeros get 2
>
> CDAT\> b #show the array
>
> **(\[7, 2, 7, 7, 7, 2, 7, 2, 7, 2\], \'Long\')**
>
> CDAT\> sum(b) #calculate the sum
>
> **50**

### 

The RANDOM functions are designed to create arrays filled with random
numbers. They are the front-ends to the functions provided by the ranlib
module. To use the random number functions in CDAT, type: **import
RandomArray**

[get_seed()]{.underline} - Returns the two integers that are the
generator's current seed.

> Example:
>
> CDAT\> import RandomArray #import the module
>
> CDAT\> RandomArray.seed(0,0) #set the seed
>
> CDAT\> RandomArray.get_seed() #get the seed
>
> **(889561580, 796586)**

[permutation(shape=\[\])]{.underline} - A random resorting of the values
in **arrayrange(a)**.

> Example:
>
> CDAT\> import RandomArray #import the module
>
> CDAT\> p=RandomArray.permutation(10) #create an array
>
> CDAT\> p #show the array
>
> **(\[4, 8, 3, 9, 1, 6, 2, 7, 0, 5\], Long)**

[random(shape=\[\])]{.underline} - Returns an array of random numbers
uniformly distributed between 0 and 1 of the given shape. Returns a
scalar if the shape is empty (as in the default).

> Example:
>
> CDAT\> import RandomArray #import the module
>
> CDAT\> RandomArray.seed(0,0) #set the seed
>
> CDAT\> RandomArray.random((1,2,3)) #create an array of random numbers
>
> **(\[\[\[0.0812946259975, 0.0130047556013, 0.721294283867\],**
>
> **\[0.693958163261, 0.870485723019, 0.642362713814\]\]\], Double)**

[randint(minimum=0, maximum, shape=\[\])]{.underline} - An array of
integers between 'minimum' and 'maximum', not including the value of
'maximum' (as in range).

> Example:
>
> CDAT\> import RandomArray #import the module
>
> CDAT\> RandomArray.seed(0,0) #set the seed
>
> CDAT\> RandomArray.randint(1,37,(1,3,5)) #create an array of random
> integers
>
> **(\[\[\[21, 33, 1, 31, 21\],**
>
> **\[30, 28, 9, 14, 10\],**
>
> **\[3, 29, 3, 20, 24\]\]\], Long)**

[seed(x=0, y=0)]{.underline} - Sets the seed of the random number
generator from two integers.

> Example:
>
> CDAT\> import RandomArray #import the module
>
> CDAT\> RandomArray.seed(0,0) #set the seed

[uniform(minimum, maximum, shape=\[\])]{.underline} - The random numbers
are uniformly distributed between 'minimum' and 'maximum'.

> Example:
>
> CDAT\> import RandomArray #import the module
>
> CDAT\> RandomArray.seed(0,0) #set the seed
>
> CDAT\> RandomArray.uniform(3,15,(1,2,3)) #create an array of random
> numbers
>
> **(\[\[\[14.3014783859, 5.83235639334, 8.74929141998\],**
>
> **\[12.5262043476, 7.01914644241, 8.70430040359\]\]\], Double)**

### 

The LINEAR ALGEBRA functions are designed to be wrappers for the
low-level routines offered by the LAPACK routines. To use the linear
algebra functions in CDAT,

type: **import LinearAlgebra.**

[determinant(a)]{.underline} - Returns the determinant of *a*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2\],**
>
> **\[3, 4\]\], Long)**
>
> CDAT\> LinearAlgebra.determinant(a) #return determinant
>
> **-2.0**

[eigenvalues(a)]{.underline} - Returns an array object that contains the
eigenvalues of *a*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2\],**
>
> **\[3, 4\]\], Long)**
>
> CDAT\> LinearAlgebra.eigenvalues(a) #return eigenvalues
>
> **(\[5.37228132327, -0.372281323269\], Double)**

[eigenvectors(a)]{.underline} - Returns an array object that contains
the eigenvectors of *a*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2\],**
>
> **\[3, 4\]\], Long)**
>
> CDAT\> b,c=LinearAlgebra.eigenvectors(a) #return eigenvectors
>
> CDAT\> b #show the array
>
> **(\[5.37228132327, -0.372281323269\], Double)**
>
> CDAT\> c #show the array
>
> **(\[\[0.415973557919, 0.909376709132\],**
>
> **\[-0.824564840132, 0.565767464969\]\], Double)**

[generalized_inverse(a)]{.underline} - Returns an array object that
contains the generalized inverse of *a*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\>LinearAlgebra.generalized_inverse(a) #return generalized_inverse
>
> **(\[\[-2.0, 1.0\],**
>
> **\[1.5, -0.5\]\], Double)**

[inverse(a)]{.underline} - Returns an array object that contains the
inverse of *a*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\>LinearAlgebra. inverse(a) #return inverse
>
> **(\[\[-2.0, 1.0\],**
>
> **\[1.5, -0.5\]\], Double)**

[linear_least_squares(a,b)]{.underline} - Returns an array object that
contains the linear least-squares of *a* and *b*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2\],**
>
> **\[3, 4\]\], Long)**
>
> CDAT\> b=array(\[\[5,6\],\[7,8\]\]) #create an array
>
> CDAT\> b #show the array
>
> **(\[\[5, 6\],**
>
> **\[7, 8\]\], Long)**
>
> CDAT\> LinearAlgebra.linear_least_squares(a,b) #return
> linear_least_squares
>
> **(array(\[\[-3.0, -4.0\], \[4.0, 5.0\]\], \'d\'), array(\[\], \'d\'),
> 2, array(\[5.46498570422, 0.365966190626\], \'d\'))**

[singular_value_decomposition(a)]{.underline} - Returns an array object
that contains the singular value decomposition of *a*.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2\],**
>
> **\[3, 4\]\], Long)**
>
> CDAT\> LinearAlgebra.singular_value_decomposition(a) #return
> singular_value_decomposition
>
> **(array(\[\[-0.404553584834, -0.914514295677\], \[-0.914514295677,
> 0.404553584834\]\], \'d\'),**
>
> **array(\[5.46498570422, 0.365966190626\], \'d\'),**
>
> **array(\[\[-0.576048436766, -0.81741556047\], \[0.81741556047,
> -0.576048436766\]\], \'d\'))**

[solve_linear_equations(a,b)]{.underline} - Returns an array object that
solves the linear equation.

> Example:
>
> CDAT\> import LinearAlgebra #import the module
>
> CDAT\> a=array(\[\[1,2\],\[3,4\]\]) #create an array
>
> CDAT\> a #show the array
>
> **(\[\[1, 2\],**
>
> **\[3, 4\]\], Long)**
>
> CDAT\> b=array(\[\[5,6\],\[7,8\]\]) #create the array
>
> CDAT\> b #show the array
>
> **(\[\[5, 6\],**
>
> **\[7, 8\]\], Long)**
>
> CDAT\> LinearAlgebra.solve_linear_equations(a,b) #return
> solve_linear_equations
>
> **(\[\[-3.0, -4.0\],**
>
> **\[4.0, 5.0\]\], Double)\
> **

### 

The FFT is a package of Fortran subprograms for calculating fast Fourier
transforms for both complex and real periodic sequences and other
sequences To use the fft functions in CDAT,

type: **import FFT.**

[fft(a, n=None, axis=-1)]{.underline} - Returns the *n* point discreate
Fourier transform of *a*. *n* defaults to the length of *a*. This is
most efficient for *n* a power of two. If *n* is larger than *a*, the
*a* will be zero-padded to make up the difference. If *n* is smaller
than *a*, then *a* will be aliased to reduce its size.

> Example:
>
> CDAT\> a=array((0.23, -.14, .75, .41, -.02, .64))
>
> CDAT\> a
>
> **(\[0.23, -0.14, 0.75, 0.41, -0.02, 0.64\], Double)**
>
> CDAT\> FFT.fft(a)
>
> **(\[(1.87+0j), (-0.295+0.00866025403784j), (0.025+1.34233937587j),
> (0.05-2.01227923213e-16j),**
>
> **(0.025-1.34233937587j), (-0.295-0.00866025403784j)\], \'D\'),**
>
> CDAT\> FFT.fft(a,3)
>
> **(\[(0.84+0j), (-0.075+0.770762609368j), (-0.075-0.770762609368j)\],
> \'D\'),**

[inverse_fft(a, n=None, axis=-1)]{.underline} - Returns the *n* point
inverse discreate Fourier transform of *a*. *n* defaults to the length
of *a*. This is most efficient for *n* a power of two. If *n* is larger
than *a*, the *a* will be zero-padded to make up the difference. If *n*
is smaller than *a*, then *a* will be aliased to reduce its size.

> Example:
>
> CDAT\> a=array((0.23, -.14, .75, .41, -.02, .64))
>
> CDAT\> b=FFT.fft(a)
>
> CDAT\> FFT.inverse_fft(b)
>
> **(\[(0.23+3.46944695195e-18j), (-0.14-3.3653635434e-16j),**
>
> **(0.75-6.00540488059e-17j), (0.41+9.03776455475e-17j),**
>
> **(-0.02-4.40293597527e-17j), (0.64+3.46772670399e-16j)\], \'D\'),**

[real_fft(a, n=None, axis=-1)]{.underline} - Returns the *n* point
discreate Fourier transform of the real value array *a*. *n* defaults to
the length of *a*. This is most efficient for *n* a power of two. The
returned array will be one half of the symmetric complex transform of
the real array.

> Example:
>
> CDAT\> a=array((0.23, -.14, .75, .41, -.02, .64))
>
> CDAT\> FFT.real_fft(a)
>
> **(\[(1.64+0j), (-0.27-0.450333209968j), (-1.06-0.848704895709j),
> (0.18+0j)\], \'D\'),**

[fft2d(a, s=None, axes=(-2,-1))]{.underline} - Returns the 2d fft of
*a*.

> Example:
>
> CDAT\> a=array((0.23, -.14, .75, .41, -.02, .64))
>
> CDAT\> c=reshape(a,(3,2))
>
> **(\[\[0.23, -0.14\],**
>
> **\[0.75, 0.41\],**
>
> **\[-0.02, 0.64\]\], Double)**
>
> CDAT\> FFT.fft2d(c)
>
> **(\[\[(1.87+0j), (0.05+0j)\],**
>
> **\[(-0.8-0.467653718044j), (0.53-0.866025403784j)\],**
>
> **\[(-0.8+0.467653718044j), (0.53+0.866025403784j)\]\], \'D\'),**

[real_fft2d(a, s=None, axes=(-2,-1))]{.underline} - Returns the 2d fft
of the real valued array *a*.

> Example:
>
> CDAT\> a=array((0.23, -.14, .75, .41, -.02, .64))
>
> CDAT\> c=reshape(a,(3,2))
>
> CDAT\> FFT.real_fft2d(c)
>
> **(\[\[(1.05+0j), 1.05j\],**
>
> **\[(0.09-0.554256258422j), 0.09j\]\], \'D\'),**

### 

The PCMDI module is designed to provide access to different functions
relating to the work done at PCMDI. To use the PCMDI module in CDAT,
type: **import pcmdi**

[cd('path')]{.underline} - Changes the current working directory.

> Example:
>
> CDAT\> cd(\'/penguin1/cdat\') #cd to another directory
>
> **/penguin1/cdat**

[emacs('filename')]{.underline} - Pops up an emacs editor window for
creating and modifying files.

Example:

CDAT\> emacs(\'test\') #pop up a window running emacs to edit test

[ls()]{.underline} - List the files in current working directory.

> Example:
>
> CDAT\> ls() #list directories and files
>
> **\*\*\*\*\* S U B - D I R E C T O R I E S \*\*\*\*\***
>
> **./**
>
> **../**
>
> **vcs/**
>
> **cdms/**
>
> **demo/**
>
> **xgks/**
>
> **cdati/**
>
> **gplot/**
>
> **Python-1.4/**
>
> **\*\*\*\*\* E N D S U B - D I R E C T O R I E S \*\*\*\*\***
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\* F I L E S
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **cdat\***
>
> **float.py\***
>
> **cdatgui\***
>
> **float.pyc\***
>
> **rdwrt2.py\***
>
> **rdwrt2.pyc\***
>
> **Makefile\***
>
> **pynewline.py\***
>
> **pynewline.pyc\***
>
> **XF86Config\***
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\* E N D F I L E S
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

[pwd()]{.underline} - Shows the current working directory.

> Example:
>
> CDAT\> pwd() #show present working directory
>
> **/penguin0/susan/cdat/cdati**

[regrid(source,destination,\[mask\])]{.underline} - Regrids
*destination* to the grid of *source*. Use of *mask*, which is also an
array object, is optional.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> obsf=cu.open(\'/pcmdi/obs/psl.rnl_ecm.sc.7901.8812.sfc.ctl\')
> #open a file
>
> CDAT\> obs=obsf.getslab(\'psl\') #get a slab of data
>
> CDAT\> obs.shape #show shape of obs
>
> **(4, 73, 144)**
>
> CDAT\> s.shape #show shape f s
>
> **(120, 80, 96)**
>
> CDAT\> r=regrid(obs,s) \# regrid s to obs grid
>
> CDAT\> r.shape #show shape of r
>
> **(120, 73, 144)**
>
> CDAT\> fl=cu.open(\'/pcmdi/gis/DJF1079_88mm.dic\') #open a file
>
> CDAT\> mk=cu.open(\'/pcmdi/sft/sft_gis.dic\') #open a file
>
> CDAT\> mask=mk.getslab(\'sft\') #get a slab of data
>
> CDAT\> s1=fl.getslab(\'psl\') #get a slab of data
>
> CDAT\> s1.shape #show shape of s1
>
> **(1, 46, 72)**
>
> CDAT\> gis=regrid(obs,s1,mask) #regrid s1 to obs grid, masking out
> ocean
>
> CDAT\> gis.shape #show shape of gis
>
> **(1, 73, 144)**
>
> CDAT\> mask2=where(equal(mask,0),1,0) #create mask to mask land
>
> CDAT\> gis2=regrid(obs,s,mask2) #regrid s to obs grid, masking out
> land
>
> CDAT\> gis2.shape #show shape of gis
>
> **(1, 73, 144)**

[reorder(a, shape=\[\])]{.underline} - Reorder the PCMDI (ArrayObject)
dimensions to the defined order. This routine works within the confines
of Python.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> a=reorder(s,(1,2,0)) #reorder shape of s
>
> CDAT\> s.shape #show the shape of s
>
> **(120, 80, 96)**
>
> CDAT\> a.shape #show the shape of a
>
> **(80, 96,120)**

[slabinfo(slab)]{.underline} - Shows the attributes and dimensions
associated with a slab of data.

> Example:
>
> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> slabinfo(s) #show the information for s
>
> **\*\*\* Slab Information \*\*\***
>
> **Variable name: mrso**
>
> **File name: /pcmdi/mrso/mrso_bmr.dic**
>
> **Data type: Float**
>
> **Number of dimensions: 3**
>
> **time: Month**
>
> **length: 120**
>
> **start: 1, end: 120**
>
> **latitude: deg**
>
> **length: 80**
>
> **start: 88.2884, end: -88.2884**
>
> **longitude: deg**
>
> **length: 96**
>
> **start: 0, end: 356.25**
>
> **Number of attributes: 6**
>
> **source: BMRC BMRC2.3 R31L19 AMIP 10 Year Simulation ( 1979-1988 )**
>
> **title: Monthly Mean Soil Moisture**
>
> **units: cm**
>
> **date: 8/04/94**
>
> **time: 10:30:06**
>
> **grid_type: gaussian**

[writedrs(a, 'output_name', \['mode'\])]{.underline} - Creates, appends,
or overwrites a DRS formatted file. This function works within the
confines of Python.

modes:

a - append a to an existing file.

r - replaces data in an existing file with a

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> writedrs(s,\'/penguin0/susan/mrso.dic\') #write the slab of
> data
>
> **Info - created the DRS file (/penguin0/susan/mrso.dic).**

[writehdf(a, 'output_name', \['mode'\])]{.underline} - Creates, appends,
or overwrites an HDF formatted file. This function works within the
confines of Python.

modes:

a - append a to an existing file.

r - replaces data in an existing file with a)

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data

CDAT\> writehdf(s,\'/penguin0/susan/mrso.hdf\') #write the slab of data
to a file

**Info - created the HDF file (/penguin0/susan/mrso.hdf).**

[writenetcdf(a, 'output_name', \['mode'\])]{.underline} - Creates,
appends, or overwrites a netCDF formatted file. This function works
within the confines of Python.

modes:

a - append a to an existing file.

r - replaces data in an existing file with a

Example:

> CDAT\> f=cu.open(\'/pcmdi/mrso/mrso_bmr.dic\') #open a file
>
> CDAT\> s=f.getslab(\'mrso\') #get a slab of data
>
> CDAT\> writenetcdf(s,\'/penguin0/susan/mrso.nc\') #write the slab of
> data to a file
>
> **Info - created the netCDF file (/penguin0/susan/mrso.nc).**

[vi('filename')]{.underline} - Pops up a vi editor window for creating
and modifying files.

Example:

CDAT\> vi(\'test\') #pop up a window running vi to edit test

### 

The VCS module is designed to provide access to the VCS graphical
interface. For further information on VCS, see Web site
**http://www-pcmdi.llnl.gov/software**. To use the VCS module in CDAT,
type: **import vcs**

### 

[init()]{.underline} -Initializes and creates a VCS object, reads in the
initial.attribute file and set up the VCS default values. Note: The
number of VCS Canvases is limited to eight.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> **\'Template\' is currently set to P_default.**
>
> **Graphics method \'Boxfill\' is currently set to Gfb_default.**

### 

[animate()]{.underline} - Pops up the VCS animation GUI, allowing
animations to be run in the VCS canvas.

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.animate() #bring up the animation gui for the Canvas

[clear()]{.underline} - This routine clears all the displays on a page
(i.e., the VCS Canvas).

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.clear() #clear the VCS Canvas

[\
cgm('output_name', \['mode'\])]{.underline} - To save a graphics plot in
CDAT, the user calls **cgm** along with the name of the output. This
routine saves the displayed image on the VCS Canvas as binary vector
graphics that can be imported into word processors such as Microsoft
Word or Adobe Framemaker. CGM files are an ISO standards output format.

modes:

a - append a to an existing file.

r - replaces data in an existing file with a

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.cgm(\'tp\') #create a cgm file
>
> **Info - create the CGM file (/pcmdi/susan/PCMDI_GRAPHICS/tp.cgm).**

[close()]{.underline} - This function does not deallocate the VCS Canvas
object. It only disengages and collapses the VCS Canvas.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.open() #open the VCS Canvas
>
> CDAT\> x.close() #close the VCS Canvas

[colormapgui()]{.underline} - Pops up the VCS colormap GUI, allowing
manipulation of the colormap.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.colormapgui() #bring up the colormap gui for the canvas

[geometry(width, height, x-screen_position,
y-screen_position)]{.underline} - Allows the user to position and size
the VCS Canvas after it is displayed on the screen.

Example:

> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.open() #open the VCS Canvas
>
> CDAT\> x.geometry(400,200,0,0) #set the geometry for the Canvas

**Info - Using 400x200+0+0 as the canvas geometry.**

[grid(shape=\[\])]{.underline} - Set the default plotting region for
variables that have more dimension values than the graphics method. This
function is also be used for animating plots over the third and fourth
dimensions.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.grid(12,12,0,71,0,45) #set the plotting region

[listelements()]{.underline} - Returns a Python list of VCS elements.
That is, this function returns: **template**, **data**, **boxfill**,
**continent**, **isofill**, **isoline**, **outfill**, **outline**,
**scatter vector**, **xvsy**, **xyvsy**, **yxvsy**, **line**, **text**,
**marker**, **fillarea**, **format**, and **list**.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.listelements() #show the elements of VCS
>
> **\[\'template\', \'boxfill\', \'continent\', \'isofill\',
> \'isoline\', \'outfill\', \'outline\', \'scatter\', \'vector\',
> \'xvsy\', \'xyvsy\', \'yxvsx\', \'colormap\', \'fillarea\',
> \'format\', \'line\', \'list\', \'marker\', \'text\'\]**

[open()]{.underline} - This routine pops up the VCS Canvas for viewing
and displaying images.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.open() #open the VCS Canvas

[page()]{.underline} - Changes the VCS Canvas orientation to either
'Portrait' or 'Landscape'.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.open() #open the VCS Canvas
>
> CDAT\> x.page() #change the page orientation of the Canvas

[plot(a, 'template_name', 'graphics_method',
'graphics_name')]{.underline} - Draws the data (or arrayobject) in the
VCS Canvas. If no data is given, then an error is returned. The
'template' and 'graphics method' are optional. If the 'template' or
'graphics method' are not given, then default settings will be used. See
the **PyVCS_set** function to set the 'template' and 'graphics method'.

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.plot(s,\'AMIP\',\'isoline\',\'default\') #plot the slab of
> data using specified method
>
> **Plotting Slab!**

[postscript('postscript_name', \['orientation'\])]{.underline} - This
function outputs a Postscript file, by first saving a CGM file, then
using gplot to convert the CGM file to a Postscript file in the chosen
location. The 'postscript_name' specifies the name and location of the
file. The 'orientation' indicates whether the Postscript file is
'landscape' or 'portrait'. The default orientation is 'landscape'.

orientation:

l - landscape

p - portrait

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.postscript(\'tp\','p') #create a postscript file

[printer('printer_name', \['orientation'\])]{.underline} - This function
sends the VCS Canvas plot(s) directly to the printer. 'printer name' is
the name of the Postscript printer on the user's local area network,
while 'orientation' specfiies the hardcopy as either 'landscape' or
'portrait' orientation.

orientation:

l - landscape

p - portrait

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.printer(cirrus) #print a postscript file

[raster('output_name', \['mode'\])]{.underline} - In some cases, the
user may wish to save the file out as a raster file. This function
allows a save of the VCS Canvas output as a Sun Microsystems raster
file. This file can be converted to other formats with the aid of **xv**
software or similar image tools found freely on the World Wide Web.

modes:

a - append a to an existing file.

r - replaces data in an existing file with a

> Example:
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.plot(s) #plot the slab of data using the defaults
>
> **Plotting Slab!**
>
> CDAT\> x.animate() #bring up the animation gui for the Canvas
>
> CDAT\> x.raster(\'rp\') #create a raster file
>
> **Info - create the raster Output file (rp.ras).**

[resetgrid()]{.underline} - Set the plotting region to default values.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.grid(12,12,0,71,0,45) #set the plotting region
>
> CDAT\> x.resetgrid() #reset the plotting region

[script('VCS_script_name')]{.underline} - This function gives Python the
ability to read in a VCS script, a handy feature when working with the
VCS interface and CDAT.

Example:

> CDAT\> x=vcs.init() #initialize a VCS Canvas

CDAT\> x.script('mytemplate.scr') #run a VCS script

[set('element_type', 'element_name')]{.underline} - Sets the default
primary elements: **template**, and **graphics methods**, and the
secondary element **color**. The **template** determines the appearance
of each segment; the **graphics method** specifies the display
technique; and the data defines what is to be

displayed. Note, the data cannot be set. The **colormap** can be set
here or by means of the colormap GUI.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS canvas
>
> CDAT\> x.listelements() #show the elements of VCS
>
> **\[\'template\', \'boxfill\', \'continent\', \'isofill\',
> \'isoline\', \'outfill\', \'outline\', \'scatter\', \'vector\',
> \'xvsy\', \'xyvsy\', \'yxvsx\', \'colormap\', \'fillarea\',
> \'format\', \'line\', \'list\', \'marker\', \'text\'\]**
>
> CDAT\> x.show(\'isofill\') #show the names of the isofill elements
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*Isofill Names
> List\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **(1): default quick AMIP_psldif**
>
> **(4): AMIP_psl AMIP_pslvar AMIP_tg**
>
> **(7): AMIP_tgvar AMIP_tas AMIP_tasva**
>
> **(10): AMIP_clt AMIP_prw AMIP_mrso**
>
> **(13): AMIP_prsm AMIP_pr AMIP_evs**
>
> **(16): AMIP_tauu AMIP_tauv AMIP_hfss**
>
> **(19): AMIP_rss AMIP_rls AMIP_rst**
>
> **(22): AMIP_rlt AMIP_crfm2 AMIP_ta200**
>
> **(25): AMIP_tavar200 AMIP_ta850 AMIP_tavar850**
>
> **(28): AMIP_zg200 AMIP_zgvar200 AMIP_zg500**
>
> **(31): AMIP_zgvar500 AMIP_zg850 AMIP_zgvar850**
>
> **(34): AMIP_hus200 AMIP_husvar200 AMIP_hus850**
>
> **(37): AMIP_husvar850 AMIP_u200 AMIP_uvar200**
>
> **(40): AMIP_u850 AMIP_uvar850 AMIP_v200**
>
> **(43): AMIP_vvar200 AMIP_v850 AMIP_vvar850**
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*End Isofill Names
> List\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> CDAT\> x.set(\'isofill\',\'AMIP_clt \') #set the graphics method
>
> **Default graphics method \'Isofill\' now set to Gfi_AMIP_clt**

[setcolormap('colormap_name')]{.underline} - This routine brings up
CDAT's colormap editor (which is the same as in VCS), when changes in
the color map are desired.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> x.setcolormap(\'AMIP\') #set the colormap for the Canvas

[setminmax(min_value, max_value, underflow, overflow)]{.underline} -
This function sets the VCS Canvas global minimum and maximum values. It
also indicates underflow and overflow values. (That is, values that are
less than the minimum are underflow values and values that are greater
than the maximum are overflow values.) To reset the minimum and maximum
to the default values, use **x.setminmax(1e20,1e20,0,0)**

Example:

> CDAT\> x=vcs.init() #initialize a VCS Canvas
>
> CDAT\> f=cu.open(\'clt.nc\') #open a file
>
> CDAT\> s=f.getslab(\'clt\') #get a slab of data
>
> CDAT\> x.setminmax(20.5,90,1,1) #set the min and max values for
> plotting
>
> **Info - 1. - VCS Canvas default minimum value is set to 20.5**
>
> **Info - 1. - VCS Canvas default maximum value is set to 90**
>
> **Info - 1. - VCS Canvas underflow arrow will be displayed**
>
> **Info - 1. - VCS Canvas overflow arrow will be displayed**
>
> CDAT\> x.plot(s) #plot the slab of data

[show('element_type')]{.underline} - List the primary attributes set
names for: **template**, **graphics** **methods**, or **data**. This
function also lists the secondary attribute set names, such as:
**colormap**, **fill area**, **format**, **line**, **marker**, **list**,
**text**, or **text orientation**.

> Example:
>
> CDAT\> x=vcs.init() #initialize a VCS canvas
>
> CDAT\> x.show(\'isofill\') #show the names of the isofill elements
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*Isofill Names
> List\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***
>
> **(1): default quick AMIP_psldif**
>
> **(4): AMIP_psl AMIP_pslvar AMIP_tg**
>
> **(7): AMIP_tgvar AMIP_tas AMIP_tasva**
>
> **(10): AMIP_clt AMIP_prw AMIP_mrso**
>
> **(13): AMIP_prsm AMIP_pr AMIP_evs**
>
> **(16): AMIP_tauu AMIP_tauv AMIP_hfss**
>
> **(19): AMIP_rss AMIP_rls AMIP_rst**
>
> **(22): AMIP_rlt AMIP_crfm2 AMIP_ta200**
>
> **(25): AMIP_tavar200 AMIP_ta850 AMIP_tavar850**
>
> **(28): AMIP_zg200 AMIP_zgvar200 AMIP_zg500**
>
> **(31): AMIP_zgvar500 AMIP_zg850 AMIP_zgvar850**
>
> **(34): AMIP_hus200 AMIP_husvar200 AMIP_hus850**
>
> **(37): AMIP_husvar850 AMIP_u200 AMIP_uvar200**
>
> **(40): AMIP_u850 AMIP_uvar850 AMIP_v200**
>
> **(43): AMIP_vvar200 AMIP_v850 AMIP_vvar850**
>
> **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*End Isofill Names
> List\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

# 

The CDAT Graphical User Interface (GUI) presently consists of the
following windows and panels.

## 

![](media/image4.png){width="3.036111111111111in"
height="1.7604166666666667in"}

The CDAT Command Input Window allows the user to directly enter commands
for processing. This window has a main menu bar that consists of: a
'Views' pull-down menu, which allows the user to display the CDAT Output
Window and to exit CDAT; a 'Tools' pull-down menu, which allows the user
to display the Script Editor Window and the ColorMap Editor/Table Panel;
and an 'Info' pull-down menu, which allows the user to display the CDAT
Help Index Window and the CDAT Authors Window. The Input Window below
the main menu bar allows the user to enter CDAT/Python commands at the
'CDAT\>' prompt.

### 

#### Accessing the CDAT Command Input Window

The CDAT Command Input Window appears after the command 'cdatgui' has
been entered from the xterm window. This command will automatically
bring up the CDAT Command Input Window and the CDAT Output Window.

#### Displaying the CDAT Output Window

Move the pointer over the 'Views' pull down menu item located in the
upper left corner of the main menu bar and press and hold the left mouse
button. While holding down the left mouse button, move the pointer over
the 'Output' menu item and release the left mouse button\--the 'CDAT
Output Window' will appear.

#### Displaying the Script Editor Window

Move the pointer over the 'Tools' pull down menu item located in the
main menu bar and press and hold the left mouse button. Then move the
pointer over the 'Script Editor' menu item and release the left mouse
button\--the 'Script Editor Window' will appear.

#### Displaying the ColorMap Editor/Table Panel

Move the pointer over the 'Tools' pull down menu item located in the
main menu bar and press and hold the left mouse button. Then move the
pointer over the 'Colormap Editor' menu item and release the left mouse
button\--the 'ColorMap Editor/Table Panel' will appear.

#### Displaying the Help Index Window

Move the pointer over the 'Info' pull-down menu item located in the
upper right corner of the main menu bar and press and hold the left
mouse button. Then move the pointer over the 'Help' menu item and
release the left mouse button\--the 'CDAT Help Index Window' will
appear.

#### Exiting CDAT

Move the pointer over the 'Views' pull down menu item located in the
upper left corner of the main menu bar and press and hold the left mouse
button. Then move the pointer over the 'Exit CDAT' menu item and release
the left mouse button\--a question popup will appear to confirm the exit
from CDAT.

## 

![](media/image5.png){width="3.036111111111111in"
height="1.4472222222222222in"}

The single CDAT Output Window returns information (e.g., listings,
output information, warnings, errors, successes, etc.).

### 

Accessing the CDAT Output Window (Main Menu - 'Views' -\> 'Output'):

To display the CDAT Output Window, move the pointer over the 'Views'
pull-down menu item located in the upper left corner of the CDAT Input
Command Window and press and hold the left mouse button. Then move the
pointer over the 'Output' menu item and release the left mouse
button\--the 'CDAT Output Window' will appear.

## 

![](media/image6.png){width="3.5930555555555554in"
height="2.9784722222222224in"}

The CDAT Help Index Window was created to provide a definition,
synopsis, description, and example of each command in the CDAT/Python
modules. The user interface consist of: a 'Help Index' window, for
listing the CDAT/Python modules and their commands and an 'Information'
window, for displaying text information about the modules and their
commands. The red 'Done' button dismisses the CDAT Help Index Window.

### 

Accessing the CDAT Help Index Window (Main Menu - 'Info' -\> 'Help'):

To view the CDAT Help Index Window, move the pointer over the 'Info'
pull-down menu item located in the upper right corner of the CDAT Input
Command Window and press and hold the left mouse button. Then move the
pointer over the 'Help' menu item and release the left mouse
button\--the 'CDAT Help Index Window' will appear.

### 

Move the pointer over the desired module or command and click the left
mouse button. Information about the module or command will be displayed
in the 'Information' window. When selecting a module name in the 'Help
Index' (i.e., CDUNIF, CDTIME, LATS, NUMERIC, PCMDI, and VCS), the list
will expand to show the module's commands. To remove the module's list
of commands from the 'Help Index' window, select the module name.

## 

![](media/image7.png){width="2.8125in" height="3.0722222222222224in"}

The Script Editor Window allows the user to create, open, modify, save,
and run CDAT/Python programs. The editor has a menu bar that consists
of: a 'File' pull-down menu, which allows for opening and saving files;
an 'Edit' pull-down menu, which allows cutting, copying, pasting, and
clearing text; a 'View' pull-down menu, which allows transit to a
specified line number and listing of line numbers to the left of the
text; a 'Search' pull-down menu, which allows for pattern matching in
the text; and a 'Run' pull-down menu, which allows the running of
programs listed in the edit window. The editor also has a 'Search' and a
'Replace' input text window located just below the menu bar, and an
editor window located below the input text windows.

### 

#### Opening a File

![](media/image8.png){width="2.8125in" height="1.6402777777777777in"}

Move the pointer over the 'File' pull-down item in the menu bar and
press and hold the left mouse button. Then move the pointer over the
'Open' menu item and release the left mouse button\--the 'Open CDAT
Script File' popup window will appear.

To change directories, type the desired directory in the 'Directory'
input text window, and press the 'Return' or 'Enter' key to register the
end of typing. The 'Sub_Dir' scroll window, and possibly also the '.py
Files' scroll window, will change. (If the specified directory does not
exist, the current directory will reappear. Note, CDAT recognizes the C
shell tilde \~ convention as designating the home directory.) The
directory can also be changed by moving the pointer over a directory
name in the 'Sub_Dir' scroll window and clicking the left mouse button.

Move the pointer over the desired CDAT/Python file name in the '.py
File' scroll window and click the left mouse button. The selected file
will appear in the edit window.

#### Saving a File

![](media/image9.png){width="2.8125in" height="1.6402777777777777in"}

Move the pointer over the 'File' pull-down item in the menu bar and
press and hold the left mouse button. Then move the pointer over the
'Save' menu item and release the left mouse button\--the 'Save CDAT
Script File' popup window will appear.

To change directories, type the desired directory in the 'Directory'
input text window, and press the 'Return' or 'Enter' key to register the
end of typing. The 'Sub_Dir' scroll window, and possibly also the '.py
Files' scroll window, will change. (If the specified directory does not
exist, the current directory will reappear. Note, CDAT recognizes the C
shell tilde \~ convention as designating the home directory.) The
directory can also be changed by moving the pointer over a directory
name in the 'Sub_Dir' scroll window and clicking the left mouse button.

Move the pointer over the 'CDAT File' input text window and click the
left mouse button. Then enter the desired program output file name
(e.g., 'example' ) in the 'CDAT File' text window. To replace a program
file, move the pointer over the desired program file name in the '.py
Files' scroll window and click the left mouse button. A question popup
will appear to verify the overwriting of the select program file. At
this point, the option to carry out the command or to cancel the save is
given.

#### Editing a File

To create or edit an existing file, move the pointer to the desired
location for editing. Then click the left mouse button and start
entering the text from the keyboard. Move the flashing insert pointer by
using the up, down, left, and right keys on the keyboard.

To cut or copy a block of text, first move the pointer to the beginning
of the block, and press and hold the left mouse button. Then move the
pointer to the end of the block to highlight the text to be cut or
copied. Now select the 'Edit' pull down item in the menu bar and
continue to select it while continuing to hold down the left mouse
button. Then move the pointer over the desired 'Cut' or 'Copy' menu item
and release the left mouse button.

Once a block of text has been cut or copied, it can be pasted elsewhere.
To do so, move the pointer to the desired location and click the left
mouse button. Then select the 'Edit' pull-down item in the menu bar, and
continue to hold down the left mouse button. Now move the pointer over
the 'Paste' menu item and release the left mouse button. The cut or
copied block of text will be placed in the chosen location.

To clear the editor window, move the pointer over the 'Edit' pull down
item in the menu bar, and press and hold down the left mouse button.
Then move the pointer over the 'Clear' menu item and release the left
mouse button. All text in the editor window will be removed.

#### Searching for Patterns in the Edit Window

To search for a text pattern, enter it in the 'Search:' input text
window located just below the menu bar. Move the pointer over the
'Search' pull-down item in the menu bar and press and hold the left
mouse button. Then move the pointer over the 'Find Next' menu item and
release the left mouse button. The editor window will scroll, making
visible the entered pattern in the 'Search:' input text window. The
location of the pattern will also be displayed in the CDAT Output
Window.

#### Replacing Text in the Edit Window

To replace text in the edit window, enter the pattern to be replaced in
the 'Search:' input text window and enter the replacement text in the
'Replace:' input text window. To replace the text one line at a time,
move the pointer over the 'Search' menu bar item and press and hold the
left mouse button. Then move the pointer over the 'Find Next' item and
release the left mouse button. To replace all the text in the edit
window, move the pointer over the 'Search' menu bar item and press and
hold the left mouse button. Then move the pointer over the 'Replace
Text' menu item and release the left mouse button.

[Running the Contents in the Edit Window:]{.underline}

To run the program in the edit window, select 'Run' menu bar item. Any
error messages will appear in the CDAT Output Window.

### 

![](media/image10.png){width="2.7708333333333335in"
height="3.957638888888889in"}

The Colormap Editor/Table Panel is used to create and modify colormaps.
It contains 256 color indices, a color spectrum bar, Red-Green-Blue (or,
on option, Cyan-Magenta-Yellow) color sliders, a color index viewer and
reset button, a brightness slider, a blend button, a color model menu
button, a copy button, an information button, a miscellaneous pull-down
menu button, and a scroll list of colormap names. The VCS module treats
colormap attributes as one of eight secondary elements making up the
three primary elements (**template**, **graphics method**, and
**data**). Note: A color index cannot be selected if the colormap is
specified as 'default' or if the color index is greater than 240.

#### How to Use the Colormap Editor/Table Panel 

#### Accessing the Colormap Editor/Table Panel (Main Menu - 'Tools' -\> 'Colormap Editor')

To display the Colormap Editor/Table Panel, move the pointer over the
'Tools' pull-down menu item located in the CDAT Input Command Window and
press and hold the left mouse button. Then move the pointer over the
'Colormap Editor' menu item and release the left mouse button\--the
'Colormap Editor/Table Panel' will appear.

#### Selecting and Modifying a Color Index:

Move the pointer over one of the indices 0 through 239, and select with
the left mouse button. The selected color index can then be modified
with the 'Red', 'Green', and 'Blue' sliders. To reset the color index,
select the button to the right of the corresponding slider. (Color
indices 240 through 256 are reserved for the VCS module internal use.)

#### Changing the Color Model:

There are currently two color models available in the VCS module:
Red-Green-Blue (RGB) and Cyan-Magenta-Yellow (CMY). To change from the
RGB color model to CMY, move the pointer to the 'RGB' menu button
(located below the 'Brightness' input text window). Press and hold the
left mouse button, then move the pointer over the 'CMY' menu item and
release the mouse button. Note that the 'Red', 'Green', and 'Blue'
labels are replaced by 'Cyan', 'Magenta', and 'Yellow' respectively.

#### Blending Colors:

To blend colors, select a lower color index with the left mouse button
and an upper color index with the middle mouse button, and modify the
colors of each index as desired. Now select the 'Blend' button to change
the colors of intermediate indices by progressively blending the colors
of the lower and upper indices.

#### Copying and Pasting Color Indices:

To copy a range of color indices, select the first color index with the
left mouse button, then select the second color index with the middle
mouse button. To paste this range of color indices, move the pointer to
the desired position, and click the right mouse button.

#### Copying/Renaming a Colormap:

Select a colormap name from the scroll window list, then select the
'Copy' button. An input text window will appear in which a new colormap
name can be specified.

#### Displaying Color Index Value Range Information:

The green 'Info On' button will show color index value ranges only for
the Boxfill graphics method. In that case, if the color index selected
with the left or the middle mouse button is within the data range, the
CDAT Output Window (located below the CDAT Input Window) will show a
value range for the color index.

#### Deleting a Colormap:

Select a colormap name from the scroll window list, then move the
pointer over the 'Misc.' pull-down menu button and press and hold the
left mouse button. Then move the pointer over the 'Delete' menu item and
release the left mouse button. A popup panel will appear to confirm
deletion of the colormap.

#### Saving the Individual Colormap to a Script File:

Select a colormap name from the scroll window list, then move the
pointer over the 'Misc.' pull-down menu button and press and hold the
left mouse button. Then move the pointer over the 'Script' menu item and
release the left mouse button\--a 'Save Colormap Script' popup window
will appear. Enter the name of the colormap script and hit the 'Return'
(or 'Enter') key, or select the 'Save Script' button to save the
colormap to a VCS script file that will be located in the user's
\$HOME/PCMDI_GRAPHICS directory.

### 

![](media/image11.png){width="2.7708333333333335in"
height="3.957638888888889in"}

The Animation Control Panel is used to create sequences of raster images
in memory or in an output file (i.e., 'filename.ras'). Once raster
images are created, their animation can be viewed, subject to user
control.

#### How to Use the Animation Control Panel 

#### Accessing the Animation Control Panel:

Before the Animation Control Panel is accessed, there must be at least
one plot of data having three or more dimensions displayed on the VCS
Canvas. (An unlimited number of plots cannot be animated and the VCS
module will not allow creation of a raster file for more than one data
variable. To perform such operations, use the VCS software application
directly.)

The Animation Control Panel can be displayed by entering the
**X.animation()** command and depressing the 'Return' key. **X**
represents the object's name for the initialized VCS module (e.g., **X =
vcs.init()**, the command that initialized the VCS module). By design,
the Animation Control Panel will appear to the left of the CDAT Command
Input Window.

Once the above conditions are satisfied, use the Animation Control Panel
to choose whether to create images in 'Memory' and/or in an 'Output
File'. If the 'Output File' toggle button is selected, an input text
window will appear below to receive the output file name. Select the
yellow 'Create Images In' button to begin saving raster images. When
saving is completed, this button will turn red and display as 'Stop
Creating:'. Select 'Stop Creating:' to discontinue saving raster images
at any time.

#### Defining the Animation Frames:

The number of animation frames to be created can be controlled by the
**X.grid()** command. **X** represents the object's name for the
initialized VCS module (e.g., **X = vcs.init()**, the command that
initialized the VCS module). This command is used to predefine the
number of animation plots to be created in the third, fourth, or greater
dimensions. See the **X.grid()** command for more information.

#### Moving Raster Files into Memory:

In the '.ras File(s)' scroll window, select the raster file that is to
be ordered first in memory by moving the pointer over the raster file
name and clicking the left mouse button. Then select raster files 2, 3,
etc. in the same manner. (The order of raster files in memory is
designated by a '1', '2', '3', etc. that is prepended to each raster
file name). To remove a raster file from the sequence list, reselect the
raster file name; the prepending number will be removed and the list
will reorder itself. After selecting the desired files, press the green
'Move Image(s) from .ras File(s) to Memory' button to move the raster
file images into memory.

#### Reading Images from Memory or from Raster Files:

If images are saved in memory or raster file images are moved into
memory, the 'Read Images from:' toggle is automatically set to 'Memory'.
To read images from raster files, select the files to be animated in the
'.ras File(s)' scroll window, and set the 'Read Images from:' toggle to
'.ras File(s)'.

#### Setting the Animation Colormap:

If the 'Use Colormap from:' toggle is set to 'VCS', then VCS controls
the colormap. In this state, the Colormap Editor/Table Panel can be
accessed, and color indices can be modified while animation is
proceeding. If instead the 'Use Colormap from:' toggle is set to 'Raster
Images', then the colormap stored with each image is used.

#### Setting the Animation Mode:

If the 'Animation Mode:' is set to 'Cycle', then the sequence of images
will be repeated regularly, as in a loop. If the 'Animation Mode:' is
set to 'Once', then each image is displayed after animation stops. If
the 'Animation Mode:' is set to 'Forth and Back', animation proceeds to
the end of the sequence of images, and then reverses direction.

#### Running or Stopping Animation:

Once the images are loaded into memory or the raster files containing
images are chosen (see above), the user can select the 'Read Images
from:' toggle to be either 'Memory' or '.ras File(s)'. Then select the
cyan 'Run Animation' button to start the animation. To stop the
animation, select the orange 'Stop Animation' button.

#### Zooming in on Animation:

There are several ways to zoom in on an animation: move the 'Animation
Zoom' slider, or select the 'Animation Zoom' up and down arrows, or
enter a higher magnification number into the 'Animation Zoom' input text
window. (The maximum allowed magnification number is 20 and the minimum
is 1.)

#### Panning an Animation:

There are several ways to pan an animation in the horizontal or vertical
direction: move the appropriate 'Pan Horizontal/Vertical' slider, or
push the 'Pan Horizontal/Vertical' up and down arrows, or enter the
desired number into the 'Pan Horizontal/Vertical' input text window.
(The maximum allowed pan number is 100 and the minimum is -100.)

#### Controlling Animation Position, Delay, and Speed:

The 'Animation Position' input text window shows the image frame that is
being displayed. If animation is stopped, the 'Animation Position'
slider can be moved or the 'Animation Position' up and down arrow
buttons can be selected to view a particular frame. The animation speed
is controlled by the 'Animation Delay' slider or up/down arrow buttons:
the higher the delay number, the slower the speed. The 'Animation Speed'
indicator shows the number of frames being viewed per second.

#### Changing the Animation Directory:

Type the desired directory in the 'Directory' input text window, and
press the 'Return' or 'Enter' key to register the end of typing. The
'Sub_Dir' scroll window, and possibly also the '.ras File(s)' scroll
window, will change. (If the specified directory does not exist, the
current directory will reappear.) The directory can also be changed by
moving the pointer over a directory name in the 'Sub_Directory' scroll
window and clicking the left mouse button.

#### Synchronizing Two or More VCS Canvases:

The VCS module can display up to eight VCS Canvases on the screen at one
time. Thus, there can be up to eight Animation Control Panels displayed
and individually animating in the associated VCS Canvas. To synchronize
two or more animations (that is, to control all animations from a single
Animation Control Panel) select the 'Sync' toggle button located in the
upper right corner of any Animation Control Panel. This action will
cause all animations to display the same frame position in synchronous
fashion. To undo the synchronization of animation, re-select the 'Sync'
toggle and all the Animation Control Panels will reappear and run
animation under individual control.

### 

![](media/image12.png){width="4.063194444444444in"
height="3.245138888888889in"}

The VCS Canvas is used to display plots, and to create and run animation
in VCS. The Canvas can be visible on the screen in landscape (width
exceeding height), portrait (height exceeding width), user-specified
geometry, or full-screen mode. The default setting is landscape and the
default geometry is 45% of the screen's width and 40% of the screen's
height at x-position 0 and y-position 0.

#### How to Use the VCS Canvas 

#### Displaying the VCS Canvas:

The VCS Canvas can be displayed by entering the **X.open()** command and
depressing the 'Return' key. **X** represents the object's name for the
initialized VCS module (e.g., **X = vcs.init()**, the command that
initialized the VCS module). By design, the VCS Canvas will appear in
the lower left corner of the screen. The user can also display the VCS
Canvas by entering the command **X.plot()**. If the VCS Canvas is not
displayed on the screen, then the plot command will indirectly call the
open command and display the Canvas.

#### Designating Landscape or Portrait Layout:

To view the VCS Canvas in landscape or portrait mode, enter the command
**X.page()** at the command line and depress the 'Return' key. **X**
represents the object's name for the initialized VCS module (e.g., **X =
vcs.init()**, the command that initialized the VCS module). This command
will also restore the Canvas to its default landscape or portrait
geometry and screen position.

#### Setting the Geometry:

The VCS Canvas geometry can be defined before or after it has been
created by entering the command **X.geometry()**. **X** represents the
object's name for the initialized VCS module (e.g., **X = vcs.init()**,
this command initialized the VCS module). The **geometry** command
receives four parameters: width, height, x-position, and y-position.

#### Clearing the VCS Canvas:

To clear the VCS Canvas, enter the command **X.clear()** at the command
line and depress the 'Return' key. **X** represents the object's name
for the initialized VCS module (e.g., **X = vcs.init()**, the command
that initialized the VCS module). All plots displayed on the VCS will be
removed.

#### Closing the VCS Canvas:

The VCS Canvas can be closed by entering the **X.close()** command and
depressing the 'Return' key. X represents the object's name for the
initialized VCS module (e.g., **X = vcs.init()**, the command that
initialized the VCS module). Python will not do the "garbage collection"
on the **X** object until it is reused.

# 

## 

This script is an example of how to concatenate two arrays together

along the given axis.

f=cu.open(\'/pcmdi/psl/psl_bmr.dic\') #open a file

s1=f.getslab(\'psl\',1,1,\':\',\':\') #get a time, lat, lon slab of data

s1.shape #show the shape of the array

s2=f.getslab(\'psl\',2,2,\':\',\':\') #get a time, lat, lon slab of data

s2.shape #show the shape of the array

a=concatenate((s1,s2), 0) #concatenate the 2 arrays along the 0 axis

a.shape #show the shape of the new array

## 

This script is an example of how to regrid one array to another arrays
grid.

It also gives an example of how to mask the data that is being regridded

f=cu.open(\'/pcmdi/sc/psl.rnl_ecm.sc.7901.8812.sfc.ctl\') #open a file

fl=cu.open(\'/pcmdi/gis/DJF1079_88mm.dic\') #open a file

mask=cu.open(\'/pcmdi/sft/sft_gis.dic\') #open a file

mask=mask.getslab(\'sft\') #get a slab of data

s=fl.getslab(\'psl\') #get a slab of data

obs=f.getslab(\'psl\') #get a slab of data

gis=regrid(s,obs) #regrid s to obs grid without masking

x=vcs.init() #initialize VCS

mask2=where(equal(mask,0),1,0) #change the mask

gis2=regrid(s,obs,mask2) #regrid s to obs grid masking on mask2

x.plot(gis,\'AMIP_1of2\') #plot the array

x.plot(gis2,\'AMIP_2of2\') #plot the array

## 

This script calculates the linear trend of a given variable

\# Calculates Linear Trends

\# note script can handle undefined values though

\# this trial data (shown here \"tas\") does not have any undefined

\# values.

\#

\# \*\*\*\* calculated values: \*\*\*\*

\#

\# decadal_trend=gridpoint 10yr trend

\# total_trend=trend of change of the total time period

\# znltrnd=zonally averaged decadal_trend-(above)

\#

\# file possesses anomalies of 2meter height temperature

\#

\# \*\*\*\* \*\*\*\*

\#

file=\'/pcmdi/tmp2/hnilo/mo.tas.ctl\'

var=\'tas\'

\#

a=cu.open(file)

a.showvariable()

f=a.getslab(var)

\#

\# pull out attributes from file...

\# nt= time steps

\# ny= number of lats

\# nx number of longs

\# undef=specified undefined value

\#

nt=f.getdimattribute(0,\'length\')

ny=f.getdimattribute(1,\'length\')

nx=f.getdimattribute(2,\'length\')

undef=a.getattribute(var,\'missing_value\')

\#

\# start the trend calculations this can handle

\# undefined values (as undef from above)

\#

sm=0.

sxoss=zeros(\[ny,nx\],Float16)

smy=zeros(\[ny,nx\],Float16)

sm=zeros(\[ny,nx\],Float16)

c=zeros(\[nt\],Float16)

smy.missing_value=undef

sm.missing_value=undef

an=where(equal(f,undef),0.0,f)

\#

\# set up an array of \"time interval maps\"

\# the first zero the next 1 etc. through 0-\>nt.

\#

ad2=zeros(\[nt,ny,nx\],Float16)

ad2\[0,:,:\]=0.

for i in range(1,nt):

ad2\[i,:,:\]=ad2\[i-1,:,:\] +1.0

\# set the undefineds values from original array to to zero and the

\# defined to their time number-from above\--put into array \"tr\"

\#

tr=where(equal(f,undef),0.0,ad2)

\#

\# add up all the defined values over all time

\# steps (by grid point)

\#

tr2=avg.count(f)

\#

\# if the number of points used in the trend calc

\# is less than (nt/3)\--or 1/3 of the original obs

\# else set to undefined

\#

num=(nt/3)

cutoff=where(less(tr2,num),undef,1.0)

\#

for i in range(0,nt):

c\[i\]=i

sm\[:,:\]=sm\[:,:\]+tr\[i,:,:\]

smy=smy+an\[i,:,:\]

sxoss\[:,:\]=sm\[:,:\]/tr2\[:,:\]

\#

b=zeros(\[ny,nx\],Float16)

tt=zeros(\[ny,nx\],Float16)

st2=zeros(\[ny,nx\],Float16)

\#

b.missing_value=undef

tt.missing_value=undef

st2.missing_value=undef

f.missing_value=undef

\#

\# a multiplier array to delete the calc when

\# values are not present-(e.g. they are undefined)

\#

spt1=where(equal(f,undef),0.0,1.0)

\#

for i in range(0,nt):

\#

tt\[:,:\]=c\[i\]-sxoss\[:,:\]

st2\[:,:\]=st2\[:,:\]+tt\[:,:\]\*tt\[:,:\]\*spt1\[i,:,:\]

tt\[:,:\]=tt\[:,:\]\*spt1\[i,:,:\]

b\[:,:\]=b\[:,:\]+tt\[:,:\]\*an\[i,:,:\]

\# the slope is the value of b

b\[:,:\]=b\[:,:\]/st2\[:,:\]

b\[:,:\]=multiply(b\[:,:\],cutoff\[:,:\])

\#

\# set up trend arrays

\#

decadal_trend=zeros(\[ny,nx\],Float16)

total_trend=zeros(\[ny,nx\],Float16)

b.missing_value=undef

\#

total_trend=b\[:,:\]\*(nt\*1.0)

decadal_trend=b\[:,:\]\*120.

\#

\# add the appropriate dimensions to the arrays

\# (e.g., lat lon)

\#

mask=a.getslab(var,0,0,\':\',\':\')

mask=add.reduce(mask)

copydimensions(mask,total_trend)

copydimensions(mask,decadal_trend)

\#

\# zonal trends

\#

znltrnd=zeros(\[nt,ny,nx\],Float16)

znltrnd.missing_value=undef

decadal_trend.missing_value=undef

znltrnd=avg.reduce(decadal_trend,1)

\#

x=vcs.init()

x.plot(decadal_trend)

## 

This script calculates the gridpoint variance and standard deviation

\#

\# Calculates gridpoint variance and standard deviation

\# from an anomaly array

\#

\# \*\*\*\* calculated values: \*\*\*\*

\#

\# variance=gridpoint variance

\# stdeviation=gridpoint standard deviattion

\#

\# file possesses anomalies of 2meter height temperature

\#

\# \*\*\*\* \*\*\*\*

\#

file=\'/pcmdi/tmp2/hnilo/mo.tas.ctl\'

var=\'tas\'

\#

a=cu.open(file)

a.showvariable()

f=a.getslab(var)

\#

\# pull out attributes from file\...

\# ny= number of lats

\# nx number of longs

\# undef=specified undefined value

\#

ny=f.getdimattribute(1,\'length\')

nx=f.getdimattribute(2,\'length\')

undef=a.getattribute(var,\'missing_value\')

\#

\# Start the statistical calculations

\# They are done for the entire time period

\#

ansq=zeros(\[nt,ny,nx\],Float16)

defined_pts=zeros(\[ny,nx\],Float16)

variance=zeros(\[ny,nx\],Float16)

variance_count=zeros(\[ny,nx\],Float16)

\#

an.missing_value=undef

variance.missing_value=undef

variance_count.missing_value=undef

ansq.missing_value=undef

defined_pts.missing_value=undef

\#

ansq=multiply(f,f)

variance_count=avg.count(ansq)

variance=avg.reduce(ansq)

defined_pts=avg.count(f)

\#

\# if the sum of the number of defined values is

\# zero then set to undefined

\# below it is an array of ones and undefined that is

\# multiplied with the variance array

\#

defined_pts=where(equal(defined_pts,0.),undef,1.0)

variance=multiply(variance,defined_pts)

\#

\# multiply back on the number of obs and subtract 1 from that

\# and divide by the new number

\#

variance=variance\*variance_count

div=1.0\*(variance_count-1.0)

variance=divide(variance,div)

\#

variance.missing_value=undef

stdeviation=sqrt(variance)

\#

mask=a.getslab(var,0,0,\':\',\':\')

mask=add.reduce(mask)

copydimensions(mask,stdeviation)

copydimensions(mask,variance)

\#

# 

1\) [Different ways to run CDAT:]{.underline}

a\) On command line type: cdat

b\) On command line type: cdatgui

#!/usr/local/bin/cdat

from cdat_init import \*

must be the first line in the .py file and the file must be executable

c\) from command line type: example.py

d\) from CDAT type: import example

e\) from CDATGUI type: import example

2\) ["error xcreate font" or crash when plotting]{.underline}

The environment path to the fontdb directory is not set correctly

3\) [When doing any computation on arrays the new array loses the
dimension attributes of the original array.]{.underline}

Must do a copydimension or copydimensions to restore the dimension
attributes.

4\) [The VCS command setminmax:]{.underline}

Only works with the following graphic methods: boxfill

5\) [The Numeric command convolve]{.underline}:

Only works with 1D arrays

6\) [Missing Value]{.underline}

The default missing value is set in a file called Missing.py. The value
is set to 1e20, the

Missing.Value is a double. The user can change the global missing value
by importing Missing

and setting the Missing.Value

Example:

import Missing

Missing.value = -999

The gloabal missing value means that all newly created arrays will have
the attribute

missing_value set to Missing.Value. If the array was created from
getslab and already has a

missing_value attribute, then that array's missing value is used and NOT
the default

Missing.Value

7\) [When a closing ) is left off the end of a command]{.underline}

CDAT goes into shell mode, to exit from shell mode type the closing )
followed by a return.

# 

## 

### 

The CDUNIF module is designed to provide access to different file
formats. The module contains routines to get information and data from a
file. To use the cdunif module in CDAT, **type: import cu**

+------------------+----------------------+---------------------------+
| **Command**      | **Description**      | **Examples**              |
+------------------+----------------------+---------------------------+
| cu.              | Creates a file       | f=cu.open(\'/p            |
| open('filename') | object and opens the | cmdi/mrso/mrso_bmr.dic\') |
|                  | file through cdunif. |                           |
|                  | *f* becomes the      |                           |
|                  | cdunif file object.  |                           |
|                  | filename is the name |                           |
|                  | of the file that is  |                           |
|                  | to be opened.        |                           |
+------------------+----------------------+---------------------------+
| f.listall        | Returns a Python     | f=cu.open(\'/p            |
| (\['variable'\]) | list of the          | cmdi/mrso/mrso_bmr.dic\') |
|                  | description of a     |                           |
|                  | variable.            | descri                    |
|                  |                      | ption=f.listall(\'mrso\') |
|                  |                      |                           |
|                  |                      | description               |
+------------------+----------------------+---------------------------+
| f.listattribute  | Returns a python     | f=cu.open(\'/p            |
| (\['variable'\]) | list of the          | cmdi/mrso/mrso_bmr.dic\') |
|                  | attributes           |                           |
|                  | associated with a    | atts=                     |
|                  | variable contained   | f.listattribute(\'mrso\') |
|                  | in the cdunif file   |                           |
|                  | object.              | atts                      |
+------------------+----------------------+---------------------------+
| f.listdimension  | Returns a python     | f=cu.open(\'/p            |
| (\['variable'\]) | list of the          | cmdi/mrso/mrso_bmr.dic\') |
|                  | dimensions           |                           |
|                  | associated with a    | dims=                     |
|                  | variable contained   | f.listdimension(\'mrso\') |
|                  | in the cdunif file   |                           |
|                  | object.              | dims                      |
+------------------+----------------------+---------------------------+
| f.listglobal()   | Returns a python     | f=cu.open(\'/p            |
|                  | list of the global   | cmdi/mrso/mrso_bmr.dic\') |
|                  |                      |                           |
|                  | attributes           | globals=f.listglobal()    |
|                  | associated with a    |                           |
|                  | cdunif file object.  | globals                   |
+------------------+----------------------+---------------------------+
| f.listvariable() | Returns a python     | f=cu.open(\'/p            |
|                  | list of the          | cmdi/mrso/mrso_bmr.dic\') |
|                  | variables contained  |                           |
|                  | in the cdunif file   | vars=f.listvariable()     |
|                  | object.              | vars                      |
+------------------+----------------------+---------------------------+
| f.s              | Shows a description  | f=cu.open(\'/p            |
| howall(\['variab | of a variable. The   | cmdi/mrso/mrso_bmr.dic\') |
| le'\],\['all'\]) | parameter 'all' is   |                           |
|                  | optional; if it is   | f.showvariable()          |
|                  | passed to the        |                           |
|                  | command, a full      | f.showall(\'mrso\')       |
|                  | listing of the       |                           |
|                  | dimension values for | f.                        |
|                  | each dimension is    | showall(\'mrso\',\'all\') |
|                  | provided.            |                           |
+------------------+----------------------+---------------------------+
| f.showattribute  | Shows the attributes | f=cu.open(\'/p            |
| (\['variable'\]) | associated with a    | cmdi/mrso/mrso_bmr.dic\') |
|                  | variable contained   |                           |
|                  | in the cdunif file   | f.showattribute(\'mrso\') |
|                  | object.              |                           |
+------------------+----------------------+---------------------------+
| f.showdimension  | Shows the dimensions | f=cu.open(\'/p            |
| (\['variable'\]) | associated with a    | cmdi/mrso/mrso_bmr.dic\') |
|                  | variable contained   |                           |
|                  | in the cdunif file   | f.showdimension(\'mrso\') |
|                  | object.              |                           |
+------------------+----------------------+---------------------------+
| f.showglobal()   | Shows the global     | f=cu.open(\'/p            |
|                  | attributes           | cmdi/mrso/mrso_bmr.dic\') |
|                  | associated with a    |                           |
|                  | cdunif file object.  | f.showglobal()            |
+------------------+----------------------+---------------------------+
| f.showvariable() | Shows the variables  | f=cu.open(\'/p            |
|                  | contained in the     | cmdi/mrso/mrso_bmr.dic\') |
|                  | cdunif file object.  |                           |
|                  |                      | f.showvariable()          |
+------------------+----------------------+---------------------------+

+-----------------+-----------------------+---------------------------+
| f.defaultvaria  | Sets a default        | f=cu.open(\'/p            |
| ble('variable') | variable for the      | cmdi/mrso/mrso_bmr.dic\') |
|                 | cdunif file object.   |                           |
|                 | *f* is the file       | f.showvariable()          |
|                 | object, and           |                           |
|                 | 'variable' is the     | f.                        |
|                 | variable that is to   | defaultvariable(\'mrso\') |
|                 | beused as the default |                           |
|                 | variable for f. If    |                           |
|                 | the default variable  |                           |
|                 | is set for a file and |                           |
|                 | the user wants to     |                           |
|                 | work with that        |                           |
|                 | variable, the         |                           |
|                 | variable does not     |                           |
|                 | have to be sent to    |                           |
|                 | routines requiring a  |                           |
|                 | variable parameter.   |                           |
|                 | The following         |                           |
|                 | routines work with    |                           |
|                 | the default variable: |                           |
|                 | listall,              |                           |
|                 | listattribute,        |                           |
|                 | showall, and          |                           |
|                 | showattribute.        |                           |
+-----------------+-----------------------+---------------------------+
| f               | Clears the default    | f.cleardefault()          |
| .cleardefault() | variable for the      |                           |
|                 |                       |                           |
|                 | selected file object  |                           |
+-----------------+-----------------------+---------------------------+
| cu.dimensio     | Creates a dimension   | lat=                      |
| nrange(first_va | object.               | cu.dimensionrange(-50,50) |
| lue,last_value) |                       |                           |
|                 | 'first_value' is the  |                           |
|                 | value that is to be   |                           |
|                 |                       |                           |
|                 | used, and             |                           |
|                 | 'last_value' is the   |                           |
|                 | last value to be      |                           |
|                 | used.                 |                           |
+-----------------+-----------------------+---------------------------+
| f.di            | Returns a Python      | f=cu.open(\'/p            |
| mensionarray('d | array object          | cmdi/mrso/mrso_bmr.dic\') |
| imension_name', | containing the values |                           |
| \['variable'\]) | for the dimension     | f.showdimension('mrso')   |
|                 | that was passed into  |                           |
|                 | the                   | lat=f.dim                 |
|                 |                       | ensionarray(\'latitude\') |
|                 | routine. To return a  |                           |
|                 | Python list, add      | lat                       |
|                 |                       |                           |
|                 | **.tolist()** to the  | lat=f.dimensionarr        |
|                 | end of the routine.   | ay(\'latitude\').tolist() |
|                 |                       |                           |
|                 |                       | lat                       |
+-----------------+-----------------------+---------------------------+
| f.getatt        | Returns an attribute  | f=cu.open(\'/p            |
| ribute('variabl | associated with a     | cmdi/mrso/mrso_bmr.dic\') |
| e','attribute') |                       |                           |
|                 | variable in a cdunif  | f.showvariable()          |
|                 | file object.          |                           |
|                 |                       | f.showattribute(\'mrso\') |
|                 | 'variable' is the     |                           |
|                 | variable name, and    | f.getattr                 |
|                 |                       | ibute(\'mrso\',\'title\') |
|                 | 'attribute' is the    |                           |
|                 | name of the desired   | title=f.getattr           |
|                 |                       | ibute(\'mrso\',\'title\') |
|                 | attribute to be       |                           |
|                 | returned.             | title                     |
+-----------------+-----------------------+---------------------------+
| f.getdimension  | Returns the dimension | f=cu.open(\'/p            |
| unit('dimname', | units from a file or  | cmdi/mrso/mrso_bmr.dic\') |
|                 | those associated with |                           |
| \['variable'\]) | a variable contained  | f.getd                    |
|                 | in a file.            | imensionunits('latitude') |
+-----------------+-----------------------+---------------------------+
| f.getglob       | Returns a global      | f=cu.open('/              |
| al('attribute') | attribute associated  | pcmdi/mrso/mrso_bmr.dic') |
|                 |                       |                           |
|                 | with the cdunif file  | f.showglobal()            |
|                 | object. 'attribute'   |                           |
|                 | is the name of the    | f.getglobal(\'format\')   |
|                 | global attribute that |                           |
|                 | is to be returned.    | forma                     |
|                 |                       | t=f.getglobal(\'format\') |
|                 |                       |                           |
|                 |                       | format                    |
+-----------------+-----------------------+---------------------------+
| f.getslab('v    | Returns a slab, which | f=cu.open(\'/p            |
| ariable',\[dim1 | is a Python array     | cmdi/mrso/mrso_bmr.dic\') |
| \],...\[dimN\]) | object. All           |                           |
|                 | parameters are        | f.showvariable()          |
|                 | optional except the   |                           |
|                 | variable. The         | s=f.getslab(\'mrso\')     |
|                 | remaining parameters  |                           |
|                 | can be either ints,   | s.shape                   |
|                 | float, wild cards, or |                           |
|                 | dimension objects.    | s1=f.getslab(             |
|                 |                       | \'mrso\',3,3,\':\',\':\') |
|                 | NOTE: the dimensions  |                           |
|                 | are in C              | s1.shape                  |
|                 | order,(time,lat,lon)  |                           |
|                 |                       | t                         |
|                 |                       | me=cu.dimensionrange(5,5) |
|                 |                       |                           |
|                 |                       | lat=                      |
|                 |                       | cu.dimensionrange(-50,50) |
|                 |                       |                           |
|                 |                       | lon=cu                    |
|                 |                       | .dimensionrange(-180,180) |
|                 |                       |                           |
|                 |                       | s2=f.gets                 |
|                 |                       | lab(\'mrso\',tme,lat,lon) |
|                 |                       |                           |
|                 |                       | s2.shape                  |
+-----------------+-----------------------+---------------------------+

###  

The CDTIME module is designed to provide access to different CDMS time
functions. To use the cdtime module in

CDAT, **type: import cdtime**

+------------------+-----------------------+---------------------------+
| **Command**      | **Description**       | **Examples**              |
+------------------+-----------------------+---------------------------+
| add(value,       | Adds an interval to a | from cdtime import \*     |
| intervalUnits,   | time value,           |                           |
|                  |                       | c = componenttime(1996,   |
| calendar=cdtime. | where value = number  | 2, 28)                    |
| DefaultCalendar) | of interval           |                           |
|                  |                       | r = relativetime(28,      |
|                  | units                 | "days since 1996-1-1")    |
|                  | (floating-point),     |                           |
|                  | intervalUnits         | print r.add(1, Days)      |
|                  |                       |                           |
|                  | = Year(s) \|          | print c.add(36, Hour)     |
|                  | Season(s) \| Month(s) |                           |
|                  | \|                    |                           |
|                  |                       |                           |
|                  | Week(s) \| Day(s) \|  |                           |
|                  | Minute(s) \|          |                           |
|                  |                       |                           |
|                  | Second(s) calendar =  |                           |
|                  | calendar              |                           |
|                  |                       |                           |
|                  | argument.             |                           |
+------------------+-----------------------+---------------------------+
| cmp(t2,          | Compares time values, | from cdtime import \*     |
| calendar=cdtime. | where t2 =            |                           |
| DefaultCalendar) |                       | c = componenttime(1996,   |
|                  | relative or component | 2, 28)                    |
|                  | time, calendar        |                           |
|                  |                       | r = relativetime(28,      |
|                  | = calendar argument.  | "days since 1996-1-1")    |
|                  |                       |                           |
|                  |                       | print r.cmp(c)            |
|                  |                       |                           |
|                  |                       | print c.cmp(r)            |
|                  |                       |                           |
|                  |                       | print r.cmp(r)            |
+------------------+-----------------------+---------------------------+
| com              | Returns a component   | from cdtime import \*     |
| ponenttime(year, | time object,          |                           |
| month=1, day=1,  |                       | c = componenttime(1996,   |
| hour=0,          | with year(integer),   | 2, 28)                    |
| minute=0,        | month(integer,        |                           |
| seconds=0)       |                       |                           |
|                  | 1..12), day(integer,  |                           |
|                  | 1..31),               |                           |
|                  |                       |                           |
|                  | hour(integer,         |                           |
|                  | 1                     |                           |
|                  | ..31),minute(integer, |                           |
|                  |                       |                           |
|                  | 0..59),               |                           |
|                  | s                     |                           |
|                  | econd(floating-point, |                           |
|                  | in the                |                           |
|                  |                       |                           |
|                  | interval              |                           |
|                  | \[0.0,60.0\])         |                           |
+------------------+-----------------------+---------------------------+
| rel              | Returns a relative    | from cdtime import \*     |
| ativetime(value, | time object, with     |                           |
| units)           |                       | r = relativetime(28,      |
|                  | v                     | "days since 1996-1-1")    |
|                  | alue(floating-point), |                           |
|                  | units(string)         |                           |
|                  |                       |                           |
|                  | units=second \|       |                           |
|                  | minute \| hour \| day |                           |
|                  | \|                    |                           |
|                  |                       |                           |
|                  | week \| month \|      |                           |
|                  | season \| year        |                           |
+------------------+-----------------------+---------------------------+
| sub(value,       | Subtracts an interval | from cdtime import \*     |
| intervalUnits,   | from a time           |                           |
|                  |                       | c = componenttime(1996,   |
| calendar=cdtime. | value, where value =  | 2, 28)                    |
| DefaultCalendar) | number of             |                           |
|                  |                       | r = relativetime(28,      |
|                  | interval units        | "days since 1996-1-1")    |
|                  | (floating-point),     |                           |
|                  |                       | print r.sub(10, Days)     |
|                  | intervalUnits =       |                           |
|                  | Year(s) \| Season(s)  | print c.sub(30, Days)     |
|                  | \|                    |                           |
|                  |                       |                           |
|                  | Month(s) \| Week(s)   |                           |
|                  | \| Day(s) \|          |                           |
|                  |                       |                           |
|                  | Minute(s) \|          |                           |
|                  | Second(s) calendar =  |                           |
|                  |                       |                           |
|                  | calendar argument     |                           |
+------------------+-----------------------+---------------------------+
| toco             | Converts to component | from cdtime import \*     |
| mponent(calendar | time, from            |                           |
| =                |                       | r = relativetime(28,      |
|                  | relative or component | "days since 1996-1-1")    |
| cdtime.          | time, where           |                           |
| DefaultCalendar) |                       | r.tocomponent()           |
|                  | calendar = calendar   |                           |
|                  | argument              |                           |
+------------------+-----------------------+---------------------------+
| t                | Convert to relative   | from cdtime import \*     |
| orelative(units, | time, from            |                           |
| calendar =       |                       | c = componenttime(1996,   |
|                  | relative or component | 2, 28)                    |
| cdtime.          | time, where           |                           |
| DefaultCalendar) |                       | c.torelative("days since  |
|                  | units = basetime of   | 1996-1-1")                |
|                  | result, calendar      |                           |
|                  |                       |                           |
|                  | = calendar argument   |                           |
+------------------+-----------------------+---------------------------+

### 

The LATS functions are designed to provide access to the LATS library of
I/O functions for creating lon/lat gridded datasets in the GRIB and/or
the netCDF format. To use the lats module in CDA**T, type: import lats**

+------------------+-----------------------+---------------------------+
| **Command**      | **Description**       | **Examples**              |
+------------------+-----------------------+---------------------------+
| latsfile.close() | Closes a LATS file    | import lats               |
|                  |                       |                           |
|                  |                       | basetime =                |
|                  |                       | cdt                       |
|                  |                       | ime.relativetime(0,'hours |
|                  |                       | since                     |
|                  |                       |                           |
|                  |                       | 1978-12-30')              |
|                  |                       |                           |
|                  |                       | latsfile =                |
|                  |                       | lats.LatsFile('test.nc',  |
|                  |                       | lats.Coards,              |
|                  |                       |                           |
|                  |                       | lats.Standard,            |
|                  |                       | lats.Hourly, 6, basetime, |
|                  |                       | 'pcmdi',                  |
|                  |                       |                           |
|                  |                       | 'test.py', 'LATS test')   |
|                  |                       |                           |
|                  |                       | latsfile.close()          |
+------------------+-----------------------+---------------------------+
| create           | Creates a variable    | import lats               |
| variable('name', | associated with a     |                           |
|                  | file, where name =    | basetime =                |
| stat, grid,      | variable name, stat = | cdt                       |
|                  | statistic, grid =     | ime.relativetime(0,'hours |
| \                | LatsGrid object,      | since 1978-12-30')        |
| [vertdim=None\], | verdim = LatsVertDim  |                           |
|                  | object,               | latsfile =                |
| \                |                       | lats.LatsFile('test.nc',  |
| [missing=None\], | missing = missing     | lats.Coards,              |
|                  | data value, delta =   |                           |
| \[delta=None\],  | missing value fudge   | lats.Standard,            |
|                  | factor                | lats.Hourly, 6, basetime, |
| \['commenst'\])  |                       | 'pcmdi', 'test.py',       |
|                  |                       |                           |
|                  |                       | grid=                     |
|                  |                       | lats.LatsGrid('T21',      |
|                  |                       | lats.Gaussian,            |
|                  |                       |                           |
|                  |                       | londim, latdim)           |
|                  |                       |                           |
|                  |                       | sfc =                     |
|                  |                       | lats.LatsVer              |
|                  |                       | ticalDimension('surface', |
|                  |                       |                           |
|                  |                       | 'sfc',                    |
|                  |                       | Numeric.array(\[0.0\]))   |
|                  |                       |                           |
|                  |                       | pr =                      |
|                  |                       | lats                      |
|                  |                       | file.createvariable('pr', |
|                  |                       | lats.Instant, grid, sfc,  |
|                  |                       | 1.0e20)                   |
+------------------+-----------------------+---------------------------+
| del              | Deletes memory for a  | import lats               |
|                  | grid or a vertical    |                           |
|                  | dimension.            | grid=                     |
|                  |                       | lats.LatsGrid('T21',      |
|                  |                       | lats.Gaussian,            |
|                  |                       |                           |
|                  |                       | londim, latdim)           |
|                  |                       |                           |
|                  |                       | del grid                  |
+------------------+-----------------------+---------------------------+
| len(object)      | Returns number of     | import lats               |
|                  | zones in grid if      |                           |
|                  | 'object' is LatsGrid  | grid=                     |
|                  | object, or number of  | lats.LatsGrid('T21',      |
|                  | levels; if 'object'   | lats.Gaussian,            |
|                  | is                    |                           |
|                  |                       | londim, latdim)           |
|                  | LatsVertDim object.   |                           |
|                  |                       | n = len(grid)             |
+------------------+-----------------------+---------------------------+
| lats.            | Creates a LATS file,  | import lats, cdtime       |
| LatsFile('path', | where path = file     |                           |
|                  | path, convention =    | basetime =                |
| convention,      | file convenetion,     | cdt                       |
| calendar,        | calendar = LATS       | ime.relativetime(0,'hours |
|                  |                       | since 1978-12-30')        |
| frequency,       | calendar, frequency = |                           |
| delta, basetime, | time frequency, delta | latsfile =                |
|                  | = time delta,         | lats.LatsFile('test.nc',  |
| 'center',        | basetime = file       | lats.Coards,              |
| 'model',         | basetime (relative or |                           |
|                  |                       | lats.Standard,            |
| 'comments')      | component), center =  | lats.Hourly, 6, basetime, |
|                  | modeling center,      | 'pcmdi', 'test.py', 'LATS |
|                  | model = name of model | test')                    |
|                  | which created the     |                           |
|                  | data                  |                           |
+------------------+-----------------------+---------------------------+
| lats.            | Creates a LATS grid,  | import lats               |
| LatsGrid('name', | where name = grid     |                           |
|                  | name, gridtype = grid | grid=                     |
| gridtype, lons,  | type, lons =          | lats.LatsGrid('T21',      |
| lats)            | longitude array, lats | lats.Gaussian,            |
|                  | = latitude array      |                           |
|                  |                       | londim, latdim)           |
+------------------+-----------------------+---------------------------+
| lats.LatsV       | Creates a LATS        | import lats               |
| erticalDimension | vertical dimension,   |                           |
|                  | where name =          | sfc =                     |
| ('name',         | dimension name,       | lats.LatsVer              |
| verttype, levs)  | verttype = dimension  | ticalDimension('surface', |
|                  | type, levs            | 'sfc',                    |
|                  |                       |                           |
|                  | = level values        | Numeric.array(\[0.0\]))   |
+------------------+-----------------------+---------------------------+

+------------------+-----------------------+---------------------------+
| **Command**      | **Description**       | **Examples**              |
+------------------+-----------------------+---------------------------+
| readp            | Reads a parameter     | import lats               |
| arameter('path') | file. This function   |                           |
|                  | does not set the      | parmtab =                 |
|                  | parameter file to the | lats.re                   |
|                  | default.              | adparameter('test.parms') |
+------------------+-----------------------+---------------------------+
| setparamete      | Sets the default      | import lats               |
| rdefault('path') | parameter table. This |                           |
|                  | function is optional; | parmtab =                 |
|                  | if it is not called,  | lats.setparam             |
|                  | the default parameter | eterdefault('test.parms') |
|                  | filepath is taken     |                           |
|                  | from environment      |                           |
|                  | variable              |                           |
|                  |                       |                           |
|                  | LATS_PARMS.           |                           |
+------------------+-----------------------+---------------------------+
| write(time,      | Writes a 2-D data     | import lats, cdtime       |
| field,           | field, for a given    |                           |
|                  | time and level        | time =                    |
| \[le             | value.time = time     | cdtime                    |
| velValue=None\]) | associated with the   | .relativetime(36.0,'hours |
|                  | field(relative        | since                     |
|                  |                       |                           |
|                  | or component), field  | 1978-12-30')              |
|                  | = 2-D lon-lat field,  |                           |
|                  | levelValue =          | var.write(time, data)     |
|                  | floating-point level  |                           |
|                  | associated with the   |                           |
|                  | field                 |                           |
+------------------+-----------------------+---------------------------+

### 

The Constructor functions are designed to create array objects. Arrays
can be created from the different by specifying the shape and typecode.

+------------------+-----------------------+---------------------------+
| **Command**      | **Description**       | **Examples**              |
+------------------+-----------------------+---------------------------+
| array(sequence,  | Creates an array      | x,y,z=1,2,3               |
|                  | object from the given |                           |
| typecode=None,   | sequence.             | a=array(\[1,2,3\])        |
| copy=1)          |                       |                           |
|                  |                       | a                         |
|                  |                       |                           |
|                  |                       | b                         |
|                  |                       | =array(\[x,y,z\],Float16) |
|                  |                       |                           |
|                  |                       | b                         |
+------------------+-----------------------+---------------------------+
| arrayrange(s     | Creates an array      | a=arrayrange(10)          |
| tart=0,stop,step | object with specified |                           |
|                  | start, stop, step,    | a                         |
| =                | and typecode.         |                           |
| 1,typecode=None) |                       | a=a                       |
|                  | Note: the **arange**  | rrayrange(0,20,2,Float16) |
|                  | function is           |                           |
|                  | equivalent to         | a                         |
|                  | **arrayrang**e.       |                           |
+------------------+-----------------------+---------------------------+
| fromstring(      | Creates an array      | a=arrayrange(9)           |
| string,typecode) | object formed by the  |                           |
|                  | binary data given in  | a                         |
|                  | the string of the     |                           |
|                  | specified typecode.   | type(a)                   |
+------------------+-----------------------+---------------------------+
| ones(shape,      | Creates an array      | a=ones(\[2,3\],Float16)   |
| typecode=Int)    | object of specified   |                           |
|                  | shape and typecode    | a                         |
|                  | filled with ones.     |                           |
+------------------+-----------------------+---------------------------+
| zeros(shape,     | Creates an array      | a=zeros(\[3,3\])          |
| typecode=Int)    | object of specified   |                           |
|                  | shape and typecode    | a                         |
|                  | filled with zeros.    |                           |
+------------------+-----------------------+---------------------------+

### 

The Convenience functions are designed to create array object**s.**

+----------------+----------------------------------+-----------------+
| **Command**    | **Description**                  | **Examples**    |
+----------------+----------------------------------+-----------------+
| arange(size)   | A slightly more subtle utility   | a=arange(10)    |
|                | function is the **arange**       |                 |
|                | function, which is analogous to  | from 0 up to 10 |
|                | the **range()** function in      |                 |
|                | Python, except that it returns   | a               |
|                | an array as opposed to a list.   |                 |
|                | The returned array will always   |                 |
|                | be of type **long (Int32**). For |                 |
|                | greater flexibility in defining  |                 |
|                | the array size, values, and      |                 |
|                | typecode use **arrayrang**e.     |                 |
+----------------+----------------------------------+-----------------+
| asarray(a,     | This is not necessarily a        | a=identity(4)   |
|                | constructor. If its argument is  |                 |
| typecode=None) | an array of the right type, that | a               |
|                | argument is returned. If its     |                 |
|                | argument is anything else, it    | b=asa           |
|                | will be passed to **array(a,     | rray(a,Float16) |
|                | typecode**). In a function, this |                 |
|                | is a handy way to ensure having  | b               |
|                | an array without doing any       |                 |
|                | unnecessary copying.             |                 |
+----------------+----------------------------------+-----------------+
| ch             | This function will return an     | f=cu            |
| angemissing(a, | array object with the user       | .open('clt.nc') |
|                |                                  |                 |
| new_miss       | specified missing value. Upon    | s=f             |
| ing_value=1.0e | return, the missing_value        | .getslab('clt') |
| 20)            | attribute is set to the new      |                 |
|                | missing value and the            | b=c             |
|                | appropriate data values are set  | hangemissing(s, |
|                | to the new missing value. If the | -999.)          |
|                | new_missing_value parameter is   |                 |
|                | unset, then                      |                 |
|                |                                  |                 |
|                | 1.0e20 is used.                  |                 |
+----------------+----------------------------------+-----------------+
| copydim        | This function copies the         | f=cu.ope        |
| ension(source, | dimension(s) of the source into  | n('/pcmdi/mrso/ |
|                |                                  | mrso_bmr.dic\') |
| source_dim,    | the dimension(s) of the          |                 |
| destination,   | destination. If shape is not     | s=f.            |
|                |                                  | getslab('mrso') |
| de             | defined, then all possible       |                 |
| stination_dim) | dimensions are copied. Shae      | s.shape         |
|                |                                  |                 |
|                | can be a single integer or a     | a=s\[:,:,0,0\]  |
|                | tuple of integers.               |                 |
|                |                                  | copy            |
|                |                                  | dimensions(s,a) |
|                |                                  |                 |
|                |                                  | copydi          |
|                |                                  | mensions(s,a,1) |
|                |                                  |                 |
|                |                                  | copydimens      |
|                |                                  | ions(s,a,(0,1)) |
+----------------+----------------------------------+-----------------+
| fromfunc       | Creates an array object of the   | def             |
| tion(function, | given shape, where               | myfunc(x,y):    |
|                |                                  |                 |
| shape)         | 'function' is called on the      | return (x+2+y)  |
|                | indices of the array.            |                 |
|                |                                  | m=fromfunctio   |
|                |                                  | n(myfunc,(5,5)) |
+----------------+----------------------------------+-----------------+
| identity(n)    | Creates an n-x-n identity        | a=identity(4)   |
|                | matrix.                          |                 |
|                |                                  | a               |
+----------------+----------------------------------+-----------------+
| indices(shape) | Creates an array object of the   | a=ind           |
|                | indices for the array of the     | ices(\[2,3,4\]) |
|                |                                  |                 |
|                | specified shape.                 | a               |
+----------------+----------------------------------+-----------------+
| Missing.value  | This function allows the user to | import Missing  |
|                | change the global                |                 |
|                |                                  | Missing.value = |
|                | missing value by importing       | -999            |
|                | 'Missing' and setting the        |                 |
|                |                                  |                 |
|                | 'Missing.value'. The global      |                 |
|                | missing value means that all     |                 |
|                |                                  |                 |
|                | newly created arrays will have   |                 |
|                | the attribute                    |                 |
|                |                                  |                 |
|                | missing_value set to             |                 |
|                | Missing.value. The default       |                 |
|                | missing                          |                 |
|                |                                  |                 |
|                | value is set to 1e20.            |                 |
|                | Missing.value works for all the  |                 |
|                |                                  |                 |
|                | typecodes. Missing.value also    |                 |
|                | works with the following         |                 |
|                |                                  |                 |
|                | Ufuncs: 'add', 'subtract',       |                 |
|                | 'multipy', 'divide',             |                 |
|                |                                  |                 |
|                | 'remainder', 'power', 'maximum', |                 |
|                | 'minimum', and                   |                 |
|                |                                  |                 |
|                | 'avg'.                           |                 |
+----------------+----------------------------------+-----------------+

###  

The OPERATIONS functions are designed to provide access to different
operations for redefining an array object.

+------------+------------------------------+--------------------------+
| *          | **Description**              | **Examples**             |
| *Command** |                              |                          |
+------------+------------------------------+--------------------------+
| choose(a,  | *a* is an array object of    | a=array                  |
| (b0, b1,   | integers between 0 and n.    | ((1,2,3,4,5,6,7,8,9,10)) |
| \..., bn)) | The resulting array will     |                          |
|            | have the same shape as a,    | a                        |
|            | with element selected from   |                          |
|            | b0, \..., bn, as indicated   | d=0,3,8                  |
|            | by the value of the          |                          |
|            | corresponding element in a.  | d                        |
|            |                              |                          |
|            |                              | c=choose(d,a)            |
|            |                              |                          |
|            |                              | c                        |
+------------+------------------------------+--------------------------+
| concatena  | Creates a new array object   | f=cu.open(\'/pc          |
| te((a0,a1, | that concatenates the        | mdi/mrso/mrso_bmr.dic\') |
| \..., an), | specified array objects      |                          |
|            | along the specified axis.    | s=f.getslab(\'mrso\')    |
| axis=0)    |                              |                          |
|            |                              | s.shape                  |
|            |                              |                          |
|            |                              | s1=f.getslab(\'mrso\')   |
|            |                              |                          |
|            |                              | s1.shape                 |
|            |                              |                          |
|            |                              | c=concatenate((s,s1))    |
|            |                              |                          |
|            |                              | c.shape                  |
+------------+------------------------------+--------------------------+
| clip(a,    | Clips the values in *a* to   | a=((0,1,2,3,4),(5,6,7    |
| min, max)  | lie between 'max' and 'min'. | ,8,9),(30,11,12,13,14),( |
|            | This function creates an     |                          |
|            | array with the same shape    | 15,16,17                 |
|            | and typecode as a, but where | ,30,19),(20,21,22,23,1)) |
|            | every entry in *a* that is   |                          |
|            | less than 'min' is replaced  | a                        |
|            | by 'min', and every entry    |                          |
|            | greater that 'max' is        | b=clip(a,4,12)           |
|            | replaced by 'max'. Entries   |                          |
|            | within the range ('min',     | b                        |
|            | 'max') are left unchanged.   |                          |
+------------+------------------------------+--------------------------+
| d          | Returns the entries along    | a=                       |
| iagonal(a, | the given diagonal of a.     | reshape(range(25),(5,5)) |
| axis1=0,   | *axis1* and *axis2* are used |                          |
|            | to define multi-dimensional  | a\[0,1\]=-99             |
| axis2=1,   | array. In a 2D array,        |                          |
| offset=0)  | *axis1* and *axis2* are used | a\[3,4\]=-99             |
|            | to define the vector. In a   |                          |
|            | 3D array, *axis1* and        | a\[2,3\]=-99             |
|            | *axis2* are used to define a |                          |
|            | plane. In a 4D array,        | a\[4,2\]=-99             |
|            | *axis1* and *axis2* are used |                          |
|            | to define a cube.            | a.missing_value=-99      |
|            |                              |                          |
|            |                              | a                        |
+------------+------------------------------+--------------------------+
| repeat(a,  | Each element in *a* is       | d=0,1,2,3                |
| repeats,   | repeated as often as         |                          |
| axis=0)    | indicated by the             | f=1,2,3,4                |
|            | corresponding elements in    |                          |
|            | 'repeats'.                   | d                        |
+------------+------------------------------+--------------------------+
| reshap     | Changes the shape of *a* to  | a=array                  |
| e(a,shape) | be given by the new shape,   | ((1,2,3,4,5,6,7,9,9,10)) |
|            | where 'shape' is a tuple of  |                          |
|            | the dimensions of the array. | a                        |
+------------+------------------------------+--------------------------+
| resize(a,  | Exactly like **reshap**e,    | f=cu.open(\'/pc          |
| shape)     | except the new size of the   | mdi/mrso/mrso_bmr.dic\') |
|            | array object can be          |                          |
|            | anything. NOTE: this can     | s=f.getslab(\'mrso\')    |
|            | produce strange results      |                          |
|            | unless care is execised.     | s.shape                  |
+------------+------------------------------+--------------------------+
| take(a,    | This function is like a      | a                        |
| indices,   | slice operation. It selects  | =array((\[0,1,2,3,4\],\[ |
| axis=0)    | the                          | 5,6,7,8,9\],\[10,11,12,1 |
|            |                              |                          |
|            | elements of the array object | 3,14\],\[15,16,17,18,1   |
|            | specified as first argument, | 9\],\[20,21,22,23,24\])) |
|            | based on the indices         |                          |
|            | specified as a second        | a                        |
|            | argument.                    |                          |
+------------+------------------------------+--------------------------+
|            |                              |                          |
+------------+------------------------------+--------------------------+
| tr         | Swaps the axes of *a* so     | f=cu.open(\'/pc          |
| anspose(a, | that their new order is that | mdi/mrso/mrso_bmr.dic\') |
| axis=None) | of the given axis. If axis   |                          |
|            | is not given, then it will   | s=f.getslab(\'mrso\')    |
|            | be set to                    |                          |
|            | **rang                       | s.shape                  |
|            | e(len(a.shape)).reverse(**). |                          |
+------------+------------------------------+--------------------------+
| compress(  | Returns those elements of    | a=0,-2,0,0,0,2,0,4,0,6   |
| condition, | *a* corresponding to those   |                          |
| a, axis=0) |                              | a                        |
|            | elements of 'condition' that |                          |
|            | are nonzero. 'condition'     | b=compress(a,a)          |
|            | must be the same size as the |                          |
|            | given axis of a.             | b                        |
+------------+------------------------------+--------------------------+

+---------------+-----------------------------+------------------------+
| **Command**   | **Description**             | **Examples**           |
+---------------+-----------------------------+------------------------+
| ravel(a)      | Returns *a* as a 1D array.  | f=cu.open(\'/pcmd      |
|               | The result is equivalent to | i/mrso/mrso_bmr.dic\') |
|               | use of functions            |                        |
|               | **reshape(a,(-1))** and     | s=f.getslab(\'mrso\')  |
|               | **a.flat**                  |                        |
|               |                             | s.shape                |
+---------------+-----------------------------+------------------------+
| trace(a,      | Returns the sum of the      | a=re                   |
| axis1=0,      | elements in *a* along the   | shape(range(25),(5,5)) |
| axis2=1,      | given axes diagonal.        |                        |
|               | *axis1* and *axis2* are     | a\[0,1\]=-99           |
| offset=0)     | used to define multi-       |                        |
|               | dimensional array. In a 2D  | a\[3,4\]=-99           |
|               | array, *axis1* and *axis2*  |                        |
|               | are used to define the      | a\[2,3\]=-99           |
|               | vector. In a 3D array,      |                        |
|               | *axis1* and *axis2* are     | a\[4,2\]=-99           |
|               | used to define a plane. In  |                        |
|               | a 4D array, *axis1* and     | a.missing_value=-99    |
|               | *axis2* are used to define  |                        |
|               | a cube.                     | a                      |
+---------------+-----------------------------+------------------------+
| tr            | Returns the sum of the      | a=re                   |
| acemissing(a, | elements in *a* along the   | shape(range(25),(5,5)) |
| axis1=0,      | given axes diagonal. axis1  |                        |
|               | and axis2 are used to       | a\[0,1\]=-99           |
| axis2=1,      | define multi-dimensional    |                        |
| offset=0)     | array. In a 2D array,       | a\[3,4\]=-99           |
|               | *axis1* and *axis2* are     |                        |
|               | used to define the vector.  | a\[2,3\]=-99           |
|               | In a 3D array, *axis1* and  |                        |
|               | *axis2* are used to define  | a\[4,2\]=-99           |
|               | a plane. In a 4D array,     |                        |
|               | *axis1* and *axis2* are     | a.missing_value=-99    |
|               | used to define a cube.      |                        |
|               |                             | a                      |
+---------------+-----------------------------+------------------------+
| whe           | Returns an array object     | a=0,-2,0,0,0,2,0,4,0,6 |
| re(condition, | shaped like the specified   |                        |
| x, y)         |                             | a                      |
|               | 'condition' and having      |                        |
|               | elements of 'x' and 'y',    |                        |
|               | where 'condition' is        |                        |
|               | respectively true or false. |                        |
+---------------+-----------------------------+------------------------+

### 

The SORT/SEARCH functions are designed to provide different methods for
sorting and searching arrays.

+---------------+-----------------------------+------------------------+
| **Command**   | **Description**             | **Examples**           |
+---------------+-----------------------------+------------------------+
| argmax(a,     | The **argmax()** function   | a=0,1,2,3,4,5,6,7,8,9, |
| axis=-1),     | returns an array with the   | 30,11,12,13,14,15,16,1 |
|               | arguments of the maximum    |                        |
| argmin(a,     | values of its input array   | 7,30,19,20,21,22,23,1  |
| axis=-1)      | *a* along the given axis.   |                        |
|               | The returned array will     | b=reshape(a,(5,5))     |
|               | have one less dimension     |                        |
|               | than a. **argmin()** which, | b                      |
|               | is just like **argmax(**),  |                        |
|               | except that it returns the  |                        |
|               | indices of the minima along |                        |
|               | the given axis.             |                        |
+---------------+-----------------------------+------------------------+
| argsort(a,    | Returns the indices of the  | a=0,-                  |
| axis=-1)      | elements of *a* needed to   | 2,0,10,6,0,0,2,0,4,0,7 |
|               |                             |                        |
|               | produce **sort(a**). ie.    | a                      |
|               | take(a, argsort(a)) ==      |                        |
|               | sort(a).                    |                        |
+---------------+-----------------------------+------------------------+
| se            | *a* must be sorted in       | a=0,-                  |
| archsorted(a, | ascending order and be 1D.  | 2,0,10,6,0,0,2,0,4,0,7 |
| values)       | This will return the        |                        |
|               | indices of the positions in | a                      |
|               | *a* where the corresponding |                        |
|               | values would fit.           |                        |
+---------------+-----------------------------+------------------------+
| sort(a,       | Will sort the elements of   | a=0,-                  |
| axis=-1)      | *a* along the given axis.   | 2,0,10,6,0,0,2,0,4,0,7 |
|               |                             |                        |
|               |                             | a                      |
|               |                             |                        |
|               |                             | b=sort(a)              |
|               |                             |                        |
|               |                             | b                      |
+---------------+-----------------------------+------------------------+

###  

The MANIPULATING functions are designed for indexing and slicing array
objects.

+---------------+-----------------------------+------------------------+
| **Command**   | **Description**             | **Examples**           |
+---------------+-----------------------------+------------------------+
| indexing      | Returns an array with the   | a=0,1,2,3,4,5,6,7,8,9, |
|               | specific elements of the    | 30,11,12,13,14,15,16,1 |
|               |                             |                        |
|               | original array              | 7,30,19,20,21,22,23,1  |
|               |                             |                        |
|               |                             | b=reshape(a,(5,5))     |
|               |                             |                        |
|               |                             | b                      |
+---------------+-----------------------------+------------------------+
| NewAxis       | Returns an array with a new | a=arrayrange(9)        |
|               | axis added added to the     |                        |
|               | original array.             | a                      |
+---------------+-----------------------------+------------------------+
| slicing       | Returns an array with the   | a=0,1,2,3,4,5,6,7,8,9, |
|               | specific elements of the    | 30,11,12,13,14,15,16,1 |
|               |                             |                        |
|               | original array              | 7,30,19,20,21,22,23,1  |
|               |                             |                        |
|               |                             | b=reshape(a,(5,5))     |
|               |                             |                        |
|               |                             | b                      |
+---------------+-----------------------------+------------------------+

### 

The METHODS functions are designed to provide access to the methods that
operate on arrays. These methods return information about an array, and
can also manipulate the attributes associated with an array.

+----------------+---------------------------+-------------------------+
| **Command**    | **Description**           | **Examples**            |
+----------------+---------------------------+-------------------------+
| a.as           | Calling an array's        | a=0,1,2,3,4,5,6,7,8,9   |
| type(typecode) | 'astype()' method returns | ,30,11,12,13,14,15,16,1 |
|                | a new array with the same |                         |
|                | shape as *a* but with the | 7,30,19,20,21,22,23,1   |
|                | specified typecode, and   |                         |
|                | with all its elements     | b=reshape(a,(5,5))      |
|                | (necessarily) cast to the |                         |
|                | new type.                 |                         |
+----------------+---------------------------+-------------------------+
| a              | The 'byteswap()' method   | a=0,1,2,3,4,5,6,7,8,9   |
| .byteswapped() | performs a byte-swapping  | ,30,11,12,13,14,15,16,1 |
|                | operation on all the      |                         |
|                | elements in the array.    | 7,30,19,20,21,22,23,1   |
|                | This is useful in         |                         |
|                | handling an array which   | b=reshape(a,(5,5))      |
|                | was written on a machine  |                         |
|                | with a different byte     | f=b.astype(Float16)     |
|                | order.                    |                         |
|                |                           | f                       |
+----------------+---------------------------+-------------------------+
| a.createattr   | Creates a new array       | f=cu.open(\'/pcm        |
| ibute('new_att | object attribute.         | di/mrso/mrso_bmr.dic\') |
|                |                           |                         |
| ribute_name')  |                           | s=f.getslab(\'mrso\')   |
|                |                           |                         |
|                |                           | s.c                     |
|                |                           | reateattribute(\'new\') |
|                |                           |                         |
|                |                           | s.showattributes()      |
+----------------+---------------------------+-------------------------+
| a.deleteattrib | Removes a given attribute | f=cu.open('/pc          |
| ute('attribute | from the array object's   | mdi/mrso/mrso_bmr.dic') |
|                | attribute list.           |                         |
| \_name')       |                           | s=f.getslab('mrso')     |
|                |                           |                         |
|                |                           | s                       |
|                |                           | .createattribute('new') |
|                |                           |                         |
|                |                           | s                       |
|                |                           | .deleteattribute('new') |
|                |                           |                         |
|                |                           | s.showattributes()      |
+----------------+---------------------------+-------------------------+
| a.getat        | Returns the attribute     | f=cu.open('/pc          |
| tribute('attri | value. Return value may   | mdi/mrso/mrso_bmr.dic') |
|                | be 'float', 'int',        |                         |
| bute_name')    | 'string', 'Python list',  | s=f.getslab('mrso')     |
|                | 'array object', etc.      |                         |
|                |                           | source=a                |
|                |                           | .getattribute('source') |
|                |                           |                         |
|                |                           | source                  |
+----------------+---------------------------+-------------------------+
| a.getdimatt    | Given the dimension       | f=cu.open(\'/pcm        |
| ribute(dimensi | number and attribute      | di/mrso/mrso_bmr.dic\') |
|                | name, returns the         |                         |
| on_number,     | dimension attribute       | s=f.getslab(\'mrso\')   |
|                | value.                    |                         |
| 'dimensio      |                           | weights=s.getdima       |
| n_attribute_na |                           | ttribute(1,\'weights\') |
|                |                           |                         |
| me')           |                           | weights                 |
+----------------+---------------------------+-------------------------+
| a.             | Calling an array's        | a=0,1,2,3,4,5,6,7,8,9   |
| iscontiguous() | 'iscontiguous()' method   | ,30,11,12,13,14,15,16,1 |
|                | returns 'true' if the     |                         |
|                | memory used by array *a*  | 7,30,19,20,21,22,23,1   |
|                | is contiguous.            |                         |
|                |                           | b=reshape(a,(5,5))      |
|                |                           |                         |
|                |                           | b                       |
+----------------+---------------------------+-------------------------+
| a.itemsize()   | The 'itemsize()' method   | a=0,1,2,3,4,5,6,7,8,9   |
|                | applied to an array       | ,30,11,12,13,14,15,16,1 |
|                | returns the number of     |                         |
|                | bytes used by any one of  | 7,30,19,20,21,22,23,1   |
|                | its elements.             |                         |
|                |                           | b=reshape(a,(5,5))      |
|                |                           |                         |
|                |                           | b                       |
+----------------+---------------------------+-------------------------+
| a.li           | Returns a Python list of  | f=cu.open(\'/pcm        |
| stattributes() | all the array object's    | di/mrso/mrso_bmr.dic\') |
|                | names.                    |                         |
|                |                           | s=f.getslab(\'mrso\')   |
|                |                           |                         |
|                |                           | atts=s.listattributes() |
|                |                           |                         |
|                |                           | atts                    |
+----------------+---------------------------+-------------------------+
| a.listdimatt   | Returns a Python list of  | f=cu.open('/pc          |
| ributes(dimens | the given dimension's     | mdi/mrso/mrso_bmr.dic') |
|                |                           |                         |
| ion_number)    | attributes.               | s=f.getslab('mrso')     |
|                |                           |                         |
|                |                           | s.listdimattributes(1)  |
+----------------+---------------------------+-------------------------+
| a.             | Returns a Python list of  | f=cu.open('/pc          |
| listdimnames() | the ordered dimension     | mdi/mrso/mrso_bmr.dic') |
|                | names.                    |                         |
|                |                           | s=f.getslab('mrso')     |
|                |                           |                         |
|                |                           | s.listdimnames()        |
+----------------+---------------------------+-------------------------+
| a              | The user can view and     | f=cu.open('/pc          |
| .missing_value | change the array's        | mdi/mrso/mrso_bmr.dic') |
|                |                           |                         |
|                | missing_value. Although   | s=f.getslab('mrso')     |
|                | missing_value is an       |                         |
|                | attribute, it is viewed a | s.missing_value         |
|                | little differently than   |                         |
|                | the other attributes. If  |                         |
|                | the slab does not have a  |                         |
|                | missing_value attribute,  |                         |
|                | CDAT will create the      |                         |
|                | missing_value attribute   |                         |
|                | and assign it a value.    |                         |
|                | The missing value is      |                         |
|                | always a float, if the    |                         |
|                | user wishes to change the |                         |
|                | value it will need to be  |                         |
|                |                           |                         |
|                | cast.                     |                         |
+----------------+---------------------------+-------------------------+
| a.resetgridt   | Allows the user to change | f=cu.open('/pc          |
| ype('grid_type | the grid type after it    | mdi/mrso/mrso_bmr.dic') |
|                | has been retrieved via    |                         |
| ',             | 'getslab'. It is only     | s=f.getslab('mrso')     |
| di             | intended to work with     |                         |
| mension_index) | global data, and if the   | s.                      |
|                | latitude dimension index  | resetgridtype('linear') |
|                | is not specified, it will |                         |
|                | default to -2 dimension   |                         |
|                | of the data set. The user |                         |
|                | can choose from one of    |                         |
|                | the following grid types: |                         |
|                | 'linear', 'lmd', 'gis',   |                         |
|                | or 'gaussian'.            |                         |
+----------------+---------------------------+-------------------------+
| a.setattribute | Sets (or resets) an       | f=cu.open(\'/pcm        |
| ('attribute_na | attribute value to any of | di/mrso/mrso_bmr.dic\') |
|                | the Python types (i.e.,   |                         |
| me', value)    | float, Python list, array | s=f.getslab(\'mrso\')   |
|                | object, etc.).            |                         |
|                |                           | s.c                     |
|                |                           | reateattribute(\'new\') |
|                |                           |                         |
|                |                           | s.set                   |
|                |                           | attribute(\'new\',\'new |
|                |                           | attribute value\')      |
|                |                           |                         |
|                |                           | s.showattributes()      |
+----------------+---------------------------+-------------------------+
| a.s            | Given the dimension       | f=cu.open(\'/pcm        |
| etdimattribute | number and attribute      | di/mrso/mrso_bmr.dic\') |
|                | name, sets the dimension  |                         |
| (dim           | attribute value.          | s=f.getslab(\'mrso\')   |
| ension_number, |                           |                         |
|                |                           | s.setdimattribute(1,\'  |
| 'dimension_    |                           | name\',\'my_latitude\') |
| attribute_name |                           |                         |
|                |                           | name=s.getd             |
| ', value)      |                           | imattribute(1,\'name\') |
|                |                           |                         |
|                |                           | name                    |
+----------------+---------------------------+-------------------------+
| a.sh           | Displays all the array    | f=cu.open(\'/pcm        |
| owattributes() | object's attributes names | di/mrso/mrso_bmr.dic\') |
|                | (if any) and their        |                         |
|                | values.                   | s=f.getslab(\'mrso\')   |
|                |                           |                         |
|                |                           | s.showattributes()      |
+----------------+---------------------------+-------------------------+
| a.showdi       | Displays the given        | f=cu.open(\'/pcm        |
| m(dimension_nu | dimension's attributes    | di/mrso/mrso_bmr.dic\') |
|                | and values.               |                         |
| mber)          |                           | s=f.getslab(\'mrso\')   |
|                |                           |                         |
|                |                           | s.showdim(1)            |
+----------------+---------------------------+-------------------------+
| a.tolist()     | Calling an array's        | a=0,1,2,3,4,5,6,7,8,9   |
|                | 'tolist()' method returns | ,30,11,12,13,14,15,16,1 |
|                | a                         |                         |
|                |                           | 7,30,19,20,21,22,23,1   |
|                | hierarchical python list  |                         |
|                | version of the same array | b=reshape(a,(5,5))      |
|                | object.                   |                         |
|                |                           | list=b.tolist()         |
|                |                           |                         |
|                |                           | list                    |
+----------------+---------------------------+-------------------------+

+----------------+---------------------------+-------------------------+
| a.tostring()   | The 'tostring()' method   | a=0,1,2,3,4,5,6,7,8,9   |
|                | returns a string          | ,30,11,12,13,14,15,16,1 |
|                | representation of the     |                         |
|                | data portion of the array | 7,30,19,20,21,22,23,1   |
|                | object it is applied to.  |                         |
|                |                           | b=reshape(a,(5,5))      |
|                |                           |                         |
|                |                           | string=b.tostring()     |
|                |                           |                         |
|                |                           | type(b)                 |
+----------------+---------------------------+-------------------------+
| a.typecode()   | The 'typecode()' method   | a=0,1,2,3,4,5,6,7,8,9   |
|                | returns the typecode of   | ,30,11,12,13,14,15,16,1 |
|                | the array to which it is  |                         |
|                | applied.                  | 7,30,19,20,21,22,23,1   |
|                |                           |                         |
|                |                           | b=reshape(a,(5,5))      |
|                |                           |                         |
|                |                           | b                       |
+----------------+---------------------------+-------------------------+
|                |                           |                         |
+----------------+---------------------------+-------------------------+

### 

The Attribute functions are designed to provide access to attributes of
an array object.

+----------------+---------------------------+-------------------------+
| **Command**    | **Description**           | **Examples**            |
+----------------+---------------------------+-------------------------+
| a.flat         | Returns the flattened, or | f=cu.open('/pc          |
|                | ravel()'ed version of an  | mdi/mrso/mrso_bmr.dic') |
|                | array, without having to  |                         |
|                | do a function call        | s=f.getslab('mrso')     |
|                |                           |                         |
|                |                           | fl=s.flat               |
|                |                           |                         |
|                |                           | fl.shape                |
+----------------+---------------------------+-------------------------+
| a.imaginary    | Returns the imaginary     | a=array                 |
|                | part of a complex array,  |                         |
|                | and raises an exception   | a                       |
|                | for a real array.         |                         |
+----------------+---------------------------+-------------------------+
| a.real         | Returns the real part of  | a=array                 |
|                | an array. For non-complex |                         |
|                | arrays, this is identical | a                       |
|                | to the array itself.      |                         |
+----------------+---------------------------+-------------------------+

### 

The Arithmetic functions are designed to provide access to Universal
Functions.

+----------------+---------------------------+-------------------------+
| **Command**    | **Description**           | **Examples**            |
+----------------+---------------------------+-------------------------+
| arccos(a)      | Returns the arc cosine of | arccos(.5)              |
|                | a.                        |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | aarccos(a)              |
+----------------+---------------------------+-------------------------+
| arcsin(a)      | Returns the arc sine of   | arcsin(1)               |
|                | a.                        |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
+----------------+---------------------------+-------------------------+
| arctan(a)      | Returns the arc tangent   | arctan(1)               |
|                | of a.                     |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | arctan(a)               |
+----------------+---------------------------+-------------------------+
| arctan2(a,b)   | Returns the arc tangent   | arctan2(3,2)            |
|                | of the line to a,b.       |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | b=array(                |
|                |                           | ((.5,.9,.1),(.3,.8,.2)) |
|                |                           |                         |
|                |                           | b                       |
|                |                           |                         |
|                |                           | arctan2(a,b)            |
+----------------+---------------------------+-------------------------+
| cos(a)         | Returns the cosine of a.  | cos(1)                  |
|                |                           |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
+----------------+---------------------------+-------------------------+
| cosh(a)        | Returns the hyperbolic    | cosh(1)                 |
|                | cosine of                 |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | cosh(a)                 |
+----------------+---------------------------+-------------------------+
| exp(a)         | Returns the exponential   | exp(1)                  |
|                | notation of a.            |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | exp(a)                  |
+----------------+---------------------------+-------------------------+
| log(a)         | Returns the natural       | log(5)                  |
|                | logarithm of a.           |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,5,6))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | log(a)                  |
+----------------+---------------------------+-------------------------+
| log10(a)       | Returns the logarithm     | log10(5)                |
|                | base 10 of a.             |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,5,6))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | log10(a)                |
+----------------+---------------------------+-------------------------+
| sin(a)         | Returns the sine of a.    | sin(1)                  |
|                |                           |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | sin(a)                  |
+----------------+---------------------------+-------------------------+
| sinh(a)        | Returns the hyperbolic    | sinh(1)                 |
|                | sine of a.                |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | sinh(a)                 |
+----------------+---------------------------+-------------------------+
| sqrt(a)        | Returns the square root   | sqrt(3)                 |
|                | of a.                     |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,5,6))) |
|                |                           |                         |
|                |                           | a                       |
|                |                           |                         |
|                |                           | sqrt(a)                 |
+----------------+---------------------------+-------------------------+
| tanh(a)        | Returns the hyperbolic    | tanh(1)                 |
|                | tangent of a.             |                         |
|                |                           | a=array((               |
|                |                           | (.1,.2,.3),(.5,.6,.7))) |
|                |                           |                         |
|                |                           | atanh(a)                |
+----------------+---------------------------+-------------------------+
| addmissing(a)  | Returns the sum without   | a                       |
|                | adding the missing value. | =array((1,2,3),(5,7,2)) |
|                |                           |                         |
|                |                           | a.missing_value=5       |
|                |                           |                         |
|                |                           | addmissing.reduce(a)    |
+----------------+---------------------------+-------------------------+
| avg(a,axis=0)  | Averaging function that   | a                       |
|                | omits missing data (i.e., | =array((1,2,3),(5,7,2)) |
|                | 1e20). The function adds  |                         |
|                | up each node value along  | b=avg.reduce(a)         |
|                | a given axis and divides  |                         |
|                | that number by the total  | b                       |
|                | number found.             |                         |
+----------------+---------------------------+-------------------------+
| add(x,y)       | Returns the sum of two    | add(5,7)                |
|                | arguments                 |                         |
|                |                           | a                       |
|                |                           | =array((1,2,3),(4,2,5)) |
|                |                           |                         |
|                |                           | b                       |
|                |                           | =array((7,3,1),(9,0,4)) |
|                |                           |                         |
|                |                           | add(a,b)                |
+----------------+---------------------------+-------------------------+
| Comparison     | Return arrays with the    | f=1,2,3,4               |
| Ufuncs         | same shape as the array   |                         |
|                |                           | d=7,8,9,10              |
| (takes two     | specified as the first    |                         |
| arguments)     | argument and with values  | a=repeat(d,f)           |
|                | that correspond to the    |                         |
|                | result of the pairwise    | a                       |
|                | comparison of its         |                         |
|                | elements with the second  | b=greater(a,9)          |
|                | argument.                 |                         |
|                |                           | b                       |
|                | NOTE: an array of 0s and  |                         |
|                | 1s is returned, where 1   | c=less(a,10)            |
|                | represents true and 0     |                         |
|                | false                     | c                       |
|                |                           |                         |
|                |                           | f=equal(a,8)            |
|                |                           |                         |
|                |                           | f                       |
+----------------+---------------------------+-------------------------+
| conjugate      | Returns an array with     | conjugate(complex(2,3)) |
|                | elements that are the     |                         |
|                | conjugate of a complex    |                         |
|                | number.                   |                         |
+----------------+---------------------------+-------------------------+
| divide(a,b)    | Returns *a* divided by    | divide(7,5)             |
|                | *b*                       |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,2,5))) |
|                |                           |                         |
|                |                           | b=a                     |
|                |                           | rray(((7,3,1),(9,0,4))) |
|                |                           |                         |
|                |                           | divide(b,a)             |
+----------------+---------------------------+-------------------------+

+----------------+---------------------------+-------------------------+
| maximum(a,b)   | Returns an array with     | a=(((1,2,3),(5,7,2)))   |
|                | elements that are the     |                         |
|                | pairwise maximum of each  | b=(((5,3,7),(9,1,0)))   |
|                | element of *a* versus b.  |                         |
|                |                           | maximum(a,b)            |
|                |                           |                         |
|                |                           | maximum.reduce(a)       |
+----------------+---------------------------+-------------------------+
| minimum(a,b)   | Returns an array with     | a=(((1,2,3),(5,7,2)))   |
|                | elements that are the     |                         |
|                | pairwise minimum of each  | b=(((5,3,7),(9,1,0)))   |
|                | element of *a* versus b.  |                         |
|                |                           | minimum(a,b)            |
|                |                           |                         |
|                |                           | minimum.reduce(a)       |
+----------------+---------------------------+-------------------------+
| multiply(a,b)  | Returns the product of    | multiply(5,7)           |
|                | *a* and b.                |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,2,5))) |
|                |                           |                         |
|                |                           | b=a                     |
|                |                           | rray(((7,3,1),(9,0,4))) |
|                |                           |                         |
|                |                           | multiply(a,b)           |
+----------------+---------------------------+-------------------------+
| power(a,b)     | Returns *a* raised to the | power(3,4)              |
|                | power b.                  |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,2,5))) |
|                |                           |                         |
|                |                           | b=a                     |
|                |                           | rray(((7,3,1),(9,0,4))) |
|                |                           |                         |
|                |                           | power(a,b)              |
+----------------+---------------------------+-------------------------+
| remainder(a,b) | Returns the modulus from  | remainder(7,5)          |
|                | division of *a* by b.     |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,2,5))) |
|                |                           |                         |
|                |                           | b=a                     |
|                |                           | rray(((7,3,1),(9,0,4))) |
|                |                           |                         |
|                |                           | remainder(b,a)          |
+----------------+---------------------------+-------------------------+
| subtract(a,b)  | Returns *b* subtracted    | subtract(5,7)           |
|                | from a.                   |                         |
|                |                           | a=a                     |
|                |                           | rray(((1,2,3),(4,2,5))) |
|                |                           |                         |
|                |                           | b=a                     |
|                |                           | rray(((7,3,1),(9,0,4))) |
|                |                           |                         |
|                |                           | subtract(a,b)           |
+----------------+---------------------------+-------------------------+

### 

The LOGICAL functions are designed to provide access to the different
logical operators.

+----------------+---------------------------+-------------------------+
| **Command**    | **Description**           | **Examples**            |
+----------------+---------------------------+-------------------------+
| Logical        | Returns an array with     |                         |
|                | elements that are the     |                         |
|                | results of                |                         |
|                |                           |                         |
|                | the following logical     |                         |
|                | operations.               |                         |
|                |                           |                         |
|                | logical_and               |                         |
|                |                           |                         |
|                | logical_or                |                         |
|                |                           |                         |
|                | logical_xor               |                         |
|                |                           |                         |
|                | logical_not               |                         |
|                |                           |                         |
|                | boolean_and               |                         |
|                |                           |                         |
|                | boolean_or                |                         |
+----------------+---------------------------+-------------------------+

### 

The UFUNC functions are designed to provide access to the different
universal functions. The Ufunc functions are: **add, avg, divide,
multiply, power, remainder, subtract.**

+----------------+--------------------------+-------------------------+
| **Command**    | **Description**          | **Examples**            |
+----------------+--------------------------+-------------------------+
| ufunc.accumu   | This is the same as      | a=arrayrange(9)         |
| late(a,axis=0) | reduce, except that all  |                         |
|                | the                      | a.shape=(3,3)           |
|                |                          |                         |
|                | intermediate results are | a                       |
|                | kept along the way.      |                         |
|                |                          | b=add.accumulate(a)     |
|                | **add.accumulate** is    |                         |
|                | equivalent to            | b                       |
|                | **cumsum(**).            |                         |
+----------------+--------------------------+-------------------------+

+----------------+--------------------------+-------------------------+
| ufunc.c        | The method returns an    | a=arrayrange(9)         |
| ount(a,axis=0) | array that contains the  |                         |
|                | number of values that    | a.shape=(3,3)           |
|                | were totaled at each     |                         |
|                | node point. The count    | a                       |
|                | method returns the total |                         |
|                | number of times the node | a.missing_value=4       |
|                | value is added,          |                         |
|                | excluding the            | b=avg.count(a)          |
|                | missing_value.           |                         |
|                |                          | b                       |
+----------------+--------------------------+-------------------------+
| uf             | Computes the outer       | a=arrayrange(9)         |
| unc.outer(a,b) | product of *a* and b.    |                         |
|                |                          | a.shape=(3,3)           |
|                | Note: use of this        |                         |
|                | function has not yet     | b=add.accumulate(a)     |
|                | been tested.             |                         |
|                |                          | c=add.outer(a,b)        |
|                |                          |                         |
|                |                          | c                       |
+----------------+--------------------------+-------------------------+
| u              | Returns an array object  | a=arrayrange(9)         |
| func.reduce(a, | that is reduced along    |                         |
| axis=0)        | the axis.                | a.shape=(3,3)           |
|                | **add.reduce()** is      |                         |
|                | synonymous with the      | a                       |
|                | **sum()** utility        |                         |
|                | function.                | b=add.reduce(a)         |
|                |                          |                         |
|                |                          | b                       |
+----------------+--------------------------+-------------------------+
| ufu            | This function reduces    | a.shape=(3,3)           |
| nc.reduceat(a, | *a* to each of the given |                         |
|                | indices so that the new  | a                       |
| i              | size along the given     |                         |
| ndices,axis=0) | axis will be the same as | d=add.reduceat(a,(0,1)) |
|                | the length of indices.   |                         |
|                |                          | d                       |
|                | Note: use this function  |                         |
|                | with caution.            | d.shape                 |
+----------------+--------------------------+-------------------------+

### 

The NUMERICAL functions provide access to different numerical routines.

+-------------+---------------------------+---------------------------+
| **Command** | **Description**           | **Examples**              |
+-------------+---------------------------+---------------------------+
| convolve(   | Returns the convolution   | a=array((0.027,0.0        |
| a,b,mode=0) | of *a* and b. This        | 5856,0.0903,0.11742,0.135 |
|             | function is implemented   |                           |
|             | in the standard manner,   | 4210,0.13567,0.117        |
|             | without using Fast        | 42,0.0903,0.05856,0.027), |
|             | Fourier Transforms        |                           |
|             | (FFT's). It is intended   | a                         |
|             | for the                   |                           |
|             |                           | a.shape                   |
|             | convolution of a large    |                           |
|             | array with a small one.   | e                         |
|             | The mode can be set to    | =array((1,2,3,4,5),Float) |
|             | either 0,1, or 2.         |                           |
|             |                           | e                         |
|             |                           |                           |
|             |                           | e.shape                   |
|             |                           |                           |
|             |                           | f=convolve(a,e,1)         |
|             |                           |                           |
|             |                           | f                         |
|             |                           |                           |
|             |                           | f.shape                   |
+-------------+---------------------------+---------------------------+
| dot(a,b)    | Returns the dot product   | a=0,1,2,3,4,5,6,7,8       |
|             | of *a* and b. This is     | ,9,30,11,12,13,14,15,16,1 |
|             |                           |                           |
|             | equivalent to a           | 7,30,19,20,21,22,23,1     |
|             | matrix-multiply operation |                           |
|             | for 2D arrays (without    | b=reshape(a,(5,5))        |
|             | transpose).               |                           |
|             |                           | c=reshape(a,(5,5))        |
|             |                           |                           |
|             |                           | d=dot(b,c)                |
|             |                           |                           |
|             |                           | d                         |
+-------------+---------------------------+---------------------------+
| sum(a)      | Adds all the elements in  | a=0,-2,0,0,0,2,0,4,0,6    |
|             | the array.                |                           |
|             |                           | a                         |
|             | Note: **add.reduce()** is |                           |
|             | synonymous with the       | sum(a)                    |
|             | **sum()** utility         |                           |
|             | function.                 | b=where(a,2,7)            |
|             |                           |                           |
|             |                           | bsum(b)                   |
+-------------+---------------------------+---------------------------+

###  

The RANDOM functions are designed to create arrays filled with random
numbers. They are the front-ends to the functions provided by the ranlib
module. To use the random number functions in CDAT, type: **import
RandomArray**

+-------------+--------------------------------+-----------------------+
| **Command** | **Description**                | **Examples**          |
+-------------+--------------------------------+-----------------------+
| get_seed()  | Returns the two integers that  | import RandomArray    |
|             | are the generator's current    |                       |
|             | seed.                          | RandomArray.seed(0,0) |
|             |                                |                       |
|             |                                | R                     |
|             |                                | andomArray.get_seed() |
+-------------+--------------------------------+-----------------------+
| p           | A random resorting of the      | import RandomArray    |
| ermutation( | values in **arrayrange(a**).   |                       |
| shape=\[\]) |                                | p=Random              |
|             |                                | Array.permutation(10) |
|             |                                |                       |
|             |                                | p                     |
+-------------+--------------------------------+-----------------------+
| random(     | Returns an array of random     | import RandomArray    |
| shape=\[\]) | numbers uniformly              |                       |
|             |                                | RandomArray.seed(0,0) |
|             | distributed between 0 and 1 of |                       |
|             | the given shape. Returns a     | Random                |
|             | scalar if the shape is empty   | Array.random((1,2,3)) |
|             | (as in the default).           |                       |
+-------------+--------------------------------+-----------------------+
| randint     | An array of integers between   | import RandomArray    |
| (minimum=0, | 'minimum' and                  |                       |
|             |                                | RandomArray.seed(0,0) |
| maximum,    | 'maximum', not including the   |                       |
| shape=\[\]) | value of 'maximum' (as         | RandomArray.          |
|             |                                | randint(1,37,(1,3,5)) |
|             | in range).                     |                       |
+-------------+--------------------------------+-----------------------+
| unifo       | The random numbers are         | import RandomArray    |
| rm(minimum, | uniformly distributed          |                       |
|             |                                | RandomArray.seed(0,0) |
| maximum,    | between 'minimum' and          |                       |
| shape=\[\]) | 'maximum'.                     | RandomArray.          |
|             |                                | uniform(3,15,(1,2,3)) |
+-------------+--------------------------------+-----------------------+

### 

The LINEAR ALGEBRA functions are designed to be wrappers for the
low-level routines offered by the LAPACK routines. To use the linear
algebra functions in CDAT,

type: **import LinearAlgebra.**

+-------------+----------------------------------+---------------------+
| **Command** | **Description**                  | **Examples**        |
+-------------+----------------------------------+---------------------+
| det         | Returns the determinant of a.    | import              |
| erminant(a) |                                  | LinearAlgebra       |
|             |                                  |                     |
|             |                                  | a=array(\           |
|             |                                  | [\[1,2\],\[3,4\]\]) |
|             |                                  |                     |
|             |                                  | a                   |
+-------------+----------------------------------+---------------------+
| eig         | Returns an array object that     | import              |
| envalues(a) | contains the eigenvalues of a.   | LinearAlgebra       |
|             |                                  |                     |
|             |                                  | a=array(\           |
|             |                                  | [\[1,2\],\[3,4\]\]) |
|             |                                  |                     |
|             |                                  | a                   |
|             |                                  |                     |
|             |                                  | LinearAlg           |
|             |                                  | ebra.eigenvalues(a) |
+-------------+----------------------------------+---------------------+
| eige        | Returns an array object that     | import              |
| nvectors(a) | contains the eigenvectors of a.  | LinearAlgebra       |
|             |                                  |                     |
|             |                                  | a=array(\           |
|             |                                  | [\[1,2\],\[3,4\]\]) |
|             |                                  |                     |
|             |                                  | a                   |
|             |                                  |                     |
|             |                                  | b,c=LinearAlge      |
|             |                                  | bra.eigenvectors(a) |
|             |                                  |                     |
|             |                                  | b                   |
|             |                                  |                     |
|             |                                  | c                   |
+-------------+----------------------------------+---------------------+
| generalized | import LinearAlgebra             |                     |
| _inverse(a) |                                  |                     |
|             | a=array(\[\[1,2\],\[3,4\]\])     |                     |
|             |                                  |                     |
|             | Line                             |                     |
|             | arAlgebra.generalized_inverse(a) |                     |
+-------------+----------------------------------+---------------------+

###  

The FFT is a package of Fortran subprograms for calculating fast Fourier
transforms for both complex and real periodic

sequences and other sequences To use the fft functions in CDAT,

type: **import FFT.**

+---------------+-------------------------+----------------------------+
| **Command**   | **Description**         | **Examples**               |
+---------------+-------------------------+----------------------------+
| inverse(a)    | Returns an array object | import LinearAlgebra       |
|               | that contains the       |                            |
|               | inverse of a.           | a=                         |
|               |                         | array(\[\[1,2\],\[3,4\]\]) |
|               |                         |                            |
|               |                         | LinearAlgebra. inverse(a)  |
+---------------+-------------------------+----------------------------+
| linear_least  | Returns an array object | import LinearAlgebra       |
| _squares(a,b) | that contains the       |                            |
|               | linear least-           | a=                         |
|               |                         | array(\[\[1,2\],\[3,4\]\]) |
|               | squares of *a* and b.   |                            |
|               |                         | a                          |
|               |                         |                            |
|               |                         | b=                         |
|               |                         | array(\[\[5,6\],\[7,8\]\]) |
|               |                         |                            |
|               |                         | b                          |
|               |                         |                            |
|               |                         | LinearAlgebra              |
|               |                         | .linear_least_squares(a,b) |
+---------------+-------------------------+----------------------------+
| singular_     | Returns an array object | import LinearAlgebra       |
| value_decompo | that contains the       |                            |
|               | singular value          | a=                         |
| sition(a)     | decomposition of a.     | array(\[\[1,2\],\[3,4\]\]) |
|               |                         |                            |
|               |                         | a                          |
|               |                         |                            |
|               |                         | LinearAlgebra.singu        |
|               |                         | lar_value_decomposition(a) |
+---------------+-------------------------+----------------------------+
| solve_linear  | Returns an array object | import LinearAlgebra       |
| _equations(a, | that solves the linear  |                            |
|               | equation.               | a=                         |
| b\)           |                         | array(\[\[1,2\],\[3,4\]\]) |
|               |                         |                            |
|               |                         | a                          |
|               |                         |                            |
|               |                         | b=                         |
|               |                         | array(\[\[5,6\],\[7,8\]\]) |
|               |                         |                            |
|               |                         | b                          |
|               |                         |                            |
|               |                         | LinearAlgebra.s            |
|               |                         | olve_linear_equations(a,b) |
+---------------+-------------------------+----------------------------+
| fft(a,        | Returns the *n* point   | a=array((0.23, -.14, .75,  |
| n=None,       | discreate Fourier       | .41, -.02, .64))           |
| axis=-1)      | transform of a. *n*     |                            |
|               | defaults to the length  | a                          |
|               | of a. This is most      |                            |
|               | efficient for *n* a     | FFT.fft(a)                 |
|               | power of two. If *n* is |                            |
|               | larger than a, the *a*  | FFT.fft(a,3)               |
|               | will be zero-padded to  |                            |
|               | make up the difference. |                            |
|               | If *n* is smaller than  |                            |
|               | a, then *a* will be     |                            |
|               | aliased to reduce its   |                            |
|               | size.                   |                            |
+---------------+-------------------------+----------------------------+
| i             | Returns the *n* point   | a=array((0.23, -.14, .75,  |
| nverse_fft(a, | inverse discreate       | .41, -.02, .64))           |
| n=None,       | Fourier transform of a. |                            |
|               | *n* defaults to the     | b=FFT.fft(a)               |
| axis=-1)      | length of a. This is    |                            |
|               | most efficient for *n*  | FFT.inverse_fft(b)         |
|               | a power of two. If *n*  |                            |
|               | is larger than a, the   |                            |
|               | *a* will be zero-padded |                            |
|               | to make up the          |                            |
|               | difference. If *n* is   |                            |
|               | smaller than a, then    |                            |
|               | *a* will be aliased to  |                            |
|               | reduce its size.        |                            |
+---------------+-------------------------+----------------------------+
| real_fft(a,   | Returns the *n* point   | a=array((0.23, -.14, .75,  |
| n=None,       | discreate Fourier       | .41, -.02, .64))           |
| axis=-1)      | transform of the real   |                            |
|               | value array a. *n*      | FFT.real_fft(a)            |
|               | defaults to the length  |                            |
|               | of a. This is most      |                            |
|               | efficient for *n* a     |                            |
|               | power of two. The       |                            |
|               | returned array will be  |                            |
|               | one half of the         |                            |
|               | symmetric complex       |                            |
|               | transform of the real   |                            |
|               | array.                  |                            |
+---------------+-------------------------+----------------------------+
| fft2d(a,      | Returns the 2d fft of   | a=array((0.23, -.14, .75,  |
| s=None,       | a.                      | .41, -.02, .64))           |
| axes=(-2,-1)) |                         |                            |
|               |                         | c=reshape(a,(3,2))         |
|               |                         |                            |
|               |                         | FFT.fft2d(c)               |
+---------------+-------------------------+----------------------------+
| real_fft2d(a, | Returns the 2d fft of   | a=array((0.23, -.14, .75,  |
| s=None,       | the real valued array   | .41, -.02, .64))           |
|               | a.                      |                            |
| axes=(-2,-1)) |                         | c=reshape(a,(3,2))         |
|               |                         |                            |
|               |                         | FFT.real_fft2d(c)          |
+---------------+-------------------------+----------------------------+

### 

The PCMDI module is designed to provide access to different functions
relating to the work done at PCMDI. To use the PCMDI module in CDAT,
type: **import pcmdi**

+----------------+------------------------+----------------------------+
| **Command**    | **Description**        | **Examples**               |
+----------------+------------------------+----------------------------+
| cd('path')     | Changes the current    | cd('/penguin1/cdat')       |
|                | working directory.     |                            |
+----------------+------------------------+----------------------------+
| ema            | Pops up an emacs       | emacs('test')              |
| cs('filename') | editor window for      |                            |
|                | creating and modifying |                            |
|                | files.                 |                            |
+----------------+------------------------+----------------------------+
| ls()           | List the files in      | ls()                       |
|                | current working        |                            |
|                | directory.             |                            |
+----------------+------------------------+----------------------------+
| pwd()          | Shows the current      | pwd()                      |
|                | working directory.     |                            |
+----------------+------------------------+----------------------------+
| regrid(source, | Regrids *destination*  | f=cu.open('                |
| destination,\[ | to the grid of         | /pcmdi/mrso/mrso_bmr.dic') |
|                | *sourc*e. Use of       |                            |
| mask\])        | *mas*k, which is also  | s=f.getslab('mrso')        |
|                | an array object, is    |                            |
|                | optional.              | obsf=cu.open('/p           |
|                |                        | cmdi/obs/psl.rnl_ecm.sc.79 |
|                |                        |                            |
|                |                        | 01.8812.sfc.ctl')          |
|                |                        |                            |
|                |                        | obs=obsf.getslab('psl')    |
|                |                        |                            |
|                |                        | obs.shape                  |
|                |                        |                            |
|                |                        | s.shape                    |
|                |                        |                            |
|                |                        | r=regrid(obs,s)            |
|                |                        |                            |
|                |                        | r.shape                    |
|                |                        |                            |
|                |                        | fl=cu.open('/pc            |
|                |                        | mdi/gis/DJF1079_88mm.dic') |
|                |                        |                            |
|                |                        | mk=cu.open                 |
|                |                        | ('/pcmdi/sft/sft_gis.dic') |
|                |                        |                            |
|                |                        | mask=mk.getslab('sft')     |
|                |                        |                            |
|                |                        | s1=fl.getslab('psl')       |
|                |                        |                            |
|                |                        | s1.shape                   |
|                |                        |                            |
|                |                        | gis=regrid(obs,s1,mask)    |
|                |                        |                            |
|                |                        | gis.shape                  |
|                |                        |                            |
|                |                        | mask                       |
|                |                        | 2=where(equal(mask,0),1,0) |
|                |                        |                            |
|                |                        | gis2=regrid(obs,s,mask2)   |
|                |                        |                            |
|                |                        | gis2.shape                 |
+----------------+------------------------+----------------------------+
| reorder(a,     | Reorder the PCMDI      | f=cu.open('                |
| shape=\[\])    | (ArrayObject)          | /pcmdi/mrso/mrso_bmr.dic') |
|                | dimensions to the      |                            |
|                | defined order. This    | s=f.getslab('mrso')        |
|                | routine works within   |                            |
|                | the confines of        | a=reorder(s,(1,2,0))       |
|                |                        |                            |
|                | Python.                | s.shape                    |
|                |                        |                            |
|                |                        | a.shape                    |
+----------------+------------------------+----------------------------+
| slabinfo(slab) | Shows the attributes   | f=cu.open('                |
|                | and dimensions         | /pcmdi/mrso/mrso_bmr.dic') |
|                | associated with a slab |                            |
|                | of data.               | s=f.getslab('mrso')        |
|                |                        |                            |
|                |                        | slabinfo(s)                |
+----------------+------------------------+----------------------------+
| writedrs(a,    | Creates, appends, or   | f=cu.open('                |
| 'output_name', | overwrites a DRS       | /pcmdi/mrso/mrso_bmr.dic') |
|                | formatted file. This   |                            |
| \['mode'\])    | function works within  | s=f.getslab('mrso')        |
|                | the confines of        |                            |
|                | Python. modes:         | writehdf(s,'               |
|                |                        | /penguin0/susan/mrso.hdf') |
|                | a - append a to an     |                            |
|                | existing file.         |                            |
|                |                        |                            |
|                | r - replaces data in   |                            |
|                | an existing file with  |                            |
|                | a                      |                            |
+----------------+------------------------+----------------------------+
| writehdf(a,    | Creates, appends, or   | f=cu.open('                |
| 'output_name', | overwrites an HDF      | /pcmdi/mrso/mrso_bmr.dic') |
|                | formatted file. This   |                            |
| \['mode'\])    | function works within  | s=f.getslab('mrso')        |
|                | the confines of        |                            |
|                | Python.                | writehdf(s,'               |
|                |                        | /penguin0/susan/mrso.hdf') |
|                | modes:                 |                            |
|                |                        |                            |
|                | a - append a to an     |                            |
|                | existing file.         |                            |
|                |                        |                            |
|                | r - replaces data in   |                            |
|                | an existing file with  |                            |
|                | a)                     |                            |
+----------------+------------------------+----------------------------+

+----------------+------------------------+----------------------------+
| writenetcdf(a, | Creates, appends, or   | f=cu.open('                |
|                | overwrites a netCDF    | /pcmdi/mrso/mrso_bmr.dic') |
| 'output_name', | formatted file. This   |                            |
| \['mode'\])    | function works within  | s=f.getslab('mrso')        |
|                | the confines of        |                            |
|                | Python.                | writenetcdf(s,             |
|                |                        | '/penguin0/susan/mrso.nc') |
|                | modes:                 |                            |
|                |                        |                            |
|                | a - append a to an     |                            |
|                | existing file.         |                            |
|                |                        |                            |
|                | r - replaces data in   |                            |
|                | an existing file with  |                            |
|                | a                      |                            |
+----------------+------------------------+----------------------------+
| vi('filename') | Pops up a vi editor    | vi('test')                 |
|                | window for creating    |                            |
|                | and modifying files.   |                            |
+----------------+------------------------+----------------------------+

### 

The VCS module is designed to provide access to the VCS graphical
interface. For further information on VCS, see Web site
**http://www-pcmdi.llnl.gov/softwar**e. To use the VCS module in CDAT,
type: **import vcs**

+----------------+------------------------+----------------------------+
| **Command**    | **Description**        | **Examples**               |
+----------------+------------------------+----------------------------+
| init()         | Initializes and        | x=vcs.init()               |
|                | creates a VCS object,  |                            |
|                | reads in the           |                            |
|                | initial.attribute file |                            |
|                | and set up the VCS     |                            |
|                | default values.        |                            |
|                |                        |                            |
|                | Note: The number of    |                            |
|                | VCS Canvases is        |                            |
|                | limited to eight.      |                            |
+----------------+------------------------+----------------------------+
| animate()      | Pops up the VCS        | f=cu.open('clt.nc')        |
|                | animation GUI,         |                            |
|                | allowing animations to | s=f.getslab('clt')         |
|                | be run in the VCS      |                            |
|                | canvas.                | x=vcs.init()               |
|                |                        |                            |
|                |                        | x.plot(s)                  |
|                |                        |                            |
|                |                        | x.animate()                |
+----------------+------------------------+----------------------------+
| clear()        | This routine clears    | f=cu.open('clt.nc')        |
|                | all the displays on a  |                            |
|                | page (i.e., the VCS    | s=f.getslab('clt')         |
|                | Canvas).               |                            |
|                |                        | x=vcs.init()               |
|                |                        |                            |
|                |                        | x.plot(s)                  |
|                |                        |                            |
|                |                        | x.clear()                  |
+----------------+------------------------+----------------------------+
| cgm(           | To save a graphics     | f=cu.open('clt.nc')        |
| 'output_name', | plot in CDAT, the user |                            |
| \['mode'\])    | calls **cgm** along    | s=f.getslab('clt')         |
|                | with the name of the   |                            |
|                | output. This routine   | x=vcs.init()               |
|                | saves the displayed    |                            |
|                | image on the VCS       | x.plot(s)                  |
|                | Canvas as binary       |                            |
|                |                        | x.cgm('tp')                |
|                | vector graphics that   |                            |
|                | can be imported into   |                            |
|                | word processors such   |                            |
|                | as Microsoft Word or   |                            |
|                | Adobe Framemaker. CGM  |                            |
|                | files are an ISO       |                            |
|                | standards outputformat |                            |
|                |                        |                            |
|                | modes:                 |                            |
|                |                        |                            |
|                | a - append a to an     |                            |
|                | existing file.         |                            |
|                |                        |                            |
|                | r - replaces data in   |                            |
|                | an existing file with  |                            |
|                | a                      |                            |
+----------------+------------------------+----------------------------+
| close()        | This function does not | x=vcs.init()               |
|                | deallocate the VCS     |                            |
|                | Canvas object. It only | x.open()                   |
|                | disengages and         |                            |
|                | collapses the VCS      | x.close()                  |
|                | Canvas.                |                            |
+----------------+------------------------+----------------------------+
| colormapgui()  | Pops up the VCS        | x=vcs.init()               |
|                | colormap GUI, allowing |                            |
|                |                        | x.colormapgui()            |
|                | manipulation of the    |                            |
|                | colormap.              |                            |
+----------------+------------------------+----------------------------+
| g              | Allows the user to     | x=vcs.init()               |
| eometry(width, | position and size the  |                            |
| height,        | VCS Canvas after it is | x.open()                   |
| x-sc           | displayed on the       |                            |
| reen_position, | screen.                | x.geometry(400,200,0,0)    |
| y-screen\_     |                        |                            |
|                |                        |                            |
| position)      |                        |                            |
+----------------+------------------------+----------------------------+

+-------------+----------------------------------+---------------------+
| grid(       | Set the default plotting region  | x=vcs.init()        |
| shape=\[\]) | for variables that have more     |                     |
|             | dimension values than the        | x.gr                |
|             | graphics method. This function   | id(12,12,0,71,0,45) |
|             | is also be used for animating    |                     |
|             | plots over the third and fourth  |                     |
|             | dimensions.                      |                     |
+-------------+----------------------------------+---------------------+
| lis         | Returns a Python list of VCS     | x=vcs.init()        |
| telements() | elements. That is, this function |                     |
|             | returns: template, data,         | x.listelements()    |
|             | boxfill, continent, isofill,     |                     |
|             | isoline, outfill, outline,       |                     |
|             | scatter vector, xvsy, xyvsy,     |                     |
|             | yxvsy, line, text, marker,       |                     |
|             | fillarea, format, and list.      |                     |
+-------------+----------------------------------+---------------------+
| open()      | This routine pops up the VCS     | x=vcs.init()        |
|             | Canvas for viewing and           |                     |
|             | displaying images.               | x.open()            |
+-------------+----------------------------------+---------------------+
| page()      | Changes the VCS Canvas           | x=vcs.init()        |
|             | orientation to either 'Portrait' |                     |
|             | or 'Landscape'.                  | x.open()            |
|             |                                  |                     |
|             |                                  | x.page()            |
+-------------+----------------------------------+---------------------+
| plot(a,     | Draws the data (or arrayobject)  | f=                  |
| 'temp       | in the VCS Canvas. If no data is | cu.open(\'clt.nc\') |
| late_name', | given, then an error is          |                     |
|             | returned. The 'template' and     | s                   |
| 'graphi     | 'graphics method' are optional.  | =f.getslab(\'clt\') |
| cs_method', | If the 'template' or 'graphics   |                     |
|             | method' are not given, then      | x=vcs.init()        |
| 'grap       | default settings will be used.   |                     |
| hics_name') | See the **PyVCS_set** function   | x.plot(s)           |
|             | to set the 'template' and        |                     |
|             | 'graphics method'.               | x.pl                |
|             |                                  | ot(s,\'AMIP\',\'iso |
|             |                                  | line\',\'default\') |
+-------------+----------------------------------+---------------------+
| postscr     | This function outputs a          | f=                  |
| ipt('postsc | Postscript file, by first saving | cu.open(\'clt.nc\') |
| ript_name', | a CGM file, then using gplot to  |                     |
| \['orie     | convert the CGM file to a        | s                   |
| ntation'\]) | Postscript file in the chosen    | =f.getslab(\'clt\') |
|             | location. The 'postscript_name'  |                     |
|             | specifies the name and location  | x=vcs.init()        |
|             | of the file. The 'orientation'   |                     |
|             | indicates whether the Postscript | x.plot(s)           |
|             | file is 'landscape' or           |                     |
|             | 'portrait'. The default          | x.pos               |
|             | orientation is 'landscape'.      | tscript(\'tp\','p') |
|             |                                  |                     |
|             | orientation:                     |                     |
|             |                                  |                     |
|             | l - landscape                    |                     |
|             |                                  |                     |
|             | p - portrait                     |                     |
+-------------+----------------------------------+---------------------+
| p           | This function sends the VCS      | f=cu.open('clt.nc') |
| rinter('pri | Canvas plot(s) directly to       |                     |
| nter_name', |                                  | s=f.getslab('clt')  |
|             | the printer. 'printer name' is   |                     |
| \['orie     | the name of the Postscript       | x=vcs.init()        |
| ntation'\]) |                                  |                     |
|             | printer on the user's local area | x.plot(s)           |
|             | network, while 'orientation'     |                     |
|             | specfiies the hardcopy as either | x.printer(cirrus)   |
|             | 'landscape' or 'portrait'        |                     |
|             | orientation.                     |                     |
|             |                                  |                     |
|             | orientation:                     |                     |
|             |                                  |                     |
|             | l - landscape                    |                     |
|             |                                  |                     |
|             | p - portrait                     |                     |
+-------------+----------------------------------+---------------------+
| raster('ou  | In some cases, the user may wish | f=cu.open('clt.nc') |
| tput_name', | to save the file out as          |                     |
|             |                                  | s=f.getslab('clt')  |
| \['mode'\]) | a raster file. This function     |                     |
|             | allows a save of the VCS         | x=vcs.init()        |
|             |                                  |                     |
|             | Canvas output as a Sun           | x.plot(s)           |
|             | Microsystems raster file. This   |                     |
|             |                                  | x.animate()         |
|             | file can be converted to other   |                     |
|             | formats with the aid of **xv**   | x.raster('rp')      |
|             |                                  |                     |
|             | software or similar image tools  |                     |
|             | found freely on the              |                     |
|             |                                  |                     |
|             | World Wide Web.                  |                     |
|             |                                  |                     |
|             | modes:                           |                     |
|             |                                  |                     |
|             | a - append a to an existing      |                     |
|             | file.                            |                     |
|             |                                  |                     |
|             | r - replaces data in an existing |                     |
|             | file with a                      |                     |
+-------------+----------------------------------+---------------------+
| resetgrid() | Set the plotting region to       | x=vcs.init()        |
|             | default values.                  |                     |
|             |                                  | x.gr                |
|             |                                  | id(12,12,0,71,0,45) |
|             |                                  |                     |
|             |                                  | x.resetgrid()       |
+-------------+----------------------------------+---------------------+
| scr         | This function gives Python the   | x=vcs.init()        |
| ipt('VCS_sc | ability to read in a VCS         |                     |
| ript_name') |                                  | x.scrip             |
|             | script, a handy feature when     | t('mytemplate.scr') |
|             | working with the VCS             |                     |
|             |                                  |                     |
|             | interface and CDAT.              |                     |
+-------------+----------------------------------+---------------------+

+--------------+---------------------------------+--------------------+
| set('el      | Sets the default primary        | x=vcs.init()       |
| ement_type', | elements: **templat**e, and     |                    |
|              | **graphics method**s, and the   | x.listelements()   |
| 'el          | secondary element **colo**r.    |                    |
| ement_name') | The **template** determines the | x.show('isofill')  |
|              | appearance of each segment; the |                    |
|              | **graphics method** specifies   | x.set('            |
|              | the display technique; and the  | isofill','AMIP_clt |
|              | data defines what is to be      | ')                 |
|              | displayed.                      |                    |
|              |                                 |                    |
|              | Note: The data cannot be set.   |                    |
|              | The **colormap** can be set     |                    |
|              |                                 |                    |
|              | here or by means of the         |                    |
|              | colormap GUI.                   |                    |
+--------------+---------------------------------+--------------------+
| setc         | This routine brings up CDAT's   | x=vcs.init()       |
| olormap('col | colormap editor (which          |                    |
| ormap_name') |                                 | x.set              |
|              | is the same as in VCS), when    | colormap(\'AMIP\') |
|              | changes in the color map        |                    |
|              |                                 |                    |
|              | are desired.                    |                    |
+--------------+---------------------------------+--------------------+
| setminma     | This function sets the VCS      | x=vcs.init()       |
| x(min_value, | Canvas global minimum           |                    |
|              |                                 | f=c                |
| max_value,   | and maximum values. It also     | u.open(\'clt.nc\') |
| underflow,   | indicates underflow and         |                    |
|              |                                 | s=                 |
| overflow)    | overflow values. (That is,      | f.getslab(\'clt\') |
|              | values that are less than the   |                    |
|              |                                 | x.setm             |
|              | minimum are underflow values    | inmax(20.5,90,1,1) |
|              | and values that are             |                    |
|              |                                 | x.plot(s)          |
|              | greater than the maximum are    |                    |
|              | overflow values.) To            |                    |
|              |                                 |                    |
|              | reset the minimum and maximum   |                    |
|              | to the default values,          |                    |
|              |                                 |                    |
|              | use                             |                    |
|              | **x.setminmax(1e20,1e20,0,0)**  |                    |
+--------------+---------------------------------+--------------------+
| show('el     | List the primary attributes set | x=vcs.init()       |
| ement_type') | names for: **templat**e,        |                    |
|              |                                 | x.show('isofill')  |
|              | **graphics method**s, or        |                    |
|              | **dat**a. This function also    |                    |
|              | lists the                       |                    |
|              |                                 |                    |
|              | secondary attribute set names,  |                    |
|              | such as: **colorma**p, **fill** |                    |
|              |                                 |                    |
|              | **are**a, **forma**t, **lin**e, |                    |
|              | **marke**r, **lis**t, **tex**t, |                    |
|              | or **text**                     |                    |
|              |                                 |                    |
|              | **orientatio**n.                |                    |
+--------------+---------------------------------+--------------------+

  --------------- --------------------------------- ---------------------
                                                    

                                                    

                                                    
  --------------- --------------------------------- ---------------------