WRITE_NDF

Convert an IDL array to a Starlink NDF.

Description:

This IDL procedure will write an IDL array of up to seven dimensions to a Starlink NDF. If NDF on-the-fly conversion has been activated, the given filename may refer to a file of a different data format in which case the NDF is then automatically converted to the required file type.

Usage:

IDL> write_ndf, IDL_array, Ndf_name[, Bad_value][, COMPONENT=Comp_name]

Arguments

IDL_array
The IDL array to be converted. This may be an array name or constant of up to seven dimensions. The type of the NDF component created will depend on the type of the given array:
floating – > _REAL
double-precision – > _DOUBLE
byte – > _UBYTE
integer – > _WORD
longword integer – > _INTEGER

No other types are allowed.

Ndf_name
A string expression specifying name of the NDF to be written.
Bad_value
Optional - A value any occurrence of which in the IDL array is to be replaced by the appropriate PRIMDAT bad value in the NDF component. If no such value is found, the NDF bad-pixel flag for the component is set FALSE. The value must be the same type as the array.

Keywords:

COMPONENT
Set this to a string expression specifying the NDF component to be written. The following values are allowed:
"DATA"
— A new NDF is created with the same dimensions as the IDL array, and the DATA component written.
"VARIANCE"
— An existing NDF is opened and a new component written. The size of the given array must be the same as the NDF.
"QUALITY"
— An existing NDF is opened and a new component written. The size of the given array must be the same as the NDF and the type of the IDL array must be Byte.

The case of the string does not matter and it may be abbreviated to one or more characters.

Examples:

Assuming my_data is an IDL floating array,
IDL> write_ndf, my_data, ’my_ndf’
creates the NDF ’my_ndf.sdf’ with the same dimensions as the IDL array ’my_data’, and writes the array to its DATA component (of type _REAL). No checks on bad values are made.
IDL> write_ndf, my_data, ’my_ndf’, !values.f_nan
As above except that any occurrence of the value NaN in the array will be replaced by the VAL__BADR value as defined by the Starlink PRIMDAT package.
IDL> write_ndf, my_variances, ’my_ndf’, comp=’v’
Writes the IDL array ’my_variances’ to the VARIANCES component of the NDF created above. A check is made that the size of the array corresponds with the size of the NDF. (Note that the keyword COMPONENT and the value "VARIANCE" are case-independent and can be abbreviated.)

Deficiencies

No conversion of the given bad value to the appropriate type for the array will be attempted; instead an error will be reported.

Related Applications

Convert: READ_NDF.