Next: SETTING UP FOR FORMAT CONVERSION
Up: INTRODUCTION
Previous: The Format Conversion Approach
To illustrate how this system works, suppose an application which uses
the NDF library wants to access an existing NDF data structure, but
the person running it only has data available in a foreign format.
The following outlines the sequence of operations that might occur:
- 1.
- The NDF library will first obtain the name of the dataset to be
accessed in the normal way, e.g. by prompting (alternatively,
the application could obtain the name and pass it to the library, but
the two methods are equivalent here).
- 2.
- The library will check whether the data are stored in native NDF
format. If so, it will access them directly. If not, it will next
identify which foreign format they are stored in. This is done by
inspecting the extension on the file name (for instance, the file name
mydata.fit might designate a dataset stored in
FITS
format).
- 3.
- The library will then look to see if a format conversion utility
has been defined to convert from the foreign format into native NDF
format. Assuming one has, it will invoke it, causing the data to be
converted and written into a scratch object in native NDF format.
- 4.
- The scratch object will then be accessed as normal. The
application need not know that it hasn't been given a normal NDF. In
addition, all references which the application makes to the dataset
name will use the original (foreign) file name, so the user usually
need not be aware that conversion has occurred either.
- 5.
- When the dataset is released by the application, the scratch
object will be deleted (in fact, this is optional - see
§
). If it has been modified, a format conversion
utility will be sought, and invoked, to perform back-conversion of the
modified data before this occurs.
A rather similar sequence of events might occur when creating a new
dataset (e.g. as output from an application), except that the
format conversion stage on input would not be required.
These steps are an exact analogue of the conversions that the
NDF and HDS libraries perform
transparently whenever an application attempts to (e.g.)
access an integer data array as floating point, or to read data
previously written on a machine which uses a different number
representation. The only difference is that format conversion
utilities are not a permanent part of the data access software, but
are invoked as separate processes which communicate through files
rather than via memory.
This makes it possible to add and remove them as required.
Next: SETTING UP FOR FORMAT CONVERSION
Up: INTRODUCTION
Previous: The Format Conversion Approach
Starlink System Note 20
R.F.Warren-Smith & D.S.Berry
17th July 2000
E-mail:ussc@star.rl.ac.uk
Copyright © 2000 Council for the Central Laboratory of the Research Councils