Commit ee508552 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Removed unused variables.

parent c2a6cefc
......@@ -596,8 +596,7 @@ cdo_parse_cmor_file(const char *filename, list_t *kvl)
static void
get_stringcode(int vlistID, int varID, char *varcodestring)
{
int varcode;
varcode = vlistInqVarCode(vlistID, varID);
int varcode = vlistInqVarCode(vlistID, varID);
sprintf(varcodestring, "%03d", varcode);
}
......@@ -865,7 +864,7 @@ count_axis_ids(int *axis_ids)
static list_t *
check_for_charvars(list_t *cmorVarLine, char *cn, char *miptabfreq, const char *key)
check_for_charvars(list_t *cmorVarLine, char */*cn*/, char */*miptabfreq*/, const char *key)
{
/***/
/* If a infile variable selector (name or code) has more than one value, it must be a character coordinate*/
......@@ -1103,7 +1102,7 @@ addcharvar(keyValues_t *charvars, int vlistID, const char *key, struct mapping v
}
static int
maptab_via_key(char *tablename, list_t *pml, int vlistID, int varID, int nventry, const char **ventry, const char *key, char *miptabfreq)
maptab_via_key(char *tablename, list_t *pml, int vlistID, int varID, const char *key, char *miptabfreq)
{
char ifilevalue[CDI_MAX_NAME];
if ((strcmp(key, "cmor_name") == 0) || (strcmp(key, "name") == 0) )
......@@ -1166,7 +1165,7 @@ maptab_via_cn_and_key(list_t *kvl_oname, int vlistID, int nvars, const char *key
static void
maptab_via_cmd(char *tablename, list_t *pml, const char *origValue, int vlistID, const char *key, char *cmorName,
char *miptabfreq, int filetype, struct mapping vars[], char *maptab)
char *miptabfreq, int filetype, char *maptab)
{
list_t *cmorVarLine = nullptr;
......@@ -1391,7 +1390,7 @@ get_txtatt(int vlistID, int varID, const char *key)
{
int type, len;
char *infile_attname = get_infile_attname(vlistID, varID, i, &type, &len);
if (strcmp(infile_attname, key) == 0)
if (strcmp(infile_attname, key) == 0)
{
returnvalue = get_infile_attvalue(vlistID, varID, infile_attname, type, len);
}
......@@ -1401,7 +1400,7 @@ get_txtatt(int vlistID, int varID, const char *key)
}
static void
get_all_atts(list_t *kvl, int vlistID, const char **infileAttSpec, char *project_id)
get_all_atts(list_t *kvl, int vlistID, const char **infileAttSpec)
{
int natts, type = 0, len = 0;
cdiInqNatts(vlistID, CDI_GLOBAL, &natts);
......@@ -1432,13 +1431,13 @@ get_all_atts(list_t *kvl, int vlistID, const char **infileAttSpec, char *project
}
static void
add_globalhybrids(list_t *kvl, int vlistID, char *project_id)
add_globalhybrids(list_t *kvl, int vlistID)
{
/* Do not define history, source or institution as one of those: */
const char *infileAttSpec[] = { "parent_dates", "climatology_interval", nullptr };
int i = 0;
if (strcmp(kv_get_a_val(kvl, "kaa", "n"), "y") == 0 || strcmp(kv_get_a_val(kvl, "keep_all_atts", "n"), "y") == 0)
get_all_atts(kvl, vlistID, infileAttSpec, project_id);
get_all_atts(kvl, vlistID, infileAttSpec);
else
{
while (infileAttSpec[i] != nullptr)
......@@ -2511,7 +2510,7 @@ setup_dataset(list_t *kvl, int streamID, int *calendar, char *project_id)
char *filename = kv_get_a_val(kvl, "dj", nullptr); */
char cwd[1024];
char *dummy = getcwd(cwd, sizeof(cwd));
getcwd(cwd, sizeof(cwd));
char *dataset_path = (char *) Malloc((strlen(cwd) + 1 + strlen("dataset.json") + 7) * sizeof(char));
FILE *dataset_json;
int procID = getpid();
......@@ -2886,7 +2885,6 @@ register_z_axis(list_t *kvl, int vlistID, int varID, int zaxisID, char *varname,
else
{
get_zhybrid_half(zaxisID, p0, alev_val, b_val, ap_val);
int tempind = 0;
cmf = cmor_axis(new_axis_id(axis_ids), (char *) "alternate_hybrid_sigma_half", (char *) "", zsize,
(void *) alev_val, 'd', nullptr, 1, nullptr);
}
......@@ -3580,38 +3578,30 @@ static void select_and_register_character_dimension(char *grid_file, int *axis_i
static void
register_lon_axis(int gridID, int xlength, int *axis_ids)
{
double *xcoord_vals = (double *) Malloc(xlength * sizeof(double));
if (gridInqXvals(gridID, xcoord_vals) == 0)
Free(xcoord_vals);
else
std::vector<double> xcoord_vals(xlength);
if (gridInqXvals(gridID, xcoord_vals.data()))
{
double *xcell_bounds = (double *) Malloc(2 * xlength * sizeof(double));
int xnbounds = gridInqXbounds(gridID, xcell_bounds);
check_and_gen_bounds(gridID, xnbounds, xlength, xcoord_vals, xcell_bounds, 1);
std::vector<double> xcell_bounds(2 * xlength);
int xnbounds = gridInqXbounds(gridID, xcell_bounds.data());
check_and_gen_bounds(gridID, xnbounds, xlength, xcoord_vals.data(), xcell_bounds.data(), 1);
int cmf = cmor_axis(new_axis_id(axis_ids), (char *) "longitude", (char *) "degrees_east", xlength,
(void *) xcoord_vals, 'd', (void *) xcell_bounds, 2, nullptr);
(void *) xcoord_vals.data(), 'd', (void *) xcell_bounds.data(), 2, nullptr);
if (cmf != 0) cdoAbort("ERROR! Function cmor_axis failed!");
if (xcell_bounds) Free(xcell_bounds);
if (xcoord_vals) Free(xcoord_vals);
}
}
static void
register_lat_axis(int gridID, int ylength, int *axis_ids)
{
double *ycoord_vals = (double *) Malloc(ylength * sizeof(double));
if (gridInqYvals(gridID, ycoord_vals) == 0)
Free(ycoord_vals);
else
std::vector<double> ycoord_vals(ylength);
if (gridInqYvals(gridID, ycoord_vals.data()))
{
double *ycell_bounds = (double *) Malloc(2 * ylength * sizeof(double));
int ynbounds = gridInqYbounds(gridID, ycell_bounds);
check_and_gen_bounds(gridID, ynbounds, ylength, ycoord_vals, ycell_bounds, 0);
std::vector<double> ycell_bounds(2 * ylength);
int ynbounds = gridInqYbounds(gridID, ycell_bounds.data());
check_and_gen_bounds(gridID, ynbounds, ylength, ycoord_vals.data(), ycell_bounds.data(), 0);
int cmf = cmor_axis(new_axis_id(axis_ids), (char *) "latitude", (char *) "degrees_north", ylength,
(void *) ycoord_vals, 'd', (void *) ycell_bounds, 2, nullptr);
(void *) ycoord_vals.data(), 'd', (void *) ycell_bounds.data(), 2, nullptr);
if (cmf != 0) cdoAbort("ERROR! Function cmor_axis failed!");
if (ycell_bounds) Free(ycell_bounds);
if (ycoord_vals) Free(ycoord_vals);
}
}
......@@ -3927,7 +3917,7 @@ register_grid(list_t *kvl, int vlistID, int varID, int *axis_ids, int *grid_ids,
}
else if (type == GRID_GENERIC && chardim && ( (!strstr(xname, "lon") && !strstr(xdimname, "lon")) ||
(!strstr(yname, "lat") && !strstr(ydimname, "lat")) )
)/* && (strcmp(chardim, "oline") == 0 || strcmp(chardim, "basin") == 0 || strcmp(chardim, "siline") == 0)) */
{
......@@ -4303,7 +4293,7 @@ register_all_dimensions(list_t *kvl, int streamID, struct mapping vars[], int ta
}
static char *
get_frequency(list_t *kvl, int streamID, int vlistID, int taxisID, int miptab_freq)
get_frequency(/*list_t *kvl,*/ int vlistID, int miptab_freq)
{
char *frequency = (char *) Malloc(CMOR_MAX_STRING * sizeof(char));
strcpy(frequency, "no");
......@@ -4449,7 +4439,7 @@ get_tunitsec(int tunit)
}
static juldate_t
get_cmor_time_val(list_t *kvl, int taxisID, juldate_t ref_date, int tunitsec, int calendar, char *frequency, int ts_id)
get_cmor_time_val(list_t *kvl, int taxisID, juldate_t ref_date, int /*tunitsec*/, int calendar, char *frequency, int ts_id)
{
int year, month, day;
cdiDecodeDate(taxisInqVdate(taxisID), &year, &month, &day);
......@@ -4547,7 +4537,7 @@ get_cmor_time_val(list_t *kvl, int taxisID, juldate_t ref_date, int tunitsec, in
static double *
get_time_bounds(list_t *kvl, int taxisID, int ifreq, juldate_t ref_date, juldate_t jtime_val, int calendar,
int tunitsec, double *time_bnds, int time_axis, int vlistID)
int tunitsec, double *time_bnds, int time_axis, int /*vlistID*/)
{
double time_val = juldate_to_seconds(juldate_sub(jtime_val, ref_date)) / tunitsec;
int vtime0b, vtime1b, vtimecorr;
......@@ -4780,7 +4770,7 @@ check_for_sfc_pressure(int *ps_index, struct mapping vars[], int vlistID, int ti
}
static int
check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int calendar)
check_append_and_size(list_t *kvl, int /*vlistID*/, char *testIn, int ifreq, int calendar)
{
char *test = testIn;
size_t filesize = fileSize((const char *) testIn);
......@@ -4982,7 +4972,7 @@ check_append_and_size(list_t *kvl, int vlistID, char *testIn, int ifreq, int cal
}
static char *
use_chunk_des_files(list_t *kvl, int vlistID, int var_id, char *chunk_des_file, int ifreq, int calendar)
use_chunk_des_files(list_t *kvl, int vlistID, int /*var_id*/, char *chunk_des_file, int ifreq, int calendar)
{
char *chunk_file = (char *) Malloc(4096 * sizeof(char));
if (file_exist(chunk_des_file, false, "chunk_description", false))
......@@ -5157,11 +5147,10 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
char *frequency = nullptr;
if (time_axis != 4)
{
frequency = get_frequency(kvl, *streamID, vlistID, taxisID, miptab_freq);
frequency = get_frequency(/*kvl,*/ vlistID, miptab_freq);
if (Options::cdoVerbose && strcmp(frequency, "no") != 0 ) cdoPrint("10.1. Successfully retrieved frequency %s.", frequency);
}
else if (Options::cdoVerbose ) cdoPrint("10.1. Successfully retrieved fixed time axis.");
int ifreq = 0;
if (frequency)
......@@ -5220,8 +5209,6 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
if (Options::cdoVerbose) cdoPrint("10.4. Start to loop over time steps.");
while ((nrecs = cdoStreamInqTimestep(*streamID, tsID++)))
{
int ntsteps = vlistNtsteps(vlistID);
double time_bnds[2];
double *time_bndsp;
juldate_t jtime_val;
......@@ -5469,12 +5456,12 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
realization = kv_get_a_val(kvl, "realization_index", nullptr);
if ( realization[0] == '0' && realization[1] )
{
{
char newname[CDI_MAX_NAME], oldmember[CDI_MAX_NAME],
newmember[CDI_MAX_NAME], chunkpath[CDI_MAX_NAME], oldchunkpath[CDI_MAX_NAME];
sprintf(oldmember, "r%ldi", atol(realization));
sprintf(newmember, "r%si", realization);
char *startcmp = file_name;
int startpattern = 0, lastSlash = 0;
strcpy(chunkpath,file_name);
......@@ -5508,7 +5495,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
lastSlash = startpattern;
startpattern++;
}
strcpy(chunkpath, newname);
chunkpath[lastSlash] = '\0';
char command[CDI_MAX_NAME];
......@@ -5562,10 +5549,10 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
if (charname) Free(charname);
if (Options::cdoVerbose) cdoPrint("11. Successfully closed files and freed allocated memory.");
}
/*
static int find_cmorvar(list_t *tester, char *cn, char * miptabfreq)
{
keyValues_t *kvcharcn = nullptr, *kvn = nullptr, *kvmip = nullptr;
keyValues_t *kvcharcn = nullptr, *kvmip = nullptr;
kvcharcn = kvlist_search(tester, "cmor_name");
if ( kvcharcn )
......@@ -5585,7 +5572,7 @@ static int find_cmorvar(list_t *tester, char *cn, char * miptabfreq)
}
return 0;
}
*/
static void
read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
{
......@@ -5627,8 +5614,6 @@ read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
maptab);
return;
}
const char *ventry[] = { "&parameter" };
int nventry = (int) sizeof(ventry) / sizeof(ventry[0]);
/***/
/* If a variable selector name or code is given in cmdline, the corresponding variable is picked from Infile and
* mapped. */
......@@ -5656,8 +5641,8 @@ read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
cdoWarning("5.1. In applying the mapping table '%s':\n Only the first value of commandline "
"variable selection key 'name' is processed.",
maptab);
maptab_via_cmd(maptab, pml, kvn->values[0], vlistID, "name", kvcn->values[0],
miptabfreq, filetype, vars, maptab);
maptab_via_cmd(maptab, pml, kvn->values[0], vlistID, "name", kvcn->values[0],
miptabfreq, filetype, maptab);
}
else if (kvc)
{
......@@ -5667,8 +5652,8 @@ read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
cdoWarning("5.1. In applying the mapping table '%s':\n Only the first value of commandline "
"variable selection key 'code' is processed.",
maptab);
maptab_via_cmd(maptab, pml, kvc->values[0], vlistID, "code", kvcn->values[0],
miptabfreq, filetype, vars, maptab);
maptab_via_cmd(maptab, pml, kvc->values[0], vlistID, "code", kvcn->values[0],
miptabfreq, filetype, maptab);
}
else if (kvcn)
{
......@@ -5684,17 +5669,17 @@ read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
/* Begin with Code in case infile is of type GRB */
/***/
if (filetype == CDI_FILETYPE_GRB || filetype == CDI_FILETYPE_GRB2)
if (maptab_via_key(maptab, pml, vlistID, varID, nventry, ventry, "code", miptabfreq))
if (maptab_via_key(maptab, pml, vlistID, varID, "code", miptabfreq))
{
if (Options::cdoVerbose) cdoPrint("5.1. Successfully mapped varID '%d' via code.", varID);
continue;
}
if (maptab_via_key(maptab, pml, vlistID, varID, nventry, ventry, "name", miptabfreq))
if (maptab_via_key(maptab, pml, vlistID, varID, "name", miptabfreq))
{
if (Options::cdoVerbose) cdoPrint("5.1. Successfully mapped varID '%d' via name.", varID);
continue;
}
if (maptab_via_key(maptab, pml, vlistID, varID, nventry, ventry, "code", miptabfreq))
if (maptab_via_key(maptab, pml, vlistID, varID, "code", miptabfreq))
{
if (Options::cdoVerbose) cdoPrint("5.1. Successfully mapped varID '%d' via code.", varID);
continue;
......@@ -5702,7 +5687,7 @@ read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapping vars[])
/***/
/* In case corresponding mapping table entry does not contain a variable selector attribute */
/***/
if (maptab_via_key(maptab, pml, vlistID, varID, nventry, ventry, "cmor_name", miptabfreq))
if (maptab_via_key(maptab, pml, vlistID, varID, "cmor_name", miptabfreq))
{
if (Options::cdoVerbose) cdoPrint("5.1. Successfully mapped varID '%d' via cmor_name.", varID);
continue;
......@@ -5879,7 +5864,7 @@ freq_from_path(char *mip_table)
}
static int
get_miptab_freq(list_t *kvl, char *mip_table, char *project_id)
get_miptab_freq(char *mip_table, char *project_id)
{
int miptab_freq = 0;
char *freq = freq_from_path(mip_table);
......@@ -6097,7 +6082,7 @@ CMOR(void *process)
Free(mip_table);
mip_table = strdup(miptemp);
#endif
int miptab_freq = get_miptab_freq(kvl, mip_table, project_id);
int miptab_freq = get_miptab_freq(mip_table, project_id);
char *miptab_freqptr = strdup(freq_from_path(mip_table));
kv_insert_a_val(kvl, "miptab_freq", miptab_freqptr, 1);
......@@ -6114,7 +6099,7 @@ CMOR(void *process)
if (Options::cdoVerbose) cdoPrint("4. Start to check attributes.");
/* Short keys from rtu, mt, gi must be included similar to global atts */
add_globalhybrids(kvl, vlistID, project_id);
add_globalhybrids(kvl, vlistID);
/* Allow time units from infile */
check_required_time_units(kvl, vlistInqTaxis(vlistID));
......
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