next up previous contents
Next: B.6 Example IDL Session Up: B IDL Support Previous: B.4 On-Line Help

B.5 Available Functions

The CDF functions/procedures available at the IDL command line exactly mirror the Standard and Internal Interface functions available for a program written in C.gif The CDF C Reference Manual describes the functionality of each in detail. The syntax required when calling each function is as follows...

   IDL> status = CDFlib (op1, ...)
   IDL> status = CDFcreate (CDFpath, numDims, dimSizes, encoding, majority, $
   IDL>                     id)
   IDL> status = CDFopen (CDFpath, id)
   IDL> status = CDFdoc (id, version, release, copyright)
   IDL> status = CDFinquire (id, numDims, dimSizes, encoding, majority, $
   IDL>                      maxRec, numVars, numAttrs)
   IDL> status = CDFclose (id)
   IDL> status = CDFdelete (id)
   IDL> status = CDFerror (status, text)
   IDL> status = CDFattrCreate (id, attrName, attrScope, attrNum)
   IDL> status = CDFattrRename (id, attrNum, attrName)
   IDL> status = CDFattrInquire (id, attrNum, attrName, attrScope, maxEntry)
   IDL> status = CDFattrEntryInquire (id, attrNum, entryNum, dataType, $
   IDL>                               numElems)
   IDL> status = CDFattrPut (id, attrNum, entryNum, dataType, numElems, value)
   IDL> status = CDFattrGet (id, attrNum, entryNum, value)
   IDL> status = CDFvarCreate (id, varName, dataType, numElems, recVary, $
   IDL>                        dimVarys, varNum)
   IDL> status = CDFvarRename (id, varNum, varName)
   IDL> status = CDFvarInquire (id, varNum, varName, dataType, numElems, $
   IDL>                         recVary, dimVarys)
   IDL> status = CDFvarPut (id, varNum, recNum, indices, value)
   IDL> status = CDFvarGet (id, varNum, recNum, indices, value)
   IDL> status = CDFvarHyperPut (id, varNum, recStart, recCount, recInterval, $
   IDL>                          indices, counts, intervals, buffer)
   IDL> status = CDFvarHyperGet (id, varNum, recStart, recCount, recInterval, $
   IDL>                          indices, counts, intervals, buffer)
   IDL> status = CDFvarClose (id, varNum)
   IDL> attrNum = CDFattrNum (id, attrName)
   IDL> varNum = CDFvarNum (id, varName)
   IDL> status = CDFlib (op1, ...)
   IDL> epoch = computeEPOCH (year, month, day, hour, minute, second, $
   IDL>                       millisecond)
   IDL> EPOCHbreakdown, epoch, year, month, day, hour, minute, second, $
   IDL>                 millisecond
   IDL> epoch = parseEPOCH (epochString)
   IDL> encodeEPOCH, epoch, epochString
   IDL> encodeEPOCH1, epoch, epochString
   IDL> encodeEPOCH2, epoch, epochString
   IDL> encodeEPOCH3, epoch, epochString

The IDL data types to use for integer arguments are always longwords or arrays of longwords using IDL's data type of TYP_LONG.gif Attribute entries and variable values should have the data types corresponding their CDF data types. CDF pathnames and variable/attribute names are IDL character strings. CDFid and CDFstatus are also longwords. The CDF C Reference Manual may be used as a guide (especially for CDFlib). Arguments passed to the CDF functions/procedures must obviously be created and initialized before the call. Arrays of longwords are necessary for dimension sizes, variances, etc.gif Arguments returned by the CDF functions will be created to be of the proper data type and size (they do not have to be created before calling the CDF function).

NOTE: There is one difference between how the Internal Interface (CDFlib) is used in IDL and in a C/Fortran application. In IDL the current CDF must be selected each time CDFlib is called. Failure to select the current CDF may result in IDL crashing.

Also provided are two functions, row_to_col and col_to_row, that may be used to change the majority of an array (or arrays) of values. This function is necessary because CDF can store variable values in either row or column major order. The syntax of row_to_col is as follows...

   IDL> status = row_to_col (inArray, outArray, numDims, dimSizes, numBytes, $
                             arrayCount

where...

Multiple arrays (records) of CDF variable values should always be stored with the last dimension of the IDL array corresponding to the record number. For example, assume a CDF variable with two dimensions whose sizes are [180,360]. If 50 records are to be stored, an IDL array with three dimensions whose sizes are [180,360,50] should be used. If the CDF variables have row major ordering, row_to_col would be called with numDims set to 2, dimSizes set to [180,360], and arrayCount set to 50.

The syntax of col_to_row is as follows...

   IDL> status = col_to_row (inArray, outArray, numDims, dimSizes, numBytes, $
                             arrayCount

where...

col_to_row would be used in those cases where an array of values created by IDL (in column-major ordering) are to be written to a row-major CDF.



next up previous contents
Next: B.6 Example IDL Session Up: B IDL Support Previous: B.4 On-Line Help



cdfsupport@nssdca.gsfc.nasa.gov