Skip to content

Commit

Permalink
Tools: Fix case with bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Jun 14, 2024
1 parent d5ecfd8 commit 1f2e30f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/grib_check_gaussian_grids.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ${tools_dir}/grib_check_gaussian_grid -f -v $tempGrib 2> $tempText
status=$?
set -e
[ $status -eq 1 ]
grep -q "Error: Sum of pl array 50662 does not match numberOfValues 44" $tempText
grep -q "Error: Sum of pl array 50662 does not match size of values array 44" $tempText

# Octahedral
# set +e
Expand Down
11 changes: 6 additions & 5 deletions tools/grib_check_gaussian_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ static int process_file(const char* filename)

while ((h = grib_handle_new_from_file(0, in, &err)) != NULL) {
int is_reduced_gaussian = 0, is_regular_gaussian = 0, grid_ok = 0;
long edition = 0, N = 0, Nj = 0, numberOfDataPoints, numberOfValues, angleSubdivisions;
long edition = 0, N = 0, Nj = 0, numberOfDataPoints, angleSubdivisions;
size_t numberOfValues = 0;
size_t len = 0, sizeOfValuesArray = 0;
double* lats = NULL;
long* pl = NULL;
Expand Down Expand Up @@ -117,7 +118,7 @@ static int process_file(const char* filename)
GRIB_CHECK(grib_get_long(h, "N", &N), 0);
GRIB_CHECK(grib_get_long(h, "Nj", &Nj), 0);
GRIB_CHECK(grib_get_long(h, "numberOfDataPoints", &numberOfDataPoints), 0);
GRIB_CHECK(grib_get_long(h, "numberOfValues", &numberOfValues), 0);
GRIB_CHECK(grib_get_size(h, "values", &numberOfValues), 0);
GRIB_CHECK(grib_get_double(h, "latitudeOfFirstGridPointInDegrees", &lat1), 0);
GRIB_CHECK(grib_get_double(h, "longitudeOfFirstGridPointInDegrees", &lon1), 0);
GRIB_CHECK(grib_get_double(h, "latitudeOfLastGridPointInDegrees", &lat2), 0);
Expand Down Expand Up @@ -208,8 +209,8 @@ static int process_file(const char* filename)
if (pl_sum != numberOfDataPoints) {
error(filename, msg_num, "Sum of pl array %ld does not match numberOfDataPoints %ld\n", pl_sum, numberOfDataPoints);
}
if (pl_sum != numberOfValues) {
error(filename, msg_num, "Sum of pl array %ld does not match numberOfValues %ld\n", pl_sum, numberOfValues);
if ( (size_t)pl_sum != numberOfValues ) {
error(filename, msg_num, "Sum of pl array %ld does not match size of values array %zu\n", pl_sum, numberOfValues);
}
GRIB_CHECK(grib_get_long(h, "isOctahedral", &is_octahedral), 0);
if (is_octahedral) {
Expand All @@ -233,7 +234,7 @@ static int process_file(const char* filename)

GRIB_CHECK(grib_get_size(h, "values", &sizeOfValuesArray), 0);
if (sizeOfValuesArray != (size_t)numberOfDataPoints) {
error(filename, msg_num, "Number of data points %d different from size of values array %d\n",
error(filename, msg_num, "Number of data points %ld different from size of values array %zu\n",
numberOfDataPoints, sizeOfValuesArray);
}

Expand Down

0 comments on commit 1f2e30f

Please sign in to comment.