ERIS Pipeline Reference Manual 1.9.2
sc_par.c
Go to the documentation of this file.
1/*
2 * This file is part of the SKYCORR software package.
3 * Copyright (C) 2009-2013 European Southern Observatory
4 *
5 * This programme is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This programme is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this programme. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
37/*****************************************************************************
38 * INCLUDES *
39 ****************************************************************************/
40
41#include <sc_par.h>
42
43/*****************************************************************************
44 * CODE *
45 ****************************************************************************/
46
47cpl_error_code sc_par_addkeywords(cpl_propertylist *header,
48 const cpl_parameterlist *parlist)
49{
65 const cpl_parameter *p;
66 char * skyfile = NULL;
67 char *skyspec = NULL;
68
69 /* Add name of reference sky spectrum */
70 p = cpl_parameterlist_find_const(parlist, "skyspec");
71 skyfile = cpl_sprintf("%s", cpl_parameter_get_string(p));
72 skyspec = strrchr(skyfile, '/');
73 if (skyspec == NULL) {
74 skyspec = skyfile;
75 }
76 cpl_propertylist_append_string(header,"ESO SC REFSKY NAME", (skyspec+1));
77 cpl_propertylist_set_comment(header, "ESO SC REFSKY NAME",
78 "Name of reference sky");
79
80 /* Add MJD of reference sky spectrum if given */
81 p = cpl_parameterlist_find_const(parlist, "mjd");
82 if (cpl_parameter_get_double(p) > 0.) {
83 cpl_propertylist_append_double(header,"ESO SC REFSKY MJD",
84 cpl_parameter_get_double(p));
85 cpl_propertylist_set_comment(header, "ESO SC REFSKY MJD",
86 "MJD [d] for reference sky");
87 }
88
89 /* Add date of reference sky spectrum in years */
90 p = cpl_parameterlist_find_const(parlist, "date_val");
91 cpl_propertylist_append_double(header,"ESO SC REFSKY DATE",
92 cpl_parameter_get_double(p));
93 cpl_propertylist_set_comment(header, "ESO SC REFSKY DATE",
94 "Date [yr] for reference sky");
95
96 /* Add time of reference sky spectrum in seconds */
97 p = cpl_parameterlist_find_const(parlist, "time_val");
98 cpl_propertylist_append_double(header,"ESO SC REFSKY TIME",
99 cpl_parameter_get_double(p));
100 cpl_propertylist_set_comment(header, "ESO SC REFSKY TIME",
101 "Start time [s] for reference sky");
102
103 /* Add solar radio flux */
104 p = cpl_parameterlist_find_const(parlist, "solflux");
105 cpl_propertylist_append_float(header,"ESO SC SOLRFLUX",
106 cpl_parameter_get_double(p));
107 cpl_propertylist_set_comment(header, "ESO SC SOLRFLUX",
108 "Solar radio flux [s.f.u.]");
109
110 /* Add estimated FWHM of sky lines */
111 p = cpl_parameterlist_find_const(parlist, "fwhm");
112 cpl_propertylist_append_float(header,"ESO SC FWHM",
113 cpl_parameter_get_double(p));
114 cpl_propertylist_set_comment(header, "ESO SC FWHM",
115 "FWHM of sky lines [px]");
116
117 cpl_free(skyfile);
118 return CPL_ERROR_NONE;
119}
120
cpl_error_code sc_par_addkeywords(cpl_propertylist *header, const cpl_parameterlist *parlist)
Definition: sc_par.c:47
Header for routines for handling parameter files.