Personal tools
You are here: Home CDAT Tips and Tricks File I/O Tips Opening dataset.
Document Actions

Opening dataset.

by Renata McCoy last modified 2007-05-01 13:45

  Table of Contents Previous Next
Contents Previous Next

Goal: Learn how to open a detaset (multiple files) in CDAT.


A dataset variable is associated with a dataset, a collection of files that is treated as a single file. A dataset is created with the cdscan utility. This generates an XML metafile that describes how the files are organized and what metadata are contained in the files. In a climate simulation application, a dataset typically represents the data generated by one run of a general circulation or coupled ocean-atmosphere model.

For example, suppose data for variables u and v are stored in six files:
u_2000.nc, u_2001.nc, u_2002.nc, v_2000.nc, v_2001.nc, and v_2002.nc.
A metafile can be generated with the command:

% cdscan -x cdsample.xml [uv]*.nc

he metafile cdsample.xml is then used like an ordinary data file:

import cdms
f = cdms.open(’cdsample.xml’)
u = f(’u’)
u.shape
(3, 16, 32)
u.info() # get all the info about this variable


  Table of Contents Previous Next
Contents Previous Next

Powered by Plone