Commit 11834ef7 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Added save_chunk keyword for operational usage

parent 37294420
......@@ -5063,7 +5063,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
}
if (!i || !j || *(test + j + 1) == 0 || *(test + 2 * j) == 0)
{
cdoWarning("In checking the last chunk:\n Date from filename of the chunk cannot be read.\n "
if (Options::cdoVerbose) cdoPrint("In checking the last chunk:\n Date from filename of the chunk cannot be read.\n "
"Switched to replace mode for this variable.");
return 0;
}
......@@ -5084,7 +5084,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
(j == 6 && ifreq != 2) ||
(j == 4 && ifreq != 1 && ifreq != 8) )
{
cdoWarning("In checking last chunk:\n Frequency of chunk file does not agree with frequency of the "
if (Options::cdoVerbose) cdoPrint("In checking last chunk:\n Frequency of chunk file does not agree with frequency of the "
"working file.\n Switched to replace mode for this variable.");
return 0;
}
......@@ -5115,7 +5115,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
break;
default:
{
cdoWarning("In checking last chunk:\n Last chunk has unknown frequency "
if (Options::cdoVerbose) cdoPrint("In checking last chunk:\n Last chunk has unknown frequency "
"which is yet not enabled to be appended by "
"cdo cmor.\n Switched to replace mode for this variable.");
return 0;
......@@ -5135,7 +5135,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
if (Options::cdoVerbose) cdoPrint("Start to calculate temporal gap between chunk and working file.");
if (cdoStreamIsPipe(0))
{
cdoWarning("Cdo cmor cannot enable append mode since you piped several cdo operators.\n Switched to "
if (Options::cdoVerbose) cdoPrint("Cdo cmor cannot enable append mode since you piped several cdo operators.\n Switched to "
"replace mode for this variable.");
return 0;
}
......@@ -5149,7 +5149,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
cdiDecodeDate(taxisInqVdate(taxisID2), &fyear, &fmonth, &dummy);
if ( ifreq == 1 && fyear == old_end_year )
{
cdoWarning("In checking the last chunk:\n The years of the end date of the chunk file "
if (Options::cdoVerbose) cdoPrint("In checking the last chunk:\n The years of the end date of the chunk file "
"and the first date of the working file are the same: '%d'."
" Switched to replace mode for this variable.", fyear);
return 0;
......@@ -5168,7 +5168,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
|| (ifreq == 8 && (append_distance / 24.0 / 30.5 / 12.0 > 20.0 ))
)
{
cdoWarning("In checking the last chunk:\n A temporal gap is diagnosed between end date of chunk file "
if (Options::cdoVerbose) cdoPrint("In checking the last chunk:\n A temporal gap is diagnosed between end date of chunk file "
"and first date of working file of: '%f' hours ( '%f' days, '%f' months, '%f' years)"
". Maximal valid gaps are:\n"
" 2 hours for 1-hourly frequency\n"
......@@ -5206,7 +5206,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
;
if (ntsteps == 0)
{
cdoWarning("In checking whether append mode is possible:\n No time steps found in infile.\n "
if (Options::cdoVerbose) cdoPrint("In checking whether append mode is possible:\n No time steps found in infile.\n "
" Switched to replace mode for this variable.");
streamClose(streamID2);
return 0;
......@@ -5225,7 +5225,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
case (8): estimated_size = ntsteps * 10 * 60 * 60 * 24 * 365.25 * size_per_sec + (double) filesize; break;
default:
{
cdoWarning("In checking whether append mode is valid:\n Selected chunk to append data has subdaily frequency which is yet not enabled by cdo cmor.\n Switched to replace mode for this variable.");
if (Options::cdoVerbose) cdoPrint("In checking whether append mode is valid:\n Selected chunk to append data has subdaily frequency which is yet not enabled by cdo cmor.\n Switched to replace mode for this variable.");
streamClose(streamID2);
return 0;
}
......@@ -5233,7 +5233,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
if ((unsigned int) estimated_size > (unsigned int) maxsizeb)
{
cdoWarning("In checking whether append mode is valid:\n Estimated file size of appended file is : '%f'gb and exceeds maximal allowed file size: '%d'gb.\n Switched to replace mode for this variable.",
if (Options::cdoVerbose) cdoPrint("In checking whether append mode is valid:\n Estimated file size of appended file is : '%f'gb and exceeds maximal allowed file size: '%d'gb.\n Switched to replace mode for this variable.",
estimated_size / 1024.0 / 1024.0 / 1024.0, maxsizegb);
streamClose(streamID2);
return 0;
......@@ -5262,20 +5262,31 @@ use_chunk_des_files(list_t *kvl, int vlistID, int var_id, char *chunk_des_file,
if ( check_append_and_size(kvl, vlistID, chunk_file, ifreq, calendar) )
return chunk_file;
else
cdoWarning("In checking the last chunk:\n Chunk '%s' configured via chunk description file is not suitable to be appended.\n Switched to replace mode for this variable.",
{
if (Options::cdoVerbose) cdoPrint("In checking the last chunk:\n Chunk '%s' configured via chunk description file is not suitable to be appended.",
chunk_file);
cdoPrint("Output mode: (R)eplace.");
}
}
else
{
if ( chunk_file[0] )
cdoWarning("In checking the last chunk:\n Chunk '%s' configured via chunk description file does not exist.\n Switched to replace mode for this variable.",
chunk_file);
{
if (Options::cdoVerbose) cdoPrint("In checking the last chunk:\n Chunk '%s' configured via chunk description file does not exist.", chunk_file);
cdoPrint("Output mode: (R)eplace.");
}
else
cdoWarning("In checking the last chunk:\n No name found in chunk description file.\n Switched to replace mode for this variable.");
{
if (Options::cdoVerbose) cdoPrint("In checking the last chunk:\n No name found in chunk description file.");
cdoPrint("Output mode: (R)eplace.");
}
}
}
else
cdoWarning("Chunk description file '%s' could not be opened.\nSwitched to replace mode.", chunk_des_file);
{
if (Options::cdoVerbose) cdoPrint("Chunk description file '%s' could not be opened.", chunk_des_file);
cdoPrint("Output mode: (R)eplace.");
}
strcpy(chunk_file, " \0");
return chunk_file;
}
......@@ -5337,8 +5348,9 @@ get_chunk_files(list_t *kvl, struct mapping vars[], int vlistID, int ifreq, int
return empty_array(vars, &chunk_files);
else if (time_axis == 4)
{
cdoWarning("In validating append mode:\n CMOR APPEND mode not possible for time independent "
"variables.\n Switched to replace mode for this variable");
if (Options::cdoVerbose) cdoPrint("In validating append mode:\n CMOR APPEND mode not possible for time independent "
"variables.");
cdoPrint("Output mode: (R)eplace.");
return empty_array(vars, &chunk_files);
}
if (Options::cdoVerbose) cdoPrint("10.2.1. Successfully validated append mode.\n");
......@@ -5350,9 +5362,10 @@ get_chunk_files(list_t *kvl, struct mapping vars[], int vlistID, int ifreq, int
char **chunk_des_files = NULL;
if (num_aaf != i && num_aaf > 0)
{
cdoPrint(
if (Options::cdoVerbose) cdoPrint(
"Number of chunk files '%d' disagree with number of requested variables '%d'.\n Switched to replace mode.\n",
num_aaf, i);
cdoPrint("Output mode: (R)eplace.");
return empty_array(vars, &chunk_files);
}
else if (num_aaf == 0)
......@@ -5363,8 +5376,9 @@ get_chunk_files(list_t *kvl, struct mapping vars[], int vlistID, int ifreq, int
chunk_des_files = get_chunk_des_files(kvl, vars, miptab_freqptr, i, vlistID, NULL, project_id);
else
{
cdoWarning("In getting chunk names:\n Automatic chunk configuration via file not possible if DRS is "
"not created.\n Swichted to replace mode.");
if (Options::cdoVerbose) cdoPrint("In getting chunk names:\n Automatic chunk configuration via file not possible if DRS is "
"not created.");
cdoPrint("Output mode: (R)eplace.");
return empty_array(vars, &chunk_files);
}
}
......@@ -5380,8 +5394,9 @@ get_chunk_files(list_t *kvl, struct mapping vars[], int vlistID, int ifreq, int
chunk_files[j] = strdup(chunk_att_files[j]);
else
{
cdoWarning("Chunk '%s' could not be used.\n Switched to replace mode for this variable.",
if (Options::cdoVerbose) cdoPrint("Chunk '%s' could not be used.",
chunk_att_files[j]);
cdoPrint("Output mode: (R)eplace.");
chunk_files[j] = strdup(" ");
}
}
......@@ -5392,8 +5407,8 @@ get_chunk_files(list_t *kvl, struct mapping vars[], int vlistID, int ifreq, int
chunk_des_files[j]);
chunk_files[j] = use_chunk_des_files(kvl, vlistID, vars[j].cdi_varID, chunk_des_files[j], ifreq, calendar);
}
if (Options::cdoVerbose && strcmp(chunk_files[j], " ") != 0)
cdoPrint("Chunk file to append on var with CDI ID %d is: '%s'.", vars[j].cdi_varID, chunk_files[j]);
if (strcmp(chunk_files[j], " ") != 0)
cdoPrint("Output mode: (A)ppend.\n (Chunk file for var ID %d is: '%s')", vars[j].cdi_varID, chunk_files[j]);
}
if (chunk_des_files) free_array(chunk_des_files);
if (Options::cdoVerbose) cdoPrint("Successfully processed chunk file retrieval.");
......@@ -5454,6 +5469,19 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
if ( ifreq == 7 ) cdoPrint("10.2. Append mode not possible for frequency '%s'. Switch to replace mode.", frequency);
if (Options::cdoVerbose) cdoPrint("10.2. Successfully retrieved chunk files.");
int i = 0;
if ( strcmp(kv_get_a_val(kvl, "sc", "n"), "y") == 0 )
{
while ( chunk_files[i] )
{
char command[CDI_MAX_NAME];
sprintf(command, "cp %s %s.save", chunk_files[i], chunk_files[i]);
int dir_err = system(command);
if (dir_err != 0)
cdoWarning("Could not create a .save file out of the previous chunk '%s'.", chunk_files[i]);
i++;
}
}
i = 0;
int zaxisID, zsize = 0, pscheck = 1;
char *charname = NULL;
......@@ -5490,7 +5518,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
double time_val;
if (time_axis != 4)
{
jtime_val = get_cmor_time_val(kvl, taxisID, ref_date, tunitsec, calendar, frequency, tsID);
jtime_val = get_cmor_time_val(kvl, taxisID, ref_date, tunitsec, calendar, frequency, tsID, time_axis);
time_val = juldate_to_seconds(juldate_sub(jtime_val, ref_date)) / tunitsec;
time_bndsp = (time_axis != 1) ? get_time_bounds(kvl, taxisID, ifreq, ref_date, jtime_val, calendar,
tunitsec, time_bnds, time_axis, vlistID)
......@@ -6002,6 +6030,7 @@ read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
/* If a mapping table exists is saved here */
/***/
kv_insert_a_val(kvl, "mtproof", maptab, 1);
cdoPrint("Mapping Table = '%s'.", maptab);
list_destroy(pml);
if (maptabbuild) Free(maptabbuild);
}
......@@ -6084,7 +6113,7 @@ static char *
get_mip_table(char *params, list_t *kvl, char *project_id, bool print)
{
char *miptab;
if (print) cdoPrint("2.2. Start to find a MIP table file.");
if (print && Options::cdoVerbose) cdoPrint("2.2. Start to find a MIP table file.");
if (!params) cdoAbort("ERROR (infile: '%s')! First parameter not passed. A MIP table file is required.", cdoGetStreamName(0));
if (file_exist(params, false, "MIP table", print))
{
......@@ -6114,12 +6143,12 @@ get_mip_table(char *params, list_t *kvl, char *project_id, bool print)
miptabdir[strlen(cwd)+j + 1] = '\0';
}
kv_insert_a_val(kvl, "mip_table_dir", miptabdir, 1);
if (print) cdoPrint("2.2. MIP table file '%s' exists in MIP table directory '%s'.", miptab, miptabdir);
if (print) cdoPrint("MIP table file = '%s'/'%s'.", miptabdir, miptab);
return miptab;
}
else
{
if (print)
if (print && Options::cdoVerbose)
cdoPrint("Try to build a path with additional configuration attributes:\n 'mip_table_dir' and "
"'project_id'\n in order to use '%s' as MIP-table.",
params);
......@@ -6138,7 +6167,7 @@ get_mip_table(char *params, list_t *kvl, char *project_id, bool print)
}
#endif
file_exist(miptab, true, "MIP table", print);
if (print) cdoPrint("(2.2.) MIP table file '%s' exists.", miptab);
if (print) cdoPrint("MIP table file = '%s'", miptab);
return miptab;
}
else
......
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