Data model

This module introduces the NCL data model and explains the concepts that are needed to understand how data is managed and manipulated using NCL.

The NCL data model is patterned after the data model used in netCDF (network Common Data Form) files from Unidata. NetCDF data structures are stored in self-describing, machine-independent files. The data structures contain variables, coordinates, dimensions, and metadata information that describe data and file characteristics such as units of measure, or other descriptive text. NCL shares these concepts with netCDF. In particular, the NCAR Command Language supports the use of metadata information for managing data. For example, users can read or assign descriptive text about a variable such as variable names, units, valid ranges, data minimums and maximums, missing values, and coordinate indices.

NCL manages your data using the concept of a file variable. A file variable is an internal data structure that references and describes file variables and provides information about dimensions, coordinates, and attributes for each variable in the file in addition to the file itself. A file variable can hold up to 512 variables and 32 dimensions, in addition to an unlimited number of attributes of many primitive data types. Variables, attributes, and coordinate variables can be one of the following primitive data types: float, double, short, long, integer, character, or byte.

Although the NCL data model is patterned after netCDF, the netCDF format is not the only file format that will be supported by NCL. NCL is designed to allow other formats similar to netCDF to be added to the NCL environment.

In addition to supporting self-describing formats like netCDF, NCL provides functions and procedures for reading and writing ascii and binary files. However, attributes and other metadata information cannot be read from or written to ascii and binary files. This information must be added manually using NCL statements.

NCL data is described and managed using named dimensions, named variables, coordinate variables, and attributes.

Dimensions

NCL dimensions define the shape and size of a variable. A variable or data file can have up to 32 dimensions, and they can be any size. These dimensions may also have names.

Variables

NCL variables are symbolic representations of multidimensional arrays. Scalar variables are represented as a single dimension array of size 1. Variables can have any of the following types: float, double, short, long, integer, byte, character, or string.

Variable names are case sensitive and must begin with a letter or an underscore '_'. Any combination of characters and numbers can make up the rest of the name. The maximum length of a variable name is 256 characters.

Coordinate variables

NCL Coordinate variables are used to represent data coordinates. Each dimension of a variable can have a one-dimensional array of coordinate points that define the coordinates of the data along a single dimension.

Array subscripting

Array subscripting or indexing is used to select subsets or specific elements of a data array. Data is ordered in a row x column fashion, and NCL supports three different methods of array subscripting so that users can access and manipulate their data in a way that is the most meaningful and intuitive to them. Standard subscripting is similar to array indexing used in FORTRAN 90. Coordinate subscripting uses coordinate variable data to select array subsets. Named subscripting uses the names of the dimensions to allow for array dimension reordering operations.

Attributes

NCL attributes are the metadata that describe a variable or data file and its contents. The attributes can specify data range, variable sizes, a file title, a file history, and any other user-defined descriptive information. Attributes can have any valid NCL type. Common variable attributes are the valid range of the variable, the units, the long name of the variable and other user-defined information. Common data file attributes are the file title and date. Variables and files can have as many attributes as the user desires.

Data types and coercion

Extensive information about NCL data types and coercion between different types appears in the Data Types Overview module in the NCAR Graphics Reference Manual.


User Guide Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?


$Revision: 1.7 $ $Date: 1998/06/15 22:08:49 $