cdds_read transfer data from an input file to an application buffer. A byte image is transfered; no data conversions are performed (Users may modify fields on reading by specifying read: Definitions). For example:
int in_bin; float *buf; ... /* read 10 traces into buffer */ ier = cdds_read(in_bin, 0, buf, 10);
cdds_map converts fields from one trace buffer to another. The conversions are specified by Map Definitions. They may be defined by the user, program or default files. These Definitions are retrieved, when cdds_openm is executed either explicitly or implicity by DDS the first time it's needed as long as the associated binary dictionary is still open. Map Definitions have the following syntax (see User Mapping).
map:in:out.out_field= expression
map:usp:segy.OrigRecNum= RecNum map:in:buf.ToTmAU= 4 * TTIMAU map:buf:out.ToTmAU= 4 * TTIMAU comment= subscripts are zero based map:usp:abc.time= TVPair[0] map:usp:abc.velocity= TVPair[1] comment= don't map (change) gamma map:*:abc.gamma= void comment= "ident" required for names with special characters map:*:usp.SrRcMX= ident("MID-X") comment= support for defined constants map:usp:abc.xyz= defn_value("hist:", "gamma")
The value of the Map Definition is an algebraic expression. Map Definitions are ignored, unless they match the format or alias and field name. If a Map Definition is not specified for an output field, an input field by the same name is used by default. The field type (integer, float, ...) and style (ieee, IBM, ...) are converted as needed.
int in_bin, inbuf_bin; float *in_buf, *inbuf_buf; ... cdds_map(inbuf_bin, 0, inbuf_buf, in_bin, 0, in_buf);
The buffer mapping can be done at the same time as the data transfer by the use of cdds_readm and cdds_writem. They combine the functionality of cdds_map with read/write. This is more convenient and efficient, for most applications, than executing two functions and managing two buffers (DDS uses an internal buffer for the external data).
int in_bin, buf_bin, out_bin int *buf; ... /* read 10 traces into buffer */ ier = cdds_readm(in_bin, 0, buf_bin, 0, buf, 10); ... /* apply processing to buffer */ ... /* write 10 traces from buffer */ ier = cdds_writem(out_bin, 0, buf_bin, 0, buf, 10);
int out_bin; float *buf; ... /* write 10 traces from buffer */ ier = cdds_write(out_bin, 0, buf, 10);