TIGGE: pl array is array of integers not doubles

This commit is contained in:
Shahram Najm 2022-12-19 12:23:31 +00:00
parent c4e98b0342
commit 96bdbcd70f
1 changed files with 4 additions and 4 deletions

View File

@ -294,24 +294,24 @@ static void gaussian_grid(grib_handle* h)
if(get(h,"PLPresent")) { if(get(h,"PLPresent")) {
size_t count, i, nPl; size_t count, i, nPl;
int err_code = grib_get_size(h,"pl",&count); int err_code = grib_get_size(h,"pl",&count);
double *pl; long *pl = NULL;
double expected_lon2 = 0; double expected_lon2 = 0;
long total, max_pl = 0; long total, max_pl = 0;
long numberOfValues = get(h,"numberOfValues"); long numberOfValues = get(h,"numberOfValues");
long numberOfDataPoints = get(h,"numberOfDataPoints"); long numberOfDataPoints = get(h,"numberOfDataPoints");
if(err_code) { if(err_code) {
printf("%s, field %d [%s]: cannot number of pl: %s\n",file,field,param,grib_get_error_message(err_code)); printf("%s, field %d [%s]: cannot get size of pl: %s\n",file,field,param,grib_get_error_message(err_code));
error++; error++;
return; return;
} }
pl = (double*)malloc(sizeof(double)*(count)); pl = (long*)malloc(sizeof(long)*count);
CHECK(pl != NULL); CHECK(pl != NULL);
if (!pl) return; if (!pl) return;
nPl = count; nPl = count;
if((err_code = grib_get_double_array(h,"pl",pl,&count))) if((err_code = grib_get_long_array(h, "pl", pl, &count)))
{ {
printf("%s, field %d [%s]: cannot get pl: %s\n",file,field,param,grib_get_error_message(err_code)); printf("%s, field %d [%s]: cannot get pl: %s\n",file,field,param,grib_get_error_message(err_code));
free(pl); free(pl);