Commit 0fe1e94f authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Improved stdout and stderr

parent dc526d9f
......@@ -1323,20 +1323,20 @@ file_exist(const char *tfilename, bool force, const char *fileart, bool print)
assert(tfilename != NULL);
size_t filesize = fileSize(tfilename);
if (filesize == 0 && force)
cdoAbort("ERROR (infile: '%s')! Is '%s' a valid '%s' file?\n Empty file: '%s'.", cdoGetStreamName(0), tfilename, fileart, tfilename);
cdoAbort("ERROR (infile: '%s')!\n Empty '%s' file: '%s'.", cdoGetStreamName(0), fileart, tfilename);
else if (filesize == 0 && !force)
{
if (print) cdoPrint("Is '%s' a valid '%s' file?\n Empty file: '%s'.", tfilename, fileart, tfilename);
if (print && Options::cdoVerbose) cdoPrint("Empty '%s' file: '%s'.", fileart, tfilename);
return false;
}
if (strstr(tfilename, ".nc") || strstr(tfilename, ".grb")) return 1;
FILE *fp = fopen(tfilename, "r");
if (fp == NULL && force)
cdoAbort("ERROR (infile: '%s')! Is '%s' a valid '%s' file?\n Open failed on: '%s'.", cdoGetStreamName(0), tfilename, fileart, tfilename);
cdoAbort("ERROR (infile: '%s')!\n Open failed on '%s' file: '%s'.", cdoGetStreamName(0), fileart, tfilename);
else if (fp == NULL && !force)
{
if (print)
cdoPrint("Is '%s' a valid '%s' file?\n Open failed on: '%s'.", tfilename, fileart, tfilename);
if (print && Options::cdoVerbose )
cdoPrint("Open failed on '%s' file: '%s'.", fileart, tfilename);
return false;
}
......@@ -1383,10 +1383,12 @@ check_compare_set(char **finalset, char *attribute, const char *attname, const c
{
if (strcmp(attribute, *finalset) != 0 && strcmp(attribute, "") != 0 )
{
cdoPrint("Function 'attribute check, compare and set':\n Be aware of differences between infile and "
if (Options::cdoVerbose)
cdoPrint("Function 'attribute check, compare and set':\n Be aware of differences between infile and "
"user specification.\n Attribute '%s' in input file: '%s' does not agree with user "
"specification '%s'.\n Cmor library is called with '%s'.",
attname, *finalset, attribute, attribute);
"specification '%s'.",
attname, *finalset, attribute);
cdoPrint("Attribute '%s' = '%s'", attname, attribute);
Free(*finalset);
*finalset = strdup(attribute);
}
......@@ -1502,10 +1504,10 @@ add_globalhybrids(list_t *kvl, int vlistID, char *project_id)
}
const char *longAtt[] = { "required_time_units", "grid_info" , "mapping_table", "keep_all_attributes",
"drs_root" , "drs" , "time_bounds" , "version_date",
"drs_root" , "drs" , "t_axis" , "version_date",
"deflate_level" , "character_axis", "z_axis" , "output_mode",
"max_size" , "last_chunk", NULL };
const char *shortAtt[] = { "rtu", "gi", "mt", "kaa", "dr", "d", "tb", "vd", "dl", "ca", "za", "om", "ms", "lc", NULL };
"max_size" , "last_chunk" , "save_chunk", NULL };
const char *shortAtt[] = { "rtu", "gi", "mt", "kaa", "dr", "d", "ta", "vd", "dl", "ca", "za", "om", "ms", "lc", "sc", NULL };
i = 0;
while (longAtt[i] != NULL)
......@@ -2459,11 +2461,11 @@ setup_dataset(list_t *kvl, int streamID, int *calendar, char *project_id)
"dr" , "d" , "lc" , "dj", "workfile4err",
"kaa" , "mtproof" , "miptab_freq" , "mip_table_dir",
"grid_info_dir", "mapping_table_dir", "pd" , "member",
"tb" , "firsttimeval" , "calendar" , "cordexDir",
"ta" , "firsttimeval" , "calendar" , "cordexDir",
"cordexFileTem", "branch_time" , "dl" , "vd" ,
/*Following attributes are set by CMOR: */
"tracking_id" , "creation_date" , "table_id" , "di",
"ci",
"ci" , "sc",
NULL };
#if defined(CMOR_VERSION_MAJOR)
#if (CMOR_VERSION_MAJOR == 2)
......@@ -2790,13 +2792,13 @@ get_charvals_and_bnds(list_t *kvl, char *chardim, char ***fvalss, char ***fbndss
"\n Specify its values via attribute 'char_axis_$name' in infofile.");
sprintf(charvalstring, "char_axis_%s_bnds", chardim);
sprintf(charvalstring, "char_axis_%s_bounds", chardim);
*fbndss = kv_get_vals(kvl, charvalstring, nofbnds);
if ( !*fbndss )
if (Options::cdoVerbose)
cdoPrint("You specified variables to merge to an axis, the axis name and its values."
"\n Note that sometimes bnds are required for these axes."
"\n Specify its bnds via attribute 'char_axis_$name_bnds' in infofile.");
"\n Note that sometimes bounds are required for these axes."
"\n Specify its bounds via attribute 'char_axis_$name_bounds' in infofile.");
sprintf(charvalstring, "char_axis_%s_units", chardim);
*funits = kv_get_a_val(kvl, charvalstring, "");
......@@ -2804,7 +2806,7 @@ get_charvals_and_bnds(list_t *kvl, char *chardim, char ***fvalss, char ***fbndss
if (Options::cdoVerbose)
cdoPrint("You specified variables to merge to an axis, the axis name and its values."
"\n Note that units are required if the axis has digital values."
"\n Specify its bnds via attribute 'char_axis_$name_units' in infofile.");
"\n Specify its units via attribute 'char_axis_$name_units' in infofile.");
Free(charvalstring);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment