2A.4 The MATLAB ADI Toolbox: A Framework for Bindings from MATLAB to C

Tuesday, 24 January 2017: 9:15 AM
608 (Washington State Convention Center )
Erol Cromwell, PNNL, Richland, WA

Atmospheric scientists typically use high-level object oriented or scripting programming languages, such as MATLAB, to code mathematical algorithms and models, taking advantage of built in features such as garbage collection and the myriad of available scientific libraries. However, lower-level, more structural languages, such as C and Fortran, are traditionally used to process intensive applications that need additional flexibility provided by structured languages. A common method of making these advanced libraries and frameworks available to atmospheric scientists is to create a binding from the higher-level language to the structured implementation. A binding is a wrapper library that allows one programming language to call and use another languages functions and methods. However, not all languages provide straightforward bindings to other languages. MATLAB supports function calling in shared C libraries, but there is no readily available process to create a binding to an entire C library.

We present a framework for creating bindings from MATLAB to C libraries through the lens of building a custom MATLAB Toolbox for the Atmospheric Radiation Measurement (ARM) program’s ARM Data Integrator (ADI). This paper describes the design of the MATLAB toolbox set up to mirror the functionality of the core ADI C libraries, while providing users an interface with a MATLAB look and feel. In addition, we detail our implementation of MATLAB wrapper functions for the ADI library functions and MATLAB wrapper classes for the ADI C data structures, enumerations, and macro definitions. Furthermore, we introduce the concept and use of helper C libraries to aid in the transition of complex input and output parameters (i.e. multidimensional arrays) between MATLAB wrapper functions and functions in C. To ensure functionality and correctness of the MATLAB binding, we built and tested five value-added products (VAPs) and one ingest in MATLAB.

- Indicates paper has been withdrawn from meeting
- Indicates an Award Winner