GRIB-816: grib_get: using nearest function with multiple files gives incorrect results

This commit is contained in:
Shahram Najm 2015-08-13 15:02:00 +01:00
parent cc541d6aa8
commit 635628739b
1 changed files with 3 additions and 2 deletions

View File

@ -141,13 +141,14 @@ int grib_tool_init(grib_runtime_options* options)
if (options->latlon_idx<0){
min=0;
options->latlon_idx=0;
for (i=1;i<4;i++)
for (i=1;i<4;i++) {
if (min>options->distances[i]) {
min = options->distances[i];
options->latlon_idx=i;
}
}
}
}
return 0;
}
@ -181,7 +182,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options,grib_handle* h)
int i;
if (!n) n=grib_nearest_new(h,&err);
GRIB_CHECK_NOLINE(err,0);
GRIB_CHECK_NOLINE(grib_nearest_find(n,h,lat,lon,mode,
GRIB_CHECK_NOLINE(grib_nearest_find(n,h,lat,lon,0,
options->lats,options->lons,options->values,
options->distances,options->indexes,&size),0);
min=options->distances[0];