Skip to content

Commit

Permalink
remove printfs
Browse files Browse the repository at this point in the history
  • Loading branch information
mauzey1 committed Aug 26, 2024
1 parent 88b37a6 commit 322de2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
7 changes: 0 additions & 7 deletions Src/cmor_variables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,8 +1118,6 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims,
strcpy(cmor_vars[vrid].base_path, "");
strcpy(cmor_vars[vrid].current_path, "");
strcpy(cmor_vars[vrid].frequency, refvar.frequency);
printf("refvar.frequency = %s\n", refvar.frequency);
printf("strlen(refvar.frequency) = %u\n", strlen(refvar.frequency));
cmor_vars[vrid].suffix_has_date = 0;

/* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -1154,8 +1152,6 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims,
cmor_vars[vrid].quantize_mode = refvar.quantize_mode;
cmor_vars[vrid].quantize_nsd = refvar.quantize_nsd;
strcpy(cmor_vars[vrid].chunking_dimensions, refvar.chunking_dimensions);
printf("refvar.chunking_dimensions = %s\n", refvar.chunking_dimensions);
printf("strlen(refvar.chunking_dimensions) = %u\n", strlen(refvar.chunking_dimensions));

if (refvar.out_name[0] == '\0') {
strncpy(cmor_vars[vrid].id, name, CMOR_MAX_STRING);
Expand Down Expand Up @@ -1686,9 +1682,6 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims,
cmor_axes[laxes_ids[i]].id);
cmor_update_history(vrid, msg);
cmor_vars[vrid].singleton_ids[i - k] = laxes_ids[i];
printf("singleton dim: cmor_vars[%d].singleton_ids[%d] = laxes_ids[%d]\n", vrid, i - k, i);
printf("singleton dim: laxes_ids[%d] = %d\n", i, laxes_ids[i]);
printf("singleton dim: cmor_axes[%d].id = %s\n", laxes_ids[i], cmor_axes[laxes_ids[i]].id);
if (cmor_has_variable_attribute(vrid, "coordinates") == 0) {
cmor_get_variable_attribute(vrid, "coordinates", &msg[0]);
} else {
Expand Down
33 changes: 4 additions & 29 deletions Test/test_singletons.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int test_bs550aer(const int *axes_ids, int num_axes, int zfactor_id, double base
int var_id;
float values[8], miss = 1.e20f;
char positive = '\0';
int i, singleton_id;
int i;
int scatangle_found = 0;
int wavelength_found = 0;

Expand All @@ -43,14 +43,10 @@ int test_bs550aer(const int *axes_ids, int num_axes, int zfactor_id, double base
fail("cmor_variable(bs550aer)");

// Find singleton dimension for bs550aer
for(i = 0; i < num_axes; ++i){
singleton_id = cmor_vars[var_id].singleton_ids[i];
if(singleton_id != -1) {
if(strcmp(cmor_axes[singleton_id].id, "wavelength") == 0)
wavelength_found++;
}
for(i = 0; i < cmor_vars[var_id].ndims; ++i){
if(strcmp(cmor_axes[cmor_vars[var_id].singleton_ids[i]].id, "wavelength") == 0)
wavelength_found++;
}
printf("wavelength_found = %d\n", wavelength_found);

if(wavelength_found != 1)
fail("error in singleton dimension");
Expand Down Expand Up @@ -86,7 +82,6 @@ static void run_test()
double scalar;
int nlon, nlat, nlev;
int zfactor_id;
int i;

int axes_ids[5];
int zfactor_axis_ids[3];
Expand Down Expand Up @@ -139,35 +134,15 @@ static void run_test()
if (cmor_zfactor(&zfactor_id, id_alev, (char *) "p0", (char *) "Pa", 0, 0,
'd', (void *) p0, NULL) != 0)
fail("cmor_zfactor(p0)");
printf("cmor_vars[%d].ndims = %d\n", zfactor_id, cmor_vars[zfactor_id].ndims);
for(i = 0; i < cmor_vars[zfactor_id].ndims; ++i){
printf("cmor_vars[%d].axes_ids[%d].axes_ids = %d\n", zfactor_id, i, cmor_vars[zfactor_id].axes_ids[i]);
printf("cmor_axes[%d].id = %s\n", cmor_vars[zfactor_id].axes_ids[i], cmor_axes[cmor_vars[zfactor_id].axes_ids[i]].id);
}
if (cmor_zfactor(&zfactor_id, id_alev, (char *) "b", (char *) "", 1, &lev_id_array[0],
'd', (void *) b_val, (void *) b_bnds) != 0)
fail("cmor_zfactor(b)");
printf("cmor_vars[%d].ndims = %d\n", zfactor_id, cmor_vars[zfactor_id].ndims);
for(i = 0; i < cmor_vars[zfactor_id].ndims; ++i){
printf("cmor_vars[%d].axes_ids[%d].axes_ids = %d\n", zfactor_id, i, cmor_vars[zfactor_id].axes_ids[i]);
printf("cmor_axes[%d].id = %s\n", cmor_vars[zfactor_id].axes_ids[i], cmor_axes[cmor_vars[zfactor_id].axes_ids[i]].id);
}
if (cmor_zfactor(&zfactor_id, id_alev, (char *) "a", (char *) "", 1, &lev_id_array[0],
'd', (void *) a_val, (void *) a_bnds) != 0)
fail("cmor_zfactor(a)");
printf("cmor_vars[%d].ndims = %d\n", zfactor_id, cmor_vars[zfactor_id].ndims);
for(i = 0; i < cmor_vars[zfactor_id].ndims; ++i){
printf("cmor_vars[%d].axes_ids[%d].axes_ids = %d\n", zfactor_id, i, cmor_vars[zfactor_id].axes_ids[i]);
printf("cmor_axes[%d].id = %s\n", cmor_vars[zfactor_id].axes_ids[i], cmor_axes[cmor_vars[zfactor_id].axes_ids[i]].id);
}
if (cmor_zfactor(&zfactor_id, id_alev, (char *) "ps1", (char *) "Pa", 3, zfactor_axis_ids,
'd', NULL, NULL) != 0)
fail("cmor_zfactor(ps1)");
printf("cmor_vars[%d].ndims = %d\n", zfactor_id, cmor_vars[zfactor_id].ndims);
for(i = 0; i < cmor_vars[zfactor_id].ndims; ++i){
printf("cmor_vars[%d].axes_ids[%d].axes_ids = %d\n", zfactor_id, i, cmor_vars[zfactor_id].axes_ids[i]);
printf("cmor_axes[%d].id = %s\n", cmor_vars[zfactor_id].axes_ids[i], cmor_axes[cmor_vars[zfactor_id].axes_ids[i]].id);
}

/*
* No singleton dimensions are passed.
Expand Down

0 comments on commit 322de2a

Please sign in to comment.