60 #define PRINT_USAGE(rc) \ 61 fprintf(stderr, "Usage: %s CUBE_OUT CUBE_IN_1 CUBE_IN_2 [ CUBE_IN_3 ... ]\n",\ 63 cpl_end(); return (rc); 65 int main(
int argc,
char **argv)
67 const char *idstring =
"muse_cube_concatenate";
68 cpl_init(CPL_INIT_DEFAULT);
69 cpl_msg_set_time_on();
71 cpl_msg_set_level(CPL_MSG_DEBUG);
72 cpl_msg_set_component_on();
82 for (i = 1; i < argc; i++) {
83 if (strncmp(argv[i],
"-", 1) == 0) {
95 FILE *fp = fopen(oname,
"r");
97 cpl_msg_error(idstring,
"Output cube \"%s\" is already present!", oname);
98 cpl_msg_error(idstring,
"Please specify another output name or rename the " 99 "existing file with this name.");
104 int ncubes = argc - i;
105 cpl_msg_info(idstring,
"Will write concatenation of %d cubes to \"%s\".",
108 cpl_errorstate state = cpl_errorstate_get();
112 cpl_msg_info(idstring,
"Loading cube 1 from \"%s\"", argv[2]);
115 for (icube = 3; icube < ncubes + 2; icube++) {
116 cpl_msg_info(idstring,
"Loading cube %d from \"%s\"", icube - 1, argv[icube]);
119 cpl_msg_warning(idstring,
"Could not load MUSE cube from \"%s\": %s",
120 argv[icube], cpl_error_get_message());
124 if (rc != CPL_ERROR_NONE) {
125 cpl_msg_warning(idstring,
"Error while concatenating \"%s\": %s",
126 argv[icube], cpl_error_get_message());
132 if (!cpl_errorstate_is_equal(state)) {
133 cpl_msg_error(idstring,
"Some errors occurred while concatenating the " 134 "cubes (not saving an output cube):");
138 cpl_msg_info(idstring,
"Saving concatenated cube as \"%s\".", oname);
140 cpl_msg_info(idstring,
"...done");
Structure definition of a MUSE datacube.
cpl_error_code muse_datacube_concat(muse_datacube *aCube, const muse_datacube *aAppend)
Concatenate one datacube at the end of another one.
muse_datacube * muse_datacube_load(const char *aFilename)
Load header, DATA and optionally STAT and DQ extensions as well as the reconstructed images of a MUSE...
void muse_datacube_delete(muse_datacube *aCube)
Deallocate memory associated to a muse_datacube object.
cpl_error_code muse_datacube_save(muse_datacube *aCube, const char *aFilename)
Save the three cube extensions and the FITS headers of a MUSE datacube to a file. ...
void muse_cplerrorstate_dump_some(unsigned aCurrent, unsigned aFirst, unsigned aLast)
Dump some CPL errors.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.