Previous: Madrigal developer's guide   Up: Madrigal developer's guide   Next: Python API

Madrigal internal API overview

The Madrigal server API's allow programmers to write programs which access CEDAR format files and Madrigal metadata. Unlike the Madrigal remote access API's, these API's run locally on the Madrigal server, and are the heart of the Madrigal server.

There are five applications programming interfaces (API's) to madrigal: C, Python, Fortran, Tcl, and Matlab. The vast majority of Madrigal is based directly on the C-language API, which is the only language to directly read and write Cedar format files. The Cedar format file reading and writing through both Python and Tcl are built on top of the C API. To use these API's you should be familiar with the CEDAR File Format .

The C-language API has two major components: madrec and maddata. The madrec module is file-oriented. It supports all four versions of the CEDAR format in addition to the Madrigal version of the CEDAR format. The maddata module is a higher level interface into Madrigal data, and treats derived parameters and measured parameters from files as the same, and is the basis for isprint output. The maddata module is also meant to be easily extensible as described in the C API documentation. The C API is compiled into the madrec library, which is installed in madroot/lib.

The python API is also built on the C API, and is used for the majority of cgi and administrative scripts, and the entire remote access interface. Madrigal installs its own version of python under madroot, and the Madrigal python API is installed under site-packages. In general, it is the easiest language to use to implement any functionality needed. With the release of Madrigal 2.4, there is now an easy-to-use python API to create and modify Cedar file formats. See the section of the administrative manual on creating Madrigal files for details. This internal python API should not be confused with the remote python API - the remote python API can be run from anywhere and simply connects over the internet to existing Madrigal servers; this internal python API is part of the Madrigal server itself.

The Tcl API is no longer being expanded, but is still used for a few of the cgi scripts and some of the administrative scripts. The tcl executable with the Madrigal extensions is installed as madroot/bin/madtclsh.

The Matlab interface is simply a somewhat higher speed version than the remote Matlab API , but can only run locally. The administrator controls whether and where it is installed, as described in the installation page.

There are two parts to the Fortran API now included in Madrigal. The first part is simply a wrapper around the C API (and indeed is simply Fortran calls that call the C API). The second part of the Fortran API includes a number of scientific methods that the C API calls. This second part of the Fortran API is compiled into the geo library, which is installed in madroot/lib.

Previous: Madrigal developer's guide   Up: Madrigal developer's guide   Next: Python API