<<<<<<<<<<<<<<<<<

cdf_extract_data(netcdf) VISAGE I/O" cdf_extract_data(netcdf)

NAME

cdf_extract_data - abstract class for arbitrary netCDF data extraction

DESCRIPTION

The cdf_extract_data object provides methods for extracting arbitrary pieces of data from a netCDF file. The subclasses of cdf_extract_data are used to pull arbitrary portions of data from netCDF files and variables and assemble them into VISAGE compatible data sets.

An important feature of this object is specifying selection criterion for extracting data from the netCDF file. The message is "selection=(var_name, dim_id,start,end, dim_id,start,end, ...)" where var_name is the name of a netCDF variable. If var_name is a n-dimensional variable, any portion of its data can be extracted using combinations of the selection indices dim_id,start,end. Dim_id refers to the dimension id (1,2,...,n), start refers to the starting value for this dimension, and end refers to the ending value for this dimension. Selection indices need not be specified for each dimension: if not specified for some dim_id the indices start and end are set to (1,1). By specifying multiple sets of selection indices it is possible to extract any hyperslab of data from any netCDF variable.

NOTE: See netCDF manual for more information. The selection indices (dim_id, start, end) are mapped into the "start" and "count" variable described for the ncvarget() netCDF function call. Unlike the netCDF C language bindings, however, the indices in LYMB are 1 offset (not zero!!!).

ANOTHER NOTE: Use the methods "variable=" and "dimension_names?" to get a list of dimensions for each variable. (The method "variable_names?" can be used to determine the names of the variables in the netCDF file.) The dim_id of a variable is simply its position in the list returned by "dimension_names?". To get the size of the dimension use the method "dimension_sizes?" or the combination of methods "dimension_name=" and "dimension_size?" for a particualr dimension.

SUPERCLASS

cdf_reader

INSTANCE VARIABLES

(none - inherited from superclass)

MESSAGES

hyperslab? Method (usually used internally) used by subclasses to pull out hyberslab of data from netCDF variable.

Returns FPTR on argument stack.

selection= (var_name, dim_id,start,end, dim_id,start,end, ...) Set the selection list for extracting hyperslab.

selection? return the value of the current selection list.

create_data_out! Creates an output data set if one doesn't already exist.

free! Free internal memory and return to superclass to free object.

EXAMPLE

Data is extracted from netCDF file as separate unstructured point set geometry, scalar, and vector. The merge_data_sets filter is used to paste them together to form a single data set.

/* * Scripts tests the cdf_extract_data objects */ /* * For scalar extract portion of y-components of velocity data * (second time step) */ scalar new: no_pts = 10; /* set size of data to extract */

cdf_extract_scalar new: scalar_reader filename=`test.cdf' selection=(velocity, 1,2,2, 2,1,no_pts, 3,2,2) ;

/* * Extract third time step of velocity data */ cdf_extract_vector new: vector_reader filename=`test.cdf' vx_selection=(velocity, 1,3,3, 2,1,no_pts, 3,1,1) vy_selection=(velocity, 1,3,3, 2,1,no_pts, 3,2,2) vz_selection=(velocity, 1,3,3, 2,1,no_pts, 3,3,3) ;

/* * Extract first time step of pressure for x-axis; second time step * of velocity z-component for y-axis; points (i.e., * test_grid) y coordinates for z-axis */ cdf_extract_unstructured_points new: geom_reader filename=`test.cdf' x_selection=(pressure, 1,1,1, 2,1,no_pts, 3,1,1) /* default 3,1,1 */

y_selection=(velocity, 1,2,2, 2,1,no_pts, 3,3,3) z_selection=(test_grid, 1,1,no_pts, 2,2,2) ;

merge_data_sets new: merge data_in= (geom_reader, scalar_reader, vector_reader) output! ;

SEE ALSO

cdf_reader, cdf_extract_scalar, cdf_extract_vector, cdf_extract_unstructured_points


Please send comments and suggestions to
consult@rpi.edu