Tools: Fix case with bitmap

This commit is contained in:
shahramn 2024-06-14 16:36:03 +01:00
parent 15f354886f
commit aeee112cb1
2 changed files with 7 additions and 6 deletions

View File

@ -91,7 +91,7 @@ ${tools_dir}/grib_check_gaussian_grid -f -v $tempGrib 2> $tempText
status=$? status=$?
set -e set -e
[ $status -eq 1 ] [ $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 # Octahedral
# set +e # set +e

View File

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