### The SicVar class

SicVar instances should be automatically initialized with the get() function. When importing a variable, get() calls the instance creator SicVar() with three arguments: SIC variable name (as a Python string), its level (as an integer), and memory address of its descriptor (Python integer). It is the own responsibility of the get() function to assign this instance to the correct Python variable name.
During the initialization, SicVar() defines three attributes to the instance: __sicname__, __siclevel__, and __sicdata__. By convention the '__' delimiters denote objects that are hidden to the user, but still accessible. __sicname__ and __siclevel__ are a Python string and an integer, and are used to keep a trace of what the original SIC variable is. __sicdata__ is a numpy.ndarray initialized with the informations provided by the descriptor (data address, dimensions, type,...).

    >>> Sic.define('real a')
     A               is a        REAL*4, 0D            (RW) -> a
    >>> vars(a)    # vars() displays attributes names and values
    {'__sicdata__': array(0.0, dtype=float32), '__sicname__': 'A', '__siclevel__': 0}
    >>> type(a.__sicdata__)
    <type 'numpy.ndarray'> # A NumPy array
    >>> type(a.__sicname__)
    <type 'str'>   # A Python string
    >>> type(a.__siclevel__)
    <type 'int'>   # A Python integer

SicVar instances are used to import SIC standard variables (scalars or arrays). Due to its class type, it can also accept new attributes, and thus be used to import images (for example in an instance named ima). In this case, the image (the array component) is imported through the __sicdata__ attribute (ima.__sicdata__), and can be directly accessed from ima (ima[0,0]). Header variables are imported into other attributes (ima.naxis1, ima.naxis2,...), provided they do not attempt to overwrite a numpy.ndarray attribute or method. As any other imported SIC variables, these header attributes are themselves SicVar instances. See subsection 2.4.4 for details and example on importing SIC images.

All attributes of a SicVar instance are write-protected against deletion or overwriting. This is a first importance for __sicdata__, because deleting it would be dramatic. Remember that the command a.__sicdata__ = 0 do not modify its content but bounds it to the 0 integer, loosing data and all information about the corresponding SIC variable. But end-user should never have to deal with the __sicdata__ attribute, and have to work on the instance itself instead (for example a[0] = 0).
These warnings also apply to images attributes: do not try ima.naxis1 = 0 but ima.naxis1[0] = 0 instead.

SicVar instances come with a set of methods and attributes, for one part inherited from the numpy.ndarray type, and for the other part (re)defined at instance initialization. For example the addition (__add__ and __radd__) is redefined to add numbers or concatenate character strings.

    >>> dir(a) # All attributes and methods.
    ['__add__', '__copy__', '__deepcopy__', '__delattr__', '__div__',
    '__doc__', '__eq__', '__ge__', '__getattr__', '__getitem__',
    '__gt__', '__iadd__', '__idiv__', '__imul__', '__init__', '__int__',
    '__isub__', '__le__', '__len__', '__lt__', '__module__', '__mul__',
    '__ne__', '__nonzero__', '__radd__', '__rdiv__', '__repr__',
    '__rmul__', '__rsub__', '__setattr__', '__setitem__', '__sicdata__',
    '__sicname__', '__str__', '__sub__', 'astype', 'byteswapped',
    'copy', 'iscontiguous', 'itemsize', 'resize', 'savespace',
    'spacesaver', 'tolist', 'toscalar', 'tostring', 'typecode']