SDS(4)
NAME
sds.h
SYNTAX
#include <soi_sds.h>
DESCRIPTION
The SDS structure provides a convenient generalized
representation for data collections including both func-
tional data values and ancillary data. It is an internal
representation only, supporting multiple external represen-
tations. There are a large number of functions designed to
manage and manipulate SDS structures. The following
declarations are from <soi_sds.h>:
/*
* Structures and definitions
*/
typedef struct sds {
struct sds *next; /* Pointer to next sds */
RECORD *recinfo; /* record numbers of data */
DIMENSION *diminfo; /* dimension layout of data */
SDS_STATS *stats; /* data statistics */
SDS_COLOR *color_table; /* color table */
char *varname; /* Name of sds */
void *fillvalue; /* missing data 'value' */
void *data; /* Pointer to data */
int data_quality; /* data quality indicator */
int datatype; /* Type of data */
int numbytes; /* Bytes per data element */
AXIS *axisinfo; /* independent var info */
ATTRIBUTES *attrinfo; /* local attribute info */
FILE *fp; /* pointer for stream I/O */
char *filename; /* filename for external rep */
int own_data; /* disable freeing data */
float bscale; /* advisory output scaling */
float bzero; /* advisory output offsett */
int scale_on_write; /* output advice */ }
SDS;
typedef struct record {
long recvariance; /* Record variance */
long startrecord;
long numrecords;
long recinterval; /* Interval between records */
} RECORD;
typedef struct dimension {
int rank; /* dimensionality of data */
int *length; /* Num indices from each */
int *dimvary; /* Dimensional variance */
int *startind; /* starting indices */
int *indinter; /* intervals between indices */ }
DIMENSION;
typedef struct sds_stats_struct {
union {
double dm;
float fm;
long int lm; unsigned int ulm;
int im; unsigned int uim;
short sm; unsigned short usm;
char cm; unsigned char ucm;
} min; /* Data Minimum in native type */
union {
double dm;
float fm;
long int lm;
int im;
short sm;
char cm;
} min_abs; /* Minimum of absolute value */
union {
double dm;
float fm;
long int lm; unsigned int ulm;
int im; unsigned int uim;
short sm; unsigned short usm;
char cm; unsigned char ucm;
} max; /* Data Maximum in native type */
double minact; /* Actual min of the data */
double maxact; /* Actual max of the data */
double rangemin; /* Legal min of the data */
double rangemax; /* Legal max of the data */
double median; /* median data value */
double mean;
double stdev;
double skewness;
double kurtosis;
char *var_name; /* Variable's name */
char *format; /* C's printf format */
unsigned long numvals; /* Number of valid data */
unsigned short statvalid; /* Are statistics valid? */ }
SDS_STATS;
typedef struct color {
int BitsPerPixel;
int *Red;
int *Green;
int *Blue; } SDS_COLOR;
typedef struct axis {
int *axis_datatype;
void *start;
void *stepsize;
char **units;
char **format;
char **title; } AXIS;
typedef struct attribute {
struct attribute *next; /* Next attribute struct */
char *attrname; /* Name of attribute */
void *attrvalue; /* Pointer to attribute value */
char *comment; /* Holds a comment */
int datatype; /* Attribute value's type */
} ATTRIBUTES;
/* datatype definitions */
#define SDS_VOID 0
#define SDS_BYTE 1
#define SDS_UBYTE 2
#define SDS_SHORT 3
#define SDS_USHORT 4
#define SDS_INT 5
#define SDS_UINT 6
#define SDS_LONG 7
#define SDS_ULONG 8
#define SDS_FLOAT 9
#define SDS_DOUBLE 10
#define SDS_COMPLEX 11
#define SDS_STRING 12
#define SDS_TIME 13
#define SDS_LOGICAL 14
#define SDS_ANY 15
/* supported file types */
#define SDS_NOTYPE (0)
#define SDS_RAW (1)
#define SDS_SDS (2)
#define SDS_MDI_HRTLM (3)
#define SDS_MDI_LRTLM (4)
#define SDS_TIFF (5)
#define SDS_FITS (6)
#define SDS_CDF (7)
#define SDS_FITS_TABLE (8)
#define SDS_RDB (9)
#define SDS_GIF (10)
/* SDS data pointer ownership */
#define SDS_NEVER_FREE (0)
#define SDS_OK_TO_FREE (1)
FUNCTION PROTOTYPES
SDS creation, replication, and free routines
SDS *sds_create ();
int sds_free ();
SDS *sds_construct (int rank, int *length, int datatype,
void *fillval);
SDS *sds_make_sds (int rank, int *length, int datatype, void
*data);
SDS *sds_replicate (SDS *sdsin);
SDS *sds_dup_header (SDS *sdsin);
SDS *sds_steal_data (SDS *sdsin);
SDS *sds_short_template (SDS *sdsin);
STATS *sds_create_stats ();
Utilities for manipulating the data
int sds_fill_data (SDS *sdsptr, void *fillvalue);
int sds_convert (SDS *sds_in, int type_out);
SDS *sds_slice (SDS *sds, int *start, int *end);
SDS *sds_slice_file (FILE *fp, int *start, int *end);
C++ style access functions
ATTRIBUTES *sds_attributes (SDS *sdsptr);
STATS *sds_stats_ptr (SDS *sdsptr);
void *sds_data (SDS *sdsptr);
short sds_datatype (SDS *sdsptr);
int sds_rank (SDS *sdsptr);
void sds_update_stats (SDS *sdsptr, STATS *statptr);
int sds_dim_n (SDS *sdsptr, int n);
int sds_dim0 (SDS *sdsptr);
int sds_dim1 (SDS *sdsptr);
int sds_dim2 (SDS *sdsptr);
long sds_data_length (SDS *sdsin);
SDS *sds_set_parent (SDS *sdsin, IDS *idsparent);
SDS *sds_set_datatype (SDS *sdsin, short datatype);
SDS *sds_set_rank (SDS *sdsin, int rank);
SDS *sds_set_length (SDS *sdsin, int *length);
SDS *sds_set_fillvalue (SDS *sds, void *fillvalue);
SDS *sds_set_data (SDS *sds, void *data);
double sds_query_value_d (SDS *sds, char *key);
char *sds_query_value_s (SDS *sds, char *key);
FILE *sds_stream (SDS *sds);
Attribute Queries
void *sds_search_attrvalue (SDS *sds, char *key);
char *sds_search_attrvalue_str (SDS *sds, char *key);
double *sds_search_attrvalue_double (SDS *sds, char *key);
double *sds_attribute_type (SDS *sds, char *key);
Attribute Manipulation Routines
int sds_set_attribute (SDS *sds, char *key);
int sds_copy_attr (SDS *out, SDS *in, char *key);
int sds_copy_attrs (SDS *out, SDS *in);
int sds_remove_attribute (SDS *sds, char *key);
int sds_set_attr_str (SDS *sds, char *attrname, char
*attrvalue);
ATTRIBUTES *sds_first_attr (SDS *sds);
ATTRIBUTES *sds_next_attr (ATTRIBUTES *attr);
ATTRIBUTES *sds_last_attr (SDS *sds);
ATTRIBUTES *sds_search_attr (SDS *sds, char *key);
I/O routines
short sds_out (SDS *sdsptr, char *outfile, int
sds_filetype);
SDS *sds_in (char *infile, int sds_datatype, int
sds_filetype);
SDS *sds_read_sds (FILE *in);
SDS *sds_read_raw (FILE *in, int datatype);
int sds_write_raw (SDS *in, FILE *out);
int sds_write_sds (SDS *in, FILE *out);
SDS *sds_read_FITS_header (char *filename);
SDS *sds_read_fits (FILE *in);
int sds_write_fits (SDS *sds, FILE *out);
SDS *sds_get_one_fits (char *filename);
int sds_output_headers (SDS *sds, FILE *fp);
int sds_get_fits_header (SDS *sds, FILE *fp);
int sds_get_fits_data (SDS *sds, FILE *fp);
int sds_output_data (SDS *sds, FILE *fp);
int sds_put_one_fits (SDS *sds, char *outfile);
int sds_put_fits_header (SDS *sds, FILE *fp);
int sds_put_fits_data (SDS *sds, FILE *fp);
SDS *sds_read (FILE *infp, int type, int filetype);
Axis Routines
AXIS *sds_axisinfo (SDS *sds);
AXIS *sds_nth_axis (SDS *sds, int axis_number);
int sds_set_axis (SDS *sds, int *axis_datatype, void *start,
void *stepsize, char **units, char **format, char **title);
SEE ALSO
sds_bscale(3), sds_bzero(3), sds_masks(3), sds_query(3),
sds_read_header(3), sds_set(3), sds_set_parent(3),
sds_set_rank(3)
BUGS
Not all of the SDS manipulation functions are documented.
Some of them are of purely historical interest and should be
removed. Not all of the defined datatypes and filetypes are
supported well or in some cases at all.
Nobody knows what SDS stands for.
HISTORY
1996-12-12 SOI Version 2.1