ECC-992: Adjust min. limit for 247

This commit is contained in:
Shahram Najm 2020-02-20 12:03:49 +00:00
parent a6ad6990ca
commit 9222fe2873
10 changed files with 51 additions and 42 deletions

View File

@ -70,7 +70,7 @@ concept param_value_min(default_min_val) {
170 = { paramId=228096; }
170 = { paramId=228095; }
0 = { paramId=43; }
0 = { paramId=247; }
-0.01 = { paramId=247; }
0 = { paramId=246; }
-0.1 = { paramId=133; }
43000 = { paramId=134; }

View File

@ -59,50 +59,54 @@ int main(int argc, char** argv)
while (fscanf(fin, "%ld %g %g", &iid, &lat, &lon) != EOF)
npoints++;
fclose(fin);
if (npoints==0) {
fprintf(stderr, "No input points found!\n");
exit(1);
}
id = (long*)calloc(npoints, sizeof(long));
if (!id) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(long)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(long)));
exit(1);
}
vlat = (double*)calloc(npoints, sizeof(double));
if (!vlat) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
vlon = (double*)calloc(npoints, sizeof(double));
if (!vlon) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
outlats = (double*)calloc(npoints, sizeof(double));
if (!outlats) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
outlons = (double*)calloc(npoints, sizeof(double));
if (!outlons) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
values = (double*)calloc(npoints, sizeof(double));
if (!values) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
lsm_values = (double*)calloc(npoints, sizeof(double));
if (!lsm_values) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
distances = (double*)calloc(npoints, sizeof(double));
if (!distances) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(double)));
exit(1);
}
indexes = (int*)calloc(npoints, sizeof(int));
if (!indexes) {
printf("unable to allocate %ld bytes\n", (long)(npoints * sizeof(int)));
fprintf(stderr, "unable to allocate %ld bytes\n", (long)(npoints * sizeof(int)));
exit(1);
}
@ -132,7 +136,7 @@ int main(int argc, char** argv)
}
h = codes_handle_new_from_file(0, fin, PRODUCT_GRIB, &ret);
if (!h || ret != CODES_SUCCESS) {
printf(" unable to create handle\n");
fprintf(stderr, "unable to create handle\n");
exit(1);
}

View File

@ -316,24 +316,24 @@ static void _push_handle(grib_handle *h,int *gid)
static void _push_index(grib_index *h,int *gid)
{
l_grib_index* current= index_set;
l_grib_index* current= NULL;
l_grib_index* previous= index_set;
l_grib_index* the_new= NULL;
int myindex= 1;
/*
if (*gid > 0 ) {
while(current) {
if(current->id == *gid) break;
current = current->next;
if (*gid > 0 ) {
while(current) {
if(current->id == *gid) break;
current = current->next;
}
if (current) {
grib_index_delete(current->h);
current->h=h;
return;
}
}
if (current) {
grib_index_delete(current->h);
current->h=h;
return;
}
}
*/
*/
if(!index_set){
index_set = (l_grib_index*)malloc(sizeof(l_grib_index));
@ -374,24 +374,24 @@ static void _push_index(grib_index *h,int *gid)
static void _push_multi_handle(grib_multi_handle *h,int *gid)
{
l_grib_multi_handle* current= multi_handle_set;
l_grib_multi_handle* current= NULL;
l_grib_multi_handle* previous= multi_handle_set;
l_grib_multi_handle* the_new= NULL;
int myindex= 1;
/*
if (*gid > 0 ) {
while(current) {
if(current->id == *gid) break;
current = current->next;
if (*gid > 0 ) {
while(current) {
if(current->id == *gid) break;
current = current->next;
}
if (current) {
grib_multi_handle_delete(current->h);
current->h=h;
return;
}
}
if (current) {
grib_multi_handle_delete(current->h);
current->h=h;
return;
}
}
*/
*/
if(!multi_handle_set){
multi_handle_set = (l_grib_multi_handle*)malloc(sizeof(l_grib_multi_handle));

View File

@ -27,8 +27,10 @@ int compute_bufr_key_rank(grib_handle* h, grib_string_list* keys, const char* ke
}
if (!next) {
DebugAssert(prev);
prev->next = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list));
next = prev->next;
if (prev) {
prev->next = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list));
next = prev->next;
}
}
if (!next->value) {
next->value = strdup(key);

View File

@ -430,7 +430,7 @@ int grib_accessor_notify_change(grib_accessor* a, grib_accessor* changed)
return c->notify_change(a, changed);
c = c->super ? *(c->super) : NULL;
}
if (a)
if (a && a->cclass)
printf("notify_change not implemented for %s %s\n", a->cclass->name, a->name);
Assert(0);
return 0;

View File

@ -325,8 +325,10 @@ int grib_section_adjust_sizes(grib_section* s, int update, int depth)
else {
if (!s->h->partial) {
if (length >= plen) {
grib_context_log(s->h->context, GRIB_LOG_ERROR, "Invalid size %ld found for %s, assuming %ld",
if (s->owner) {
grib_context_log(s->h->context, GRIB_LOG_ERROR, "Invalid size %ld found for %s, assuming %ld",
(long)plen, s->owner->name, (long)length);
}
plen = length;
}
s->padding = plen - length;

View File

@ -249,7 +249,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
self->dirty = 0;
n_vals = 0;
err = grib_value_count(a, &nn);
n_vals = nn;
if (err)

View File

@ -167,7 +167,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
long numberOfPoints = 0;
if (*len < 1)
ret = GRIB_ARRAY_TOO_SMALL;
return GRIB_ARRAY_TOO_SMALL;
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->directionIncrementGiven, &directionIncrementGiven)) != GRIB_SUCCESS)
return ret;

View File

@ -174,7 +174,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
grib_iterator* iter = NULL;
self->save = 1;
size = 0;
ret = value_count(a, &count);
if (ret)
return ret;

View File

@ -1378,6 +1378,7 @@ static void test_string_splitting()
char input[80] = "Born|To|Be|Wild";
char** list = 0;
list = string_split(input, "|");
assert(list);
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
assert(i == 4);
if (strcmp(list[0], "Born") != 0) assert(0);
@ -1391,6 +1392,7 @@ static void test_string_splitting()
strcpy(input, "12345|a gap|");
list = string_split(input, "|");
assert(list);
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
assert(i == 2);
if (strcmp(list[0], "12345") != 0) assert(0);
@ -1402,6 +1404,7 @@ static void test_string_splitting()
strcpy(input, "Steppenwolf");
list = string_split(input, ",");
assert(list);
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
assert(i == 1);
if (strcmp(list[0], "Steppenwolf") != 0) assert(0);