From f8b61c28bd7df3aac01ecb93d2ed72aea893837d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 1 Mar 2021 22:23:12 +0000 Subject: [PATCH] Cosmetics --- ...or_class_data_g1second_order_general_extended_packing.c | 1 - src/grib_geography.c | 1 - src/grib_index.c | 4 ---- src/grib_nearest_class_latlon_reduced.c | 6 ++++++ src/grib_nearest_class_regular.c | 7 ++++++- src/grib_util.c | 2 -- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/grib_accessor_class_data_g1second_order_general_extended_packing.c b/src/grib_accessor_class_data_g1second_order_general_extended_packing.c index 454472d39..79e28e2ce 100644 --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.c +++ b/src/grib_accessor_class_data_g1second_order_general_extended_packing.c @@ -535,7 +535,6 @@ static void grib_split_long_groups(grib_handle* hand, grib_context* c, long* num long* localFirstOrderValues; int maxNumberOfGroups = *numberOfGroups * 2; - /* the widthOfLengths is the same for all the groupLengths and therefore if few big groups are present all the groups have to be coded with a large number of bits (big widthOfLengths) even if the majority of them is small. diff --git a/src/grib_geography.c b/src/grib_geography.c index 3c60f9f28..d236580af 100644 --- a/src/grib_geography.c +++ b/src/grib_geography.c @@ -33,7 +33,6 @@ #define M_PI 3.14159265358979323846 #endif - static void gauss_first_guess(long trunc, double* vals) { long i = 0, numVals; diff --git a/src/grib_index.c b/src/grib_index.c index 216b3a3b1..fbb597d2e 100644 --- a/src/grib_index.c +++ b/src/grib_index.c @@ -22,7 +22,6 @@ #define NULL_MARKER 0 #define NOT_NULL_MARKER 255 - /* #if GRIB_PTHREADS */ #if 0 static pthread_once_t once = PTHREAD_ONCE_INIT; @@ -57,7 +56,6 @@ static void init() } #endif - static const char* mars_keys = "mars.date,mars.time,mars.expver,mars.stream,mars.class,mars.type," "mars.step,mars.param,mars.levtype,mars.levelist,mars.number,mars.iteration," @@ -81,7 +79,6 @@ static char* get_key(char** keys, int* type) while (*p == ' ') p++; - while (*p != 0 && *p != ':' && *p != ',') p++; if (*p == ':') { @@ -1404,7 +1401,6 @@ int grib_index_add_file(grib_index* index, const char* filename) if (err) return err; field->length=length; - if (field_tree->field) { grib_field* pfield=field_tree->field; while (pfield->next) pfield=pfield->next; diff --git a/src/grib_nearest_class_latlon_reduced.c b/src/grib_nearest_class_latlon_reduced.c index 3be537bea..5c4243718 100644 --- a/src/grib_nearest_class_latlon_reduced.c +++ b/src/grib_nearest_class_latlon_reduced.c @@ -136,6 +136,9 @@ static int find(grib_nearest* nearest, grib_handle* h, return ret; radius = ((double)iradius) / 1000.0; + /* Compute lat/lon info, create iterator etc if it's the 1st time or different grid. + * This is for performance: if the grid has not changed, we only do this once + * and reuse for other messages */ if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID) == 0) { double dummy = 0; double olat = 1.e10; @@ -183,6 +186,9 @@ static int find(grib_nearest* nearest, grib_handle* h, } nearest->h = h; + /* Compute distances if it's the 1st time or different point or different grid. + * This is for performance: if the grid and the input point have not changed + * we only do this once and reuse for other messages */ if (!self->distances || (flags & GRIB_NEAREST_SAME_POINT) == 0 || (flags & GRIB_NEAREST_SAME_GRID) == 0) { double* lons = NULL; int nlon = 0; diff --git a/src/grib_nearest_class_regular.c b/src/grib_nearest_class_regular.c index 72a13d426..18f1c6f50 100644 --- a/src/grib_nearest_class_regular.c +++ b/src/grib_nearest_class_regular.c @@ -175,7 +175,6 @@ static int find(grib_nearest* nearest, grib_handle* h, } nearest->h=h; - } if (!self->distances || (flags & GRIB_NEAREST_SAME_POINT)==0 @@ -258,6 +257,9 @@ static int find(grib_nearest* nearest, grib_handle* h, return ret; radius = ((double)iradius) / 1000.0; + /* Compute lat/lon info, create iterator etc if it's the 1st time or different grid. + * This is for performance: if the grid has not changed, we only do this once + * and reuse for other messages */ if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID) == 0) { double dummy = 0; double olat = 1.e10, olon = 1.e10; @@ -342,6 +344,9 @@ static int find(grib_nearest* nearest, grib_handle* h, } nearest->h = h; + /* Compute distances if it's the 1st time or different point or different grid. + * This is for performance: if the grid and the input point have not changed + * we only do this once and reuse for other messages */ if (!self->distances || (flags & GRIB_NEAREST_SAME_POINT) == 0 || (flags & GRIB_NEAREST_SAME_GRID) == 0) { int nearest_lons_found = 0; diff --git a/src/grib_util.c b/src/grib_util.c index 759fd6fd2..5b94e96b8 100644 --- a/src/grib_util.c +++ b/src/grib_util.c @@ -1086,7 +1086,6 @@ grib_handle* grib_util_set_spec2(grib_handle* h, if (h->context->debug == -1) fprintf(stderr, "ECCODES DEBUG grib_util: done grib_set_double_array \n"); - /* convert to second_order if not constant field */ if (setSecondOrder) { int constant = 0; @@ -1249,7 +1248,6 @@ grib_handle* grib_util_set_spec2(grib_handle* h, COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); break; - case GRIB_UTIL_GRID_SPEC_REDUCED_LL: COPY_SPEC_LONG(bitmapPresent); if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue);