IDL interface to Transp data

08Mar2010
jec


Transp provides an interface which enables IDL procedures to access Transp data stored in netCDF files. This is implemented as a set of wrapper routines ( written in c ) which call Transp routines associated with the rplot calculator utility. This document describes the scripts used to generate shared libraries containing the Transp & interface routines.

Components

rpcalc_c.a
Transp library containing the c  wrapper routines called by IDL ( listed here )
 
trread.a, rp_kernel.a  etc
rplot calculator routines to be accessed ( see rplot/rplot_exe.link for a full list )
 
portlib.a
Transp interface to the OS
 
libportlib.so
Shared object version of portlib, built by portlib/makefile.inf
 
librpread.so
Shared object library containing the interface routines, excluding portlib
 
librpcalc.so
Alternative shared object library containing the interface routines, including portlib, provided for backwards compatibility
 
rpcalc_test
Transp source directory, contains a ( fortran ) test program for the interface
 
rpcalc_so_test
Variant of rpcalc_test, linked against librpcalc.so ( & built by rpcalc/makefile.inf )

Dependencies

Dependencies of the Transp static libraries on the source files are ignored in the rpcalc makefiles - it is assumed that all Transp libraries are up to date. Running linkcheck noexe ( or uplink rplot ) first will ensure that this is the case

Sample logfiles ( with the ld option -t ) list all the object files used, and the libraries where they are found

librpread

librpread.so is built by the file source/rpread/makefile.inf, in a 3 step process -

  1. Object files for the c wrapper routines are extracted from rpcalc_c.a
  2. These objects are linked with the remaining rplot ( static ) libraries, to produce a temporary relocatable output file ( 'ld -r' option )
  3. The temporary output file is relinked to produce the shared library librpread.so, with references to libportlib.so & the netcdf libraries.

Step 2, the static link step, selects only those routines actually needed from the set of rplot libraries , which is an improvement on the previous method, where all the files from all the libraries were included. The mds_dummy.a library is now included, & so the MDSplus & globus libraries are no longer needed.

librpcalc

librpcalc.so is built by the file source/rpcalc/makefile.inf.  This first makes the librpread temporary library ( librpread, steps 1 & 2 ) , but links this & the portlib.a static library together, to produce a single shared library librpcalc.so. This is backwards compatible with the previous librpcalc implementation, but having libportlib.so as a separate shared library is probably a better design decision

rpcalc_test

The rather simple fortran program rpcalc_test calls kconnect to open the netCDF file given as the first argument. It may be linked against the transp static libraries, in the traditional manner ( using uplink ). Two further options are available, from source/rpcalc/makefile.inf:-

rpcalc_so_test
Links rpcalc_test.o against librpcalc.so & the netCDF libraries
rpcalc_so_testr
Links against librpread.so, portlib.so & the netCDF libraries

The file rpcalc/env_csh.inf defines ( JET specific ) IDL library locations & $LD_LIBRARY_PATH - it should be sourced before running the shared object variants of rpcalc_test. All 3 variants of rpcalc_test give the same output ( shown below, with some debug statements compiled )

 rpcalc_test -I- reading ./50621R47.CDF
  dmg_datbuf_expand call from dmgini_sized: isize= 0
 rplot_io/cdfilop -I- opening ./50621R47.CDF
 rplot_io/cdfilop -I- luntrm =  6
  ... reading NetCDF header data ...
  cdfhrd: size(time) =  2048
  cdfhrd: size(time3) =  2048
 1000 - ierr  0
 kconnect : rconnect >  0
 rpcalc_test -I- kconnect returns  0
  run label : RUN 50621R47