next up previous 399
Next: IDL2HDS - Convert an IDL variable to a Starlink HDS file.
Up: Specifications of CONVERT IDL Procedures
Previous: WRITE_NDF - Convert an IDL array to a Starlink NDF.


HDS2IDL - Convert a Starlink HDS file to an IDL variable.

Description:
This IDL function will convert a Starlink HDS object into an IDL variable. The object may be a structure or primitive so a complete NDF structure can be obtained, instead of just the single component produced by function READ_NDF.

Usage:
Result = HDS2IDL( filename )

Arguments:

filename
A string expression specifying an HDS object. The specification may include slices and cells of arrays.

Returned Value:

Result
An IDL variable corresponding to the HDS object. Structures and primitive types are not necessarily identical (see "Notes").

Notes:
  • Type correspondence is as follows:
    _REAL -$>$ floating
    _DOUBLE -$>$ double-precision
    _UBYTE -$>$ byte
    _WORD -$>$ integer
    _INTEGER -$>$ longword integer
    _LOGICAL -$>$ longword integer (with name change, see below)
    _CHAR -$>$ string (see below)
    _BYTE -$>$ integer (see below)
    _UWORD -$>$ longword integer (see below)
  • IDL structures will have an additional STRING component, named HDSSTRUCTYPE, specifying the type of the HDS structure to which it corresponds.
  • _LOGICAL HDS components become IDL LONG components with LOGICAL_ prefixed to their name. Any IDL byte, integer or longword structure component must have this name convention if it is to be converted to an HDS _LOGICAL component by IDL2HDS.
  • IDL strings created from HDS _CHAR components will have trailing spaces removed, so there is no way to determine the size of the original HDS component.
  • HDS types _BYTE and _UWORD become IDL components indistinguishable from components produced from HDS types _WORD and _INTEGER so, if they are converted back to HDS by IDL2HDS, their HDS type will have changed.
  • In an IDL array of structures, each element must be exactly the same structure. For HDS this is not the case, therefore an HDS array of structures, NAME, will become an IDL structure, NAME, with component HDSSTRUCTYPE set to TYPE(n,m,...) (where TYPE is the type of the HDS array of structures, and n, m etc. are the dimensions) and components NAME_i_j... etc. (where NAME_i_j... etc. are structures, one for each element of the HDS array of structures).

Examples:

IDL> data_struct = hds2idl('my_file')
Assuming my_file.sdf is an HDS, file this creates an IDL structure corresponding to it.


Deficiencies :
  • It is not possible to obtain an identical structure in all cases (see "Notes").
  • Complex values are not handled.

Related Applications :
CONVERT: IDL2HDS.



next up previous 399
Next: IDL2HDS - Convert an IDL variable to a Starlink HDS file.
Up: Specifications of CONVERT IDL Procedures
Previous: WRITE_NDF - Convert an IDL array to a Starlink NDF.

CONVERT A Format-conversion Package
Starlink User Note 55
Malcolm J. Currie
G.J.Privett
A.J.Chipperfield
D.S.Berry
A.C.Davenhall
2010 February 2
E-mail:ussc@star.rl.ac.uk

Copyright © 2005 Council for the Central Laboratory of the Research Councils