X-shooter Pipeline Reference Manual 3.8.15
Functions
PAF file creation

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)
 

Detailed Description

Function Documentation

◆ irplib_paf_dump()

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
pqcPointer to the description of the QC parameter
kwnameKeyword name
paflistPropertylist from which the values are extracted
pafPAF 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 401 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().

◆ irplib_paf_dump_double()

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
keyProperty key
valueProperty value
commentOptional property comment
pafPAF stream
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error
See also
irplib_paf_dump_string

Definition at line 496 of file xsh_paf_save.c.

References PAF_KEY_FORMAT, and PAF_KEY_LEN.

Referenced by irplib_paf_dump().

◆ irplib_paf_dump_int()

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
keyProperty key
valueProperty value
commentOptional property comment
pafPAF stream
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error
See also
irplib_paf_dump_string

Definition at line 468 of file xsh_paf_save.c.

References PAF_KEY_FORMAT, and PAF_KEY_LEN.

Referenced by irplib_paf_dump().

◆ irplib_paf_dump_string()

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
keyProperty key
valueProperty value
commentOptional property comment
pafPAF 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 526 of file xsh_paf_save.c.

References PAF_KEY_FORMAT, and PAF_KEY_LEN.

Referenced by irplib_paf_dump().

◆ irplib_paf_init()

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
instrumentName of instrument in capitals (NACO, VISIR, etc.)
recipeName of recipe
filenameFilename of created product
primary_headerprimary 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 instrument, PAF_KEY_LEN, and xsh_stringcat_any().

Referenced by xsh_paf_save().

◆ no_space()

static void no_space ( char *  str)
static

Definition at line 366 of file xsh_paf_save.c.

Referenced by irplib_paf_dump().

◆ xsh_paf_save()

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
instrumentName of instrument in capitals (NACO, VISIR, etc.)
recipeName of recipe
paflistPropertylist to save
filenameFilename of created PArameter File
pro_catgThe 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 instrument, 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().