Data in the MCD are written in DRS format. If you are not using a package (such as GrADS) which can read DRS format you can write a program in FORTRAN (or some other language, such as C or IDL) to access the data using the DRS library. We supply several FORTRAN subroutines which are also used in the MarsGRAM-style interface to the MCD (see Section 4.2) to help in this process. The advantage of this method of access over GrADS, for example, is that the large- and small-scale variability models may be used if the appropriate subroutines are called.
To access the data you must first open the file. An example of opening an MCD file within a FORTRAN program is shown here.
.
.
#include "drsdef.h"
.
.
integer udrs ! DRS file unit number
integer ierr
character*256 datfile ! DRS data file
character*256 dicfile ! DRS dictionary file
.
.
udrs=60
datfile='/FULL/PATH/NAME/mcd/data/viks04me.dat'
dicfile='/FULL/PATH/NAME/mcd/data/viks04me.dic'
ierr=aslun(udrs,dicfile,udrs+1,datfile,IDRS_READ)
.
.
! read some DRS data
.
.
ierr=cllun(udrs) ! close the file again
.
.
Once the file has been opened you can read data from the MCD either by using the DRS routines directly or by using subroutines from the mcdgm directory. The following routines may prove particularly useful. Each is commented within the code to indicate the type and size of arguments which it expects; note that in some cases the number of arguments has changed since earlier versions of the MCD. The MCDGM program provides one example of how to call these routines (examine the dstep.f routine in particular).