Examples: comments/err msgs

This commit is contained in:
Shahram Najm 2020-06-01 20:21:53 +01:00
parent b4a6bfc920
commit d4f030225a
2 changed files with 14 additions and 14 deletions

View File

@ -110,25 +110,25 @@ int main(int argc, char* argv[])
codes_index_select_string(index, "shortName", shortName[i]);
for (l = 0; l < levelSize; l++) {
/* select the GRIB with level=levels[i] */
/* select the GRIB with level=levels[l] */
codes_index_select_long(index, "level", levels[l]);
for (j = 0; j < numberSize; j++) {
/* select the GRIB with number=numbers[i] */
/* select the GRIB with number=numbers[j] */
codes_index_select_long(index, "number", numbers[j]);
for (k = 0; k < stepSize; k++) {
/* select the GRIB with step=steps[i] */
/* select the GRIB with step=steps[k] */
codes_index_select_long(index, "step", steps[k]);
/* create a new codes_handle from the index with the constraints
imposed by the select statements. It is a loop because
in the index there could be more than one GRIB with those
constraints */
imposed by the select statements. It is a loop because
in the index there could be more than one GRIB with those
constraints */
while ((h = codes_handle_new_from_index(index, &ret)) != NULL) {
count++;
if (ret) {
fprintf(stderr, "Error: %d\n", ret);
fprintf(stderr, "Error: %s\n", codes_get_error_message(ret));
exit(ret);
}
lenshortName = 200;

View File

@ -102,25 +102,25 @@ int main(int argc, char* argv[])
grib_index_select_string(index, "shortName", shortNames[i]);
for (l = 0; l < levelSize; l++) {
/* select the GRIB with level=levels[i] */
/* select the GRIB with level=levels[l] */
grib_index_select_long(index, "level", levels[l]);
for (j = 0; j < numberSize; j++) {
/* select the GRIB with number=numbers[i] */
/* select the GRIB with number=numbers[j] */
grib_index_select_long(index, "number", numbers[j]);
for (k = 0; k < stepSize; k++) {
/* select the GRIB with step=steps[i] */
/* select the GRIB with step=steps[k] */
grib_index_select_long(index, "step", steps[k]);
/* create a new grib_handle from the index with the constraints
imposed by the select statements. It is a loop because
in the index there could be more than one GRIB with those
constraints */
imposed by the select statements. It is a loop because
in the index there could be more than one GRIB with those
constraints */
while ((h = grib_handle_new_from_index(index, &ret)) != NULL) {
count++;
if (ret) {
printf("error: %d\n", ret);
printf("error: %s\n", grib_get_error_message(ret));
exit(ret);
}
lenShortName = 200;