From 635628739b97a6de37add47d41bf3861e722b68d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 13 Aug 2015 15:02:00 +0100 Subject: [PATCH] GRIB-816: grib_get: using nearest function with multiple files gives incorrect results --- tools/grib_get.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/grib_get.c b/tools/grib_get.c index 66ca54e3c..4ae8da10c 100644 --- a/tools/grib_get.c +++ b/tools/grib_get.c @@ -141,11 +141,12 @@ 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; } + } } } @@ -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];