In addition to functioning as a command line interpreter, NCL has an API for submitting NCL scripts from within an application. The API provides GUI and application writers a uniform way to do data access, manipulation, and visualization from within their application using NCL scripts. This should simplify the implementation of application-specific GUIs by reducing design time spent on the visualization code and the data access code.
There are several functions and a special NCL library needed to use the API. The name of the library is libnclapi.a. It should be located in the same directory that NCAR Graphics is installed in. To use the API, you must link to this library and use the following functions. NclInitServer and NclCloseServer must be called at the beginning and end of the application respectively.
typedef union _NclApiScalar { double doubleval; float floatval; int intval; long longval; short shortval; char charval; string stringval; byte byteval; logical logicalval; obj objval; }NclApiScalar;
struct _NclExtValueRec { int type; int constant; void *value; NclApiScalar missing; int elem_size; int totalelements; int n_dims; int dim_sizes[NCL_MAX_DIMENSIONS]; }; typedef struct _NclExtValueRec NclExtValueRec;
struct _NclApiDataList { int kind; struct _NclApiDataList *next; union { struct _NclApiFuncInfoRec *func; struct _NclApiVarInfoRec *var; struct _NclApiFileInfoRec *file; struct _NclApiHLUVarInfoRec *hlu; struct _NclApiHLUObjInfoRec *hlu_obj; } u; }; struct _NclApiHLUObjInfoRec { NclQuark name; int obj_id; NhlClass obj_class; }; struct _NclApiHLUVarInfoRec { NclQuark name; int n_objs; struct _NclApiHLUInfoRec* objs; }; struct _NclApiHLUInfoRec { NclQuark obj_name; NclQuark obj_class; int obj_id; }; struct _NclApiFuncInfoRec { NclQuark name; int kind; int nparams; struct _NclArgTemplate *theargs; }; struct _NclApiVarInfoRec { NclQuark name; NclQuark data_type_quark; NclVarTypes type; /* value, hlu, file */ int n_dims; NclDimRec *dim_info; int n_atts; NclQuark *attnames; }; struct _NclApiFileInfoRec { NclQuark name; NclQuark path; int file_type; int wr_status; int n_dims; NclDimRec *dim_info; int n_atts; NclQuark *attnames; int n_vars; NclQuark *var_names; };
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?