PAF file creation
[Xsh Specific Tools]

Functions

static FILE * irplib_paf_init (const xsh_instrument *instrument, const char *recipe, const char *filename, const cpl_propertylist *primary_header)
 Open a new PAF file, output a default header.
static cpl_error_code irplib_paf_dump (qc_description *pqc, const char *kwname, const cpl_propertylist *paflist, FILE *paf)
 Print a propertylist as PAF.
static cpl_error_code irplib_paf_dump_int (char *key, int value, const char *comment, FILE *paf)
 Print an int-property as PAF.
static cpl_error_code irplib_paf_dump_double (char *key, double value, const char *comment, FILE *paf)
 Print a double-property as PAF.
static cpl_error_code irplib_paf_dump_string (char *key, const char *value, const char *comment, FILE *paf)
 Print a string-property as PAF.
cpl_error_code xsh_paf_save (const xsh_instrument *instrument, const char *recipe, const cpl_propertylist *paflist, const char *filename, const char *pro_catg)
 Create a new PAF file.
static void no_space (char *str)

Function Documentation

static cpl_error_code irplib_paf_dump ( qc_description pqc,
const char *  kwname,
const cpl_propertylist *  paflist,
FILE *  paf 
) [static]

Print a propertylist as PAF.

Parameters:
pqc Pointer to the description of the QC parameter
kwname Keyword name
paflist Propertylist from which the values are extracted
paf PAF stream
Returns:
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The property names are printed with these modifications: Any space-character is replaced by a . (dot).

Thus a property name QC PART1 PART2 PART3 will cause the printing of a line with QC.PART1.PART2.PART3 as key.

Supported property-types: CPL_TYPE_CHAR (cast to int) CPL_TYPE_INT CPL_TYPE_LONG (only if sizeof(long) == sizeof(int), cast to int) CPL_TYPE_FLOAT (cast to double) CPL_TYPE_DOUBLE CPL_TYPE_STRING

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if fprintf() fails
  • CPL_ERROR_UNSUPPORTED_MODE if the list contains unsupported property-types

Definition at line 397 of file xsh_paf_save.c.

References irplib_paf_dump_double(), irplib_paf_dump_int(), irplib_paf_dump_string(), qc_description::kw_help, no_space(), and xsh_msg_dbg_low.

Referenced by xsh_paf_save().

static cpl_error_code irplib_paf_dump_double ( char *  key,
double  value,
const char *  comment,
FILE *  paf 
) [static]

Print a double-property as PAF.

Parameters:
key Property key
value Property value
comment Optional property comment
paf PAF stream
Returns:
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See also:
irplib_paf_dump_string

Definition at line 492 of file xsh_paf_save.c.

References PAF_KEY_FORMAT, and PAF_KEY_LEN.

Referenced by irplib_paf_dump().

static cpl_error_code irplib_paf_dump_int ( char *  key,
int  value,
const char *  comment,
FILE *  paf 
) [static]

Print an int-property as PAF.

Parameters:
key Property key
value Property value
comment Optional property comment
paf PAF stream
Returns:
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See also:
irplib_paf_dump_string

Definition at line 464 of file xsh_paf_save.c.

References PAF_KEY_FORMAT, and PAF_KEY_LEN.

Referenced by irplib_paf_dump().

static cpl_error_code irplib_paf_dump_string ( char *  key,
const char *  value,
const char *  comment,
FILE *  paf 
) [static]

Print a string-property as PAF.

Parameters:
key Property key
value Property value
comment Optional property comment
paf PAF stream
Returns:
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if a non-optional input pointer is NULL
  • CPL_ERROR_FILE_IO if fprintf() fails

Definition at line 522 of file xsh_paf_save.c.

References PAF_KEY_FORMAT, and PAF_KEY_LEN.

Referenced by irplib_paf_dump().

static FILE * irplib_paf_init ( const xsh_instrument instrument,
const char *  recipe,
const char *  filename,
const cpl_propertylist *  primary_header 
) [static]

Open a new PAF file, output a default header.

Parameters:
instrument Name of instrument in capitals (NACO, VISIR, etc.)
recipe Name of recipe
filename Filename of created product
primary_header primary header
Returns:
PAF stream or NULL on error

This function creates a new PAF file with the requested file name. If another file already exists with the same name, it will be overwritten (if the file access rights allow it).

This function returns an opened file pointer, ready to receive more data through fprintf()'s. The caller is responsible for fclose()ing the file.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if fopen(), or fprintf() fails

Definition at line 226 of file xsh_paf_save.c.

References PAF_KEY_LEN, and xsh_stringcat_any().

Referenced by xsh_paf_save().

static void no_space ( char *  str  )  [static]

Definition at line 362 of file xsh_paf_save.c.

Referenced by irplib_paf_dump().

cpl_error_code xsh_paf_save ( const xsh_instrument instrument,
const char *  recipe,
const cpl_propertylist *  paflist,
const char *  filename,
const char *  pro_catg 
)

Create a new PAF file.

Parameters:
instrument Name of instrument in capitals (NACO, VISIR, etc.)
recipe Name of recipe
paflist Propertylist to save
filename Filename of created PArameter File
pro_catg The PRO.CATG of the product file
Returns:
CPL_ERROR_NONE or the relevant CPL error code on error

Create a PAF from some FITS cards from the file ref_file and QC parameters in a propertylist qclist. All QC parameters relevant to the product are checked. A message is issued for each missing QC parameter.

Definition at line 104 of file xsh_paf_save.c.

References irplib_paf_dump(), irplib_paf_init(), qc_description::kw_name, XSH_ASSURE_NOT_NULL, xsh_get_qc_desc_by_recipe(), xsh_instrument_arm_tostring(), xsh_is_qc_for_arm(), xsh_is_qc_for_pro_catg(), xsh_msg, xsh_msg_dbg_low, and xsh_msg_debug.

Referenced by main().


Generated on 13 Mar 2013 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1