From 438a3bb95767b0fef444a8d4b0f6fa4bf25c54ea Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 6 Jun 2022 14:50:05 +0100 Subject: [PATCH] ECC-1397: Tools: grib_ls nearest neighbour with JSON output --- tools/grib_ls.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/grib_ls.c b/tools/grib_ls.c index e6690b285..5570dfe93 100644 --- a/tools/grib_ls.c +++ b/tools/grib_ls.c @@ -322,6 +322,8 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) } if (json_latlon) { + int istart = 0; + int iend = LATLON_SIZE; const char* s = "\n[\n"; double missingValue = 9999; char value[MAX_STRING_LEN]; @@ -336,7 +338,11 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) else printf("\"nearest\""); printf("\n, \"neighbours\" : "); - for (i = 0; i < LATLON_SIZE; i++) { + if (options->latlon_mode == 1) { + istart = options->latlon_idx; + iend = istart + 1; + } + for (i = istart; i < iend; i++) { printf("%s", s); len = MAX_STRING_LEN; printf(