mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/ECC-1296-uerra-mapping
This commit is contained in:
commit
d6764a3abe
|
@ -79,10 +79,6 @@ int main(int argc, char* argv[])
|
|||
codes_set_long_array(ho, "unexpandedDescriptors", ud, size);
|
||||
|
||||
while ((h = codes_handle_new_from_file(0, f, PRODUCT_BUFR, &err)) != NULL) {
|
||||
if (!h) {
|
||||
fprintf(stderr, "Error: Unable to create BUFR handle\n");
|
||||
return 1;
|
||||
}
|
||||
/* codes_copy_key(h,ho,"unexpandedDescriptors",0); */
|
||||
err = codes_set_long(h, "unpack", 1);
|
||||
if (err) {
|
||||
|
@ -97,7 +93,7 @@ int main(int argc, char* argv[])
|
|||
printf("Copied %s\n", keys[i]);
|
||||
free(keys[i]);
|
||||
}
|
||||
printf("Total number of copied keys = %lu\n", nkeys);
|
||||
printf("Total number of copied keys = %lu\n", (unsigned long)nkeys);
|
||||
free(keys);
|
||||
|
||||
codes_handle_delete(h);
|
||||
|
|
|
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
/* get the size of the values array*/
|
||||
CODES_CHECK(codes_get_size(h, "numericValues", &values_len), 0);
|
||||
printf(" number of expanded values: %lu\n", values_len);
|
||||
printf(" number of expanded values: %lu\n", (unsigned long)values_len);
|
||||
|
||||
/* allocate array for data values */
|
||||
values = (double*)malloc(values_len * sizeof(double));
|
||||
|
|
|
@ -92,7 +92,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
else {
|
||||
/* for arrays */
|
||||
printf("(array of %lu)\n", klen);
|
||||
printf("(array of %lu)\n", (unsigned long)klen);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
for (i = 0; i < sigt_len; i++) {
|
||||
printf("%3lu %6.0f %6.0f %.1f %.1f\n",
|
||||
i + 1, sigt_pres[i], sigt_geo[i], sigt_t[i], sigt_td[i]);
|
||||
(unsigned long)(i + 1), sigt_pres[i], sigt_geo[i], sigt_t[i], sigt_td[i]);
|
||||
}
|
||||
|
||||
/* Delete handle */
|
||||
|
|
|
@ -38,11 +38,13 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
in = fopen(argv[1], "rb");
|
||||
if (!in) {
|
||||
perror("ERROR: unable to open input file");
|
||||
return 1;
|
||||
}
|
||||
out = fopen(argv[2], "wb");
|
||||
|
||||
if (!in || !out) {
|
||||
perror("ERROR: unable to open files");
|
||||
fclose(out);
|
||||
if (!out) {
|
||||
perror("ERROR: unable to open output file");
|
||||
fclose(in);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
/* get size of "paramId" list */
|
||||
CODES_CHECK(codes_index_get_size(index, "paramId", ¶mIdSize), 0);
|
||||
printf("grib contains %lu different parameters\n", paramIdSize);
|
||||
printf("grib contains %lu different parameters\n", (unsigned long)paramIdSize);
|
||||
/* allocate memory for "paramId" list */
|
||||
paramId = (char**)malloc(paramIdSize * sizeof(char*));
|
||||
/* get list of "paramId" */
|
||||
|
@ -47,7 +47,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
/* get size of ensemble number list */
|
||||
CODES_CHECK(codes_index_get_size(index, "number", &numberSize), 0);
|
||||
printf("GRIB contains %lu different ensemble members\n", numberSize);
|
||||
printf("GRIB contains %lu different ensemble members\n", (unsigned long)numberSize);
|
||||
/* allocate memory for ensemble number list */
|
||||
number = (long*)malloc(numberSize * sizeof(long));
|
||||
/* get list of ensemble numbers */
|
||||
|
|
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
|||
CODES_CHECK(codes_get_size(h, "bitmap", &bmp_len), 0);
|
||||
bitmap = (long*)malloc(bmp_len * sizeof(long));
|
||||
CODES_CHECK(codes_get_long_array(h, "bitmap", bitmap, &bmp_len), 0);
|
||||
printf("Bitmap is present. Num = %lu\n", bmp_len);
|
||||
printf("Bitmap is present. Num = %lu\n", (unsigned long)bmp_len);
|
||||
}
|
||||
/* Sanity check. Number of values must match number in bitmap */
|
||||
CODES_CHECK(codes_get_size(h, "values", &values_len), 0);
|
||||
|
|
|
@ -65,10 +65,6 @@ int main(int argc, char* argv[])
|
|||
codes_keys_iterator* kiter = NULL;
|
||||
msg_count++;
|
||||
printf("-- GRIB N. %d --\n", msg_count);
|
||||
if (!h) {
|
||||
fprintf(stderr, "Error: Unable to create grib handle\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
kiter = codes_keys_iterator_new(h, key_iterator_filter_flags, name_space);
|
||||
if (!kiter) {
|
||||
|
|
|
@ -35,7 +35,6 @@ int main(int argc, char** argv)
|
|||
{
|
||||
int err = 0, i;
|
||||
double* values = NULL;
|
||||
double max, min, average;
|
||||
size_t values_len = 0;
|
||||
|
||||
FILE* in = NULL;
|
||||
|
|
|
@ -35,7 +35,7 @@ static void read_data(FILE* fp, int num_msgs)
|
|||
long stepRange = 0;
|
||||
codes_handle* h = NULL;
|
||||
|
||||
printf("File offset start = %lu\n", ftello(fp));
|
||||
printf("File offset start = %ld\n", ftello(fp));
|
||||
for (i = 0; i < num_msgs; ++i) {
|
||||
h = codes_handle_new_from_file(0, fp, PRODUCT_GRIB, &err);
|
||||
CODES_CHECK(err, 0);
|
||||
|
|
|
@ -232,7 +232,7 @@ int main(int argc, char** argv)
|
|||
size = 496;
|
||||
vdouble = (double*)calloc(size, sizeof(double));
|
||||
if (!vdouble) {
|
||||
fprintf(stderr, "failed to allocate %lu bytes\n", size * sizeof(double));
|
||||
fprintf(stderr, "failed to allocate %lu bytes\n", (unsigned long)(size * sizeof(double)));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ static void encode_double_array_common(int numBits, long packStart, long datasiz
|
|||
unsigned int ival;
|
||||
int cbits, jbits;
|
||||
unsigned int c;
|
||||
static unsigned int mask[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
|
||||
static const unsigned int mask[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
|
||||
|
||||
/* code from gribw routine flist2bitstream */
|
||||
|
||||
|
|
|
@ -789,7 +789,7 @@ grib_accessors_list* grib_accessors_list_last(grib_accessors_list* al)
|
|||
return al->last;
|
||||
}
|
||||
|
||||
grib_accessors_list* grib_accessors_list_find(grib_accessors_list* al, grib_accessor* a)
|
||||
grib_accessors_list* grib_accessors_list_find(grib_accessors_list* al, const grib_accessor* a)
|
||||
{
|
||||
grib_accessors_list* last = al;
|
||||
grib_accessors_list* next = al->next;
|
||||
|
|
|
@ -259,7 +259,7 @@ static int get_native_type(grib_accessor* a)
|
|||
return type;
|
||||
}
|
||||
|
||||
size_t compute_size_AO(long* descriptors, size_t numberOfDescriptors)
|
||||
size_t compute_size_AO(const long* descriptors, size_t numberOfDescriptors)
|
||||
{
|
||||
int i = 0;
|
||||
size_t sizeAO = numberOfDescriptors;
|
||||
|
|
|
@ -225,7 +225,7 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len)
|
|||
return err;
|
||||
|
||||
i = 0;
|
||||
while (val[i] == ' ' && val[i] != 0 && i < l - 1)
|
||||
while (i < l - 1 && val[i] == ' ')
|
||||
i++;
|
||||
|
||||
if (val[i] == 0) {
|
||||
|
|
|
@ -1839,7 +1839,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
sizebits = lengthOfSecondOrderValues;
|
||||
|
||||
/* padding section 4 to an even number of octets */
|
||||
size = (size + offsetBeforeData - offsetSection4) % 2 ? size + 1 : size;
|
||||
size = ((size + offsetBeforeData - offsetSection4) % 2) ? size + 1 : size;
|
||||
half_byte = 8 * size - sizebits;
|
||||
if ((ret = grib_set_long_internal(handle, self->half_byte, half_byte)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
|
|
@ -219,8 +219,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
double* values = (double*)val;
|
||||
size_t inlen = *len;
|
||||
|
||||
int free_buffer = 0;
|
||||
int free_values = 0;
|
||||
/*int free_buffer = 0;
|
||||
*int free_values = 0;*/
|
||||
|
||||
int code = GRIB_SUCCESS;
|
||||
|
||||
|
@ -261,10 +261,11 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
code = grib_ieee_encode_array(a->context, values, inlen, bytes, buffer);
|
||||
|
||||
clean_up:
|
||||
if (free_buffer)
|
||||
free(buffer);
|
||||
if (free_values)
|
||||
free(values);
|
||||
/*if (free_buffer)
|
||||
* free(buffer);
|
||||
* if (free_values)
|
||||
* free(values);
|
||||
*/
|
||||
|
||||
grib_buffer_replace(a, buffer, bufsize, 1, 1);
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a;
|
||||
grib_handle* gh = grib_handle_of_accessor(a);
|
||||
|
||||
size_t i;
|
||||
size_t i = 0;
|
||||
size_t n_vals = *len;
|
||||
int err = 0;
|
||||
int last;
|
||||
|
|
|
@ -161,7 +161,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
char verifyingMonth[7] = {0,};
|
||||
size_t slen = 7;
|
||||
long year = 0, month = 0, date = 0;
|
||||
long mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const long mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
long days = 0;
|
||||
|
||||
if (!a->dirty)
|
||||
|
|
|
@ -248,7 +248,7 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len)
|
|||
return err;
|
||||
|
||||
i = 0;
|
||||
while (val[i] == ' ' && val[i] != 0 && i < l - 1)
|
||||
while (i < l - 1 && val[i] == ' ')
|
||||
i++;
|
||||
|
||||
if (val[i] == 0) {
|
||||
|
|
|
@ -223,7 +223,7 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len)
|
|||
return err;
|
||||
|
||||
i = 0;
|
||||
while (i < l - 1 && val[i] == ' ' && val[i] != 0)
|
||||
while (i < l - 1 && val[i] == ' ')
|
||||
i++;
|
||||
|
||||
if (val[i] == 0) {
|
||||
|
|
|
@ -160,7 +160,7 @@ static size_t preferred_size(grib_accessor* a, int from_handle)
|
|||
/* printf("EVEN %ld %ld\n",(long) a->offset,(long) offset);*/
|
||||
seclen = a->offset - offset;
|
||||
|
||||
return seclen % 2 ? 1 : 0;
|
||||
return (seclen % 2) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void init(grib_accessor* a, const long len, grib_arguments* args)
|
||||
|
|
|
@ -159,7 +159,7 @@ grib_accessor* grib_accessor_get_attribute(grib_accessor* a, const char* name);
|
|||
grib_accessors_list* grib_accessors_list_create(grib_context* c);
|
||||
void grib_accessors_list_push(grib_accessors_list* al, grib_accessor* a, int rank);
|
||||
grib_accessors_list* grib_accessors_list_last(grib_accessors_list* al);
|
||||
grib_accessors_list* grib_accessors_list_find(grib_accessors_list* al, grib_accessor* a);
|
||||
grib_accessors_list* grib_accessors_list_find(grib_accessors_list* al, const grib_accessor* a);
|
||||
void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al);
|
||||
|
||||
/* grib_concept.c */
|
||||
|
@ -317,7 +317,7 @@ bufr_descriptor* accessor_bufr_elements_table_get_descriptor(grib_accessor* a, i
|
|||
/* grib_accessor_class_bufr_has_delayed_replication.c */
|
||||
|
||||
/* grib_accessor_class_apply_operators.c */
|
||||
size_t compute_size_AO(long* descriptors, size_t numberOfDescriptors);
|
||||
size_t compute_size_AO(const long* descriptors, size_t numberOfDescriptors);
|
||||
|
||||
/* grib_accessor_class_non_alpha.c */
|
||||
|
||||
|
@ -1380,11 +1380,11 @@ grib_box* grib_box_factory(grib_handle* h, grib_arguments* args);
|
|||
int grib_nearest_find(grib_nearest* nearest, const grib_handle* h, double inlat, double inlon, unsigned long flags, double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len);
|
||||
int grib_nearest_init(grib_nearest* i, grib_handle* h, grib_arguments* args);
|
||||
int grib_nearest_delete(grib_nearest* i);
|
||||
int grib_nearest_get_radius(grib_handle* h, double* radiusInKm);
|
||||
void grib_binary_search(double xx[], const unsigned long n, double x, int* ju, int* jl);
|
||||
int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, const double* inlats, const double* inlons, long npoints, double* outlats, double* outlons, double* values, double* distances, int* indexes);
|
||||
int grib_nearest_find_generic(grib_nearest* nearest, grib_handle* h, double inlat, double inlon, unsigned long flags,
|
||||
const char* values_keyname, const char* radius_keyname,
|
||||
const char* Ni_keyname, const char* Nj_keyname,
|
||||
const char* values_keyname, const char* Ni_keyname, const char* Nj_keyname,
|
||||
double** out_lats,
|
||||
int* out_lats_count,
|
||||
double** out_lons,
|
||||
|
|
|
@ -176,14 +176,13 @@ int grib_encode_signed_longb(unsigned char* p, long val, long* bitp, long nb)
|
|||
|
||||
Assert(nb <= max_nbits);
|
||||
|
||||
if (sign)
|
||||
if (sign) {
|
||||
val = -val;
|
||||
|
||||
if (sign)
|
||||
grib_set_bit_on(p, bitp);
|
||||
else
|
||||
}
|
||||
else {
|
||||
grib_set_bit_off(p, bitp);
|
||||
|
||||
}
|
||||
return grib_encode_unsigned_longb(p, val, bitp, nb - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ int grib_encode_string(unsigned char* bitStream, long* bitOffset, size_t numberO
|
|||
int remainder = *bitOffset % 8;
|
||||
unsigned char c;
|
||||
unsigned char* p;
|
||||
unsigned char mask[] = { 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
|
||||
const unsigned char mask[] = { 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
|
||||
int remainderComplement = 8 - remainder;
|
||||
char str[512] = {0,};
|
||||
char* s = str;
|
||||
|
@ -139,7 +139,7 @@ char* grib_decode_string(const unsigned char* bitStream, long* bitOffset, size_t
|
|||
unsigned char c;
|
||||
unsigned char* p;
|
||||
char* s = string;
|
||||
unsigned char mask[] = { 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
|
||||
const unsigned char mask[] = { 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
|
||||
int remainderComplement = 8 - remainder;
|
||||
|
||||
if (numberOfCharacters == 0)
|
||||
|
|
|
@ -90,7 +90,7 @@ char* grib_decode_string(const unsigned char* bitStream, long* bitOffset, size_t
|
|||
unsigned char c;
|
||||
unsigned char* p;
|
||||
char* s = string;
|
||||
unsigned char mask[] = { 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
|
||||
const unsigned char mask[] = { 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
|
||||
int remainderComplement = 8 - remainder;
|
||||
|
||||
if (numberOfCharacters == 0)
|
||||
|
|
|
@ -17,7 +17,7 @@ int grib_decode_long_array(const unsigned char* p, long* bitp, long nbits, size_
|
|||
{
|
||||
long i = 0;
|
||||
long countOfLeftmostBits = 0, leftmostBits = 0;
|
||||
long startBit, startByte;
|
||||
long startBit;
|
||||
long remainingBits = nbits;
|
||||
long* pp = (long*)p;
|
||||
int inited = 0;
|
||||
|
@ -84,7 +84,7 @@ int grib_decode_double_array(const unsigned char* p, long* bitp, long nbits, dou
|
|||
{
|
||||
long i = 0;
|
||||
long countOfLeftmostBits = 0, leftmostBits = 0;
|
||||
long startBit, startByte;
|
||||
long startBit;
|
||||
long remainingBits = nbits;
|
||||
long* pp = (long*)p;
|
||||
int inited = 0;
|
||||
|
|
|
@ -638,7 +638,7 @@ static grib_order_by* grib_db_new_order_by(grib_context* c, char* obstr)
|
|||
p++;
|
||||
mode = mode_default;
|
||||
if (p != t2) {
|
||||
while (*p == ' ' && *p != '\0')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
if (*p != '\0') {
|
||||
*(p - 1) = '\0';
|
||||
|
@ -906,7 +906,7 @@ static void grib_db_delete_fields(grib_fieldset* set)
|
|||
static void grib_trim(char** x)
|
||||
{
|
||||
char* p = 0;
|
||||
while (**x == ' ' && **x != '\0')
|
||||
while (**x == ' ')
|
||||
(*x)++;
|
||||
if (**x == '\0')
|
||||
return;
|
||||
|
|
|
@ -44,9 +44,9 @@ static grib_handle* handle_of(grib_accessor* observed)
|
|||
|
||||
void grib_dependency_add(grib_accessor* observer, grib_accessor* observed)
|
||||
{
|
||||
grib_handle* h = handle_of(observed);
|
||||
grib_dependency* d = h->dependencies;
|
||||
grib_dependency* last = 0;
|
||||
grib_handle* h = NULL;
|
||||
grib_dependency* d = NULL;
|
||||
grib_dependency* last = NULL;
|
||||
|
||||
/*printf("grib_dependency_add: observe %p %p observed=%s observer=%s\n",
|
||||
(void*)observed, (void*)observer,
|
||||
|
@ -56,6 +56,8 @@ void grib_dependency_add(grib_accessor* observer, grib_accessor* observed)
|
|||
if (!observer || !observed) {
|
||||
return;
|
||||
}
|
||||
h = handle_of(observed);
|
||||
d = h->dependencies;
|
||||
|
||||
/* Assert(h == handle_of(observer)); */
|
||||
|
||||
|
@ -164,12 +166,15 @@ int _grib_dependency_notify_change(grib_handle* h, grib_accessor* observed)
|
|||
|
||||
void grib_dependency_remove_observer(grib_accessor* observer)
|
||||
{
|
||||
grib_handle* h = handle_of(observer);
|
||||
grib_dependency* d = h->dependencies;
|
||||
grib_handle* h = NULL;
|
||||
grib_dependency* d = NULL;
|
||||
|
||||
if (!observer)
|
||||
return;
|
||||
|
||||
h = handle_of(observer);
|
||||
d = h->dependencies;
|
||||
|
||||
while (d) {
|
||||
if (d->observer == observer) {
|
||||
d->observer = 0;
|
||||
|
|
|
@ -109,14 +109,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
|
|
@ -108,14 +108,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
|
|
@ -109,14 +109,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
|
|
@ -109,14 +109,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
|
|
@ -109,14 +109,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
|
|
@ -110,14 +110,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
|
|
@ -109,14 +109,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
@ -704,15 +696,13 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
|
|||
fprintf(self->dumper.out, " \"%s\" /)\n", values[size - 1]);
|
||||
|
||||
if (self->isLeaf == 0) {
|
||||
char* prefix;
|
||||
int dofree = 0;
|
||||
|
||||
if ((r = compute_bufr_key_rank(h, self->keys, a->name)) != 0)
|
||||
fprintf(self->dumper.out, " call codes_set_string_array(ibufr,'#%d#%s',svalues)\n", r, a->name);
|
||||
else
|
||||
fprintf(self->dumper.out, " call codes_set_string_array(ibufr,'%s',svalues)\n", a->name);
|
||||
}
|
||||
|
||||
if (self->isLeaf == 0) {
|
||||
char* prefix;
|
||||
int dofree = 0;
|
||||
|
||||
if (r != 0) {
|
||||
prefix = (char*)grib_context_malloc_clear(c, sizeof(char) * (strlen(a->name) + 10));
|
||||
|
|
|
@ -109,14 +109,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static int depth = 0;
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
@ -648,15 +640,13 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
|
|||
fprintf(self->dumper.out, " \"%s\", )\n", values[i]);
|
||||
|
||||
if (self->isLeaf == 0) {
|
||||
char* prefix;
|
||||
int dofree = 0;
|
||||
|
||||
if ((r = compute_bufr_key_rank(h, self->keys, a->name)) != 0)
|
||||
fprintf(self->dumper.out, " codes_set_array(ibufr, '#%d#%s', svalues)\n", r, a->name);
|
||||
else
|
||||
fprintf(self->dumper.out, " codes_set_array(ibufr, '%s', svalues)\n", a->name);
|
||||
}
|
||||
|
||||
if (self->isLeaf == 0) {
|
||||
char* prefix;
|
||||
int dofree = 0;
|
||||
|
||||
if (r != 0) {
|
||||
prefix = (char*)grib_context_malloc_clear(c, sizeof(char) * (strlen(a->name) + 10));
|
||||
|
|
|
@ -108,14 +108,6 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef struct string_count string_count;
|
||||
struct string_count
|
||||
{
|
||||
char* value;
|
||||
int count;
|
||||
string_count* next;
|
||||
};
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
||||
static int init(grib_dumper* d)
|
||||
|
|
|
@ -593,7 +593,7 @@ static grib_order_by* grib_fieldset_new_order_by(grib_context* c, const char* ob
|
|||
p++;
|
||||
mode = mode_default;
|
||||
if (p != t2) {
|
||||
while (*p == ' ' && *p != '\0')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
if (*p != '\0') {
|
||||
*(p - 1) = '\0';
|
||||
|
@ -683,12 +683,12 @@ int grib_fieldset_add(grib_fieldset* set, char* filename)
|
|||
return ret;
|
||||
}
|
||||
offset = 0;
|
||||
ret = grib_get_double(h, "offset", &offset);
|
||||
grib_get_double(h, "offset", &offset);
|
||||
set->fields[set->size] = (grib_field*)grib_context_malloc_clear(c, sizeof(grib_field));
|
||||
set->fields[set->size]->file = file;
|
||||
file->refcount++;
|
||||
set->fields[set->size]->offset = (off_t)offset;
|
||||
ret = grib_get_long(h, "totalLength", &length);
|
||||
grib_get_long(h, "totalLength", &length);
|
||||
set->fields[set->size]->length = length;
|
||||
set->filter->el[set->size] = set->size;
|
||||
set->order->el[set->size] = set->size;
|
||||
|
@ -897,7 +897,7 @@ static void grib_fieldset_delete_fields(grib_fieldset* set)
|
|||
static void grib_trim(char** x)
|
||||
{
|
||||
char* p = 0;
|
||||
while (**x == ' ' && **x != '\0')
|
||||
while (**x == ' ')
|
||||
(*x)++;
|
||||
if (**x == '\0')
|
||||
return;
|
||||
|
|
|
@ -89,7 +89,7 @@ static void init_table_if_needed()
|
|||
GRIB_MUTEX_UNLOCK(&mutex)
|
||||
}
|
||||
|
||||
static void binary_search(double xx[], const unsigned long n, double x, unsigned long* j)
|
||||
static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j)
|
||||
{
|
||||
/*These routine works only on ascending ordered arrays*/
|
||||
unsigned long ju, jm, jl;
|
||||
|
|
|
@ -95,7 +95,7 @@ static void init_table_if_needed()
|
|||
GRIB_MUTEX_UNLOCK(&mutex)
|
||||
}
|
||||
|
||||
static void binary_search(double xx[], const unsigned long n, double x, unsigned long* j)
|
||||
static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j)
|
||||
{
|
||||
/*These routine works only on ascending ordered arrays*/
|
||||
unsigned long ju, jm, jl;
|
||||
|
@ -522,8 +522,10 @@ int grib_ieee_encode_array(grib_context* c, double* val, size_t nvals, int bytes
|
|||
unsigned char* buf)
|
||||
{
|
||||
int err = 0, i = 0, j = 0;
|
||||
#if IEEE_LE
|
||||
unsigned char s4[4];
|
||||
unsigned char s8[8];
|
||||
#endif
|
||||
float fval = 0;
|
||||
double* pval = val;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static void init_class(grib_iterator_class* c)
|
|||
}
|
||||
/* END_CLASS_IMP */
|
||||
|
||||
static void binary_search(double xx[], const unsigned long n, double x, unsigned long* j);
|
||||
static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j);
|
||||
|
||||
static int init(grib_iterator* i, grib_handle* h, grib_arguments* args)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void binary_search(double xx[], const unsigned long n, double x, unsigned long* j)
|
||||
static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j)
|
||||
{
|
||||
/*This routine works only on descending ordered arrays*/
|
||||
#define EPSILON 1e-3
|
||||
|
|
|
@ -131,7 +131,7 @@ static void pj_authset(double es, double* APA)
|
|||
APA[1] += t * P11;
|
||||
APA[2] = t * P20;
|
||||
}
|
||||
static double pj_authlat(double beta, double* APA)
|
||||
static double pj_authlat(double beta, const double* APA)
|
||||
{
|
||||
double t = beta + beta;
|
||||
return (beta + APA[0] * sin(t) + APA[1] * sin(t + t) + APA[2] * sin(t + t + t));
|
||||
|
|
|
@ -97,6 +97,37 @@ int grib_nearest_delete(grib_nearest* i)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Get the radius in kilometres for nearest neighbour distance calculations */
|
||||
/* For an ellipsoid, approximate the radius using the average of the semimajor and semiminor axes */
|
||||
int grib_nearest_get_radius(grib_handle* h, double* radiusInKm)
|
||||
{
|
||||
int err = 0;
|
||||
long lRadiusInMetres;
|
||||
double result = 0;
|
||||
const char* s_radius = "radius";
|
||||
const char* s_minor = "earthMinorAxisInMetres";
|
||||
const char* s_major = "earthMajorAxisInMetres";
|
||||
|
||||
if ((err = grib_get_long(h, s_radius, &lRadiusInMetres)) == GRIB_SUCCESS) {
|
||||
if (grib_is_missing(h, s_radius, &err) || lRadiusInMetres == GRIB_MISSING_LONG) {
|
||||
grib_context_log(h->context, GRIB_LOG_DEBUG, "Key 'radius' is missing");
|
||||
return GRIB_GEOCALCULUS_PROBLEM;
|
||||
}
|
||||
result = ((double)lRadiusInMetres) / 1000.0;
|
||||
}
|
||||
else {
|
||||
double minor = 0, major = 0;
|
||||
if ((err = grib_get_double_internal(h, s_minor, &minor)) != GRIB_SUCCESS) return err;
|
||||
if ((err = grib_get_double_internal(h, s_major, &major)) != GRIB_SUCCESS) return err;
|
||||
if (grib_is_missing(h, s_minor, &err)) return GRIB_GEOCALCULUS_PROBLEM;
|
||||
if (grib_is_missing(h, s_major, &err)) return GRIB_GEOCALCULUS_PROBLEM;
|
||||
result = (major + minor) / 2.0;
|
||||
result = result / 1000.0;
|
||||
}
|
||||
*radiusInKm = result;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
void grib_binary_search(double xx[], const unsigned long n, double x,
|
||||
int* ju, int* jl)
|
||||
{
|
||||
|
@ -264,7 +295,6 @@ int grib_nearest_find_generic(
|
|||
double inlat, double inlon, unsigned long flags,
|
||||
|
||||
const char* values_keyname,
|
||||
const char* radius_keyname,
|
||||
const char* Ni_keyname,
|
||||
const char* Nj_keyname,
|
||||
double** out_lats,
|
||||
|
@ -278,7 +308,7 @@ int grib_nearest_find_generic(
|
|||
{
|
||||
int ret = 0, i = 0;
|
||||
size_t nvalues = 0, nneighbours = 0;
|
||||
double radiusInMetres, radiusInKm;
|
||||
double radiusInKm;
|
||||
grib_iterator* iter = NULL;
|
||||
double lat = 0, lon = 0;
|
||||
|
||||
|
@ -291,21 +321,8 @@ int grib_nearest_find_generic(
|
|||
return ret;
|
||||
nearest->values_count = nvalues;
|
||||
|
||||
/* We need the radius to calculate the nearest distance. For an oblate earth
|
||||
approximate this using the average of the semimajor and semiminor axes */
|
||||
if ((ret = grib_get_double(h, radius_keyname, &radiusInMetres)) == GRIB_SUCCESS &&
|
||||
!grib_is_missing(h, radius_keyname, &ret)) {
|
||||
radiusInKm = radiusInMetres / 1000.0;
|
||||
}
|
||||
else {
|
||||
double minor = 0, major = 0;
|
||||
if ((ret = grib_get_double_internal(h, "earthMinorAxisInMetres", &minor)) != GRIB_SUCCESS) return ret;
|
||||
if ((ret = grib_get_double_internal(h, "earthMajorAxisInMetres", &major)) != GRIB_SUCCESS) return ret;
|
||||
if (grib_is_missing(h, "earthMinorAxisInMetres", &ret)) return GRIB_GEOCALCULUS_PROBLEM;
|
||||
if (grib_is_missing(h, "earthMajorAxisInMetres", &ret)) return GRIB_GEOCALCULUS_PROBLEM;
|
||||
radiusInMetres = (major + minor) / 2;
|
||||
radiusInKm = radiusInMetres / 1000.0;
|
||||
}
|
||||
if ((ret = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
neighbours = (PointStore*)grib_context_malloc(nearest->context, nvalues * sizeof(PointStore));
|
||||
for (i = 0; i < nvalues; ++i) {
|
||||
|
|
|
@ -110,7 +110,6 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
nearest, h, inlat, inlon, flags, /* inputs */
|
||||
|
||||
self->values_key, /* outputs to set the 'self' object */
|
||||
self->radius,
|
||||
self->Ni,
|
||||
self->Nj,
|
||||
&(self->lats),
|
||||
|
|
|
@ -110,7 +110,6 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
nearest, h, inlat, inlon, flags, /* inputs */
|
||||
|
||||
self->values_key, /* outputs to set the 'self' object */
|
||||
self->radius,
|
||||
self->Ni,
|
||||
self->Nj,
|
||||
&(self->lats),
|
||||
|
|
|
@ -119,22 +119,15 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
size_t nvalues = 0;
|
||||
grib_iterator* iter = NULL;
|
||||
double lat = 0, lon = 0;
|
||||
long iradius;
|
||||
double radius;
|
||||
double radiusInKm;
|
||||
int ilat = 0, ilon = 0;
|
||||
|
||||
if ((ret = grib_get_size(h, self->values_key, &nvalues)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
nearest->values_count = nvalues;
|
||||
|
||||
if (grib_is_missing(h, self->radius, &ret)) {
|
||||
grib_context_log(h->context, GRIB_LOG_DEBUG, "Key '%s' is missing", self->radius);
|
||||
return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
|
||||
}
|
||||
|
||||
if ((ret = grib_get_long(h, self->radius, &iradius)) != GRIB_SUCCESS)
|
||||
if ((ret = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS)
|
||||
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
|
||||
|
@ -352,7 +345,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
kk = 0;
|
||||
for (jj = 0; jj < 2; jj++) {
|
||||
for (ii = 0; ii < 2; ii++) {
|
||||
self->distances[kk] = geographic_distance_spherical(radius, inlon, inlat,
|
||||
self->distances[kk] = geographic_distance_spherical(radiusInKm, inlon, inlat,
|
||||
self->lons[self->k[kk]], self->lats[self->j[jj]]);
|
||||
kk++;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,6 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
nearest, h, inlat, inlon, flags, /* inputs */
|
||||
|
||||
self->values_key, /* outputs to set the 'self' object */
|
||||
self->radius,
|
||||
self->Ni,
|
||||
self->Nj,
|
||||
&(self->lats),
|
||||
|
|
|
@ -110,7 +110,6 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
nearest, h, inlat, inlon, flags, /* inputs */
|
||||
|
||||
self->values_key, /* outputs to set the 'self' object */
|
||||
self->radius,
|
||||
self->Ni,
|
||||
self->Nj,
|
||||
&(self->lats),
|
||||
|
|
|
@ -148,8 +148,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
size_t nvalues = 0;
|
||||
grib_iterator* iter = NULL;
|
||||
double lat = 0, lon = 0;
|
||||
long iradius;
|
||||
double radius;
|
||||
double radiusInKm;
|
||||
int ilat = 0, ilon = 0;
|
||||
get_reduced_row_proc get_reduced_row_func = &grib_get_reduced_row;
|
||||
|
||||
|
@ -164,14 +163,8 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
return ret;
|
||||
nearest->values_count = nvalues;
|
||||
|
||||
if (grib_is_missing(h, self->radius, &ret)) {
|
||||
grib_context_log(h->context, GRIB_LOG_DEBUG, "Key '%s' is missing", self->radius);
|
||||
return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
|
||||
}
|
||||
|
||||
if ((ret = grib_get_long(h, self->radius, &iradius)) != GRIB_SUCCESS)
|
||||
if ((ret = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS)
|
||||
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
|
||||
|
@ -421,7 +414,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
kk = 0;
|
||||
for (jj = 0; jj < 2; jj++) {
|
||||
for (ii = 0; ii < 2; ii++) {
|
||||
self->distances[kk] = geographic_distance_spherical(radius, inlon, inlat,
|
||||
self->distances[kk] = geographic_distance_spherical(radiusInKm, inlon, inlat,
|
||||
self->lons[self->k[kk]], self->lats[self->j[jj]]);
|
||||
kk++;
|
||||
}
|
||||
|
|
|
@ -108,13 +108,10 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
grib_nearest_regular* self = (grib_nearest_regular*) nearest;
|
||||
int ret=0,kk=0,ii=0,jj=0;
|
||||
size_t nvalues=0;
|
||||
double radiusInKm;
|
||||
|
||||
long iradius;
|
||||
double radius;
|
||||
|
||||
if( (ret = grib_get_long(h,self->radius,&iradius))!= GRIB_SUCCESS)
|
||||
if ((ret = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
radius=((double)iradius)/1000.0;
|
||||
|
||||
if (!nearest->h || (flags & GRIB_NEAREST_SAME_DATA)==0 || nearest->h!=h) {
|
||||
grib_iterator* iter=NULL;
|
||||
|
@ -231,8 +228,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
grib_nearest_regular* self = (grib_nearest_regular*)nearest;
|
||||
int ret = 0, kk = 0, ii = 0, jj = 0;
|
||||
size_t nvalues = 0;
|
||||
long iradius;
|
||||
double radius; /* radius in km */
|
||||
double radiusInKm;
|
||||
|
||||
grib_iterator* iter = NULL;
|
||||
double lat = 0, lon = 0;
|
||||
|
@ -248,24 +244,8 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
return ret;
|
||||
nearest->values_count = nvalues;
|
||||
|
||||
/* We need the radius to calculate the nearest distance. For an oblate earth
|
||||
approximate this using the average of the semimajor and semiminor axes */
|
||||
if ((ret = grib_get_long(h, self->radius, &iradius)) == GRIB_SUCCESS) {
|
||||
if (grib_is_missing(h, self->radius, &ret) || iradius == GRIB_MISSING_LONG) {
|
||||
grib_context_log(h->context, GRIB_LOG_DEBUG, "Key '%s' is missing", self->radius);
|
||||
return GRIB_GEOCALCULUS_PROBLEM;
|
||||
}
|
||||
radius = ((double)iradius) / 1000.0;
|
||||
}
|
||||
else {
|
||||
double minor = 0, major = 0;
|
||||
if ((ret = grib_get_double_internal(h, "earthMinorAxisInMetres", &minor)) != GRIB_SUCCESS) return ret;
|
||||
if ((ret = grib_get_double_internal(h, "earthMajorAxisInMetres", &major)) != GRIB_SUCCESS) return ret;
|
||||
if (grib_is_missing(h, "earthMinorAxisInMetres", &ret)) return GRIB_GEOCALCULUS_PROBLEM;
|
||||
if (grib_is_missing(h, "earthMajorAxisInMetres", &ret)) return GRIB_GEOCALCULUS_PROBLEM;
|
||||
radius = (major + minor) / 2.0;
|
||||
radius = radius / 1000.0;
|
||||
}
|
||||
if ((ret = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* 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
|
||||
|
@ -424,7 +404,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
for (jj = 0; jj < 2; jj++) {
|
||||
for (ii = 0; ii < 2; ii++) {
|
||||
self->k[kk] = self->i[ii] + self->lons_count * self->j[jj];
|
||||
self->distances[kk] = geographic_distance_spherical(radius, inlon, inlat,
|
||||
self->distances[kk] = geographic_distance_spherical(radiusInKm, inlon, inlat,
|
||||
self->lons[self->i[ii]], self->lats[self->j[jj]]);
|
||||
kk++;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
nearest, h, inlat, inlon, flags, /* inputs */
|
||||
|
||||
self->values_key, /* outputs to set the 'self' object */
|
||||
self->radius,
|
||||
self->Ni,
|
||||
self->Nj,
|
||||
&(self->lats),
|
||||
|
|
|
@ -54,10 +54,35 @@ diff $tempRef $temp
|
|||
# ECC-1295: regular lat/lon on ellipsoid
|
||||
# ----------------------------------------
|
||||
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_set -s shapeOfTheEarth=2 $sample2 $temp
|
||||
grib_check_key_equals $sample2 earthIsOblate 0
|
||||
grib_check_key_equals $temp earthIsOblate 1
|
||||
${tools_dir}/grib_ls -l 0,0 $temp
|
||||
|
||||
# reduced lat/lon on ellipsoid
|
||||
# ----------------------------------------
|
||||
sample2=$ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib2.tmpl
|
||||
${tools_dir}/grib_set -s shapeOfTheEarth=4 $sample2 $temp
|
||||
grib_check_key_equals $sample2 earthIsOblate 0
|
||||
grib_check_key_equals $temp earthIsOblate 1
|
||||
${tools_dir}/grib_ls -l 0,0 $temp
|
||||
|
||||
# regular gaussian on ellipsoid
|
||||
# ----------------------------------------
|
||||
sample2=$ECCODES_SAMPLES_PATH/regular_gg_pl_grib2.tmpl
|
||||
${tools_dir}/grib_set -s shapeOfTheEarth=5 $sample2 $temp
|
||||
grib_check_key_equals $sample2 earthIsOblate 0
|
||||
grib_check_key_equals $temp earthIsOblate 1
|
||||
${tools_dir}/grib_ls -l 0,0 $temp
|
||||
|
||||
# reduced gaussian on ellipsoid
|
||||
# ----------------------------------------
|
||||
sample2=$ECCODES_SAMPLES_PATH/reduced_gg_pl_48_grib2.tmpl
|
||||
${tools_dir}/grib_set -s shapeOfTheEarth=5 $sample2 $temp
|
||||
grib_check_key_equals $sample2 earthIsOblate 0
|
||||
grib_check_key_equals $temp earthIsOblate 1
|
||||
${tools_dir}/grib_ls -l 0,0 $temp
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $temp $tempRef
|
||||
|
|
|
@ -59,7 +59,7 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef double (*compare_double_proc)(double*, double*, double*);
|
||||
typedef double (*compare_double_proc)(const double*, const double*, const double*);
|
||||
|
||||
typedef struct grib_error grib_error;
|
||||
struct grib_error
|
||||
|
@ -136,7 +136,7 @@ static void release_keys_list()
|
|||
}
|
||||
}
|
||||
|
||||
GRIB_INLINE static double compare_double_absolute(double* a, double* b, double* err)
|
||||
GRIB_INLINE static double compare_double_absolute(const double* a, const double* b, const double* err)
|
||||
{
|
||||
double ret = 0;
|
||||
double d = fabs(*a - *b);
|
||||
|
@ -183,7 +183,7 @@ static void write_messages(grib_handle* handle1, grib_handle* handle2)
|
|||
write_message(handle2, "error2");
|
||||
}
|
||||
|
||||
static double compare_double_relative(double* a, double* b, double* err)
|
||||
static double compare_double_relative(const double* a, const double* b, const double* err)
|
||||
{
|
||||
double relativeError;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ const char* tool_description =
|
|||
const char* tool_name = "grib_compare";
|
||||
const char* tool_usage = "[options] grib_file1 grib_file2";
|
||||
|
||||
typedef double (*compare_double_proc)(double*, double*, double);
|
||||
typedef double (*compare_double_proc)(const double*, const double*, double);
|
||||
static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_options* options);
|
||||
|
||||
typedef struct grib_error grib_error;
|
||||
|
@ -124,7 +124,7 @@ GRIB_INLINE static int grib_inline_rstrcmp(const char* a, const char* b)
|
|||
}
|
||||
|
||||
/* Returns 0 when the values are considered the same */
|
||||
static double compare_double_absolute(double* a, double* b, double tolerance)
|
||||
static double compare_double_absolute(const double* a, const double* b, double tolerance)
|
||||
{
|
||||
double ret = 0;
|
||||
double d = fabs(*a - *b);
|
||||
|
@ -136,7 +136,7 @@ static double compare_double_absolute(double* a, double* b, double tolerance)
|
|||
}
|
||||
|
||||
/* Returns 0 when the values are considered the same */
|
||||
static double compare_double_relative(double* a, double* b, double tolerance)
|
||||
static double compare_double_relative(const double* a, const double* b, double tolerance)
|
||||
{
|
||||
double relativeError;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
|||
return (*a == 0 && *b == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
typedef double (*compare_double_proc)(double*, double*, double*);
|
||||
typedef double (*compare_double_proc)(const double*, const double*, const double*);
|
||||
|
||||
typedef struct grib_error grib_error;
|
||||
struct grib_error
|
||||
|
@ -97,7 +97,7 @@ static int start = -1;
|
|||
static int end = -1;
|
||||
static int write_count = 0;
|
||||
|
||||
GRIB_INLINE static double compare_double_absolute(double* a, double* b, double* err)
|
||||
GRIB_INLINE static double compare_double_absolute(const double* a, const double* b, const double* err)
|
||||
{
|
||||
double ret = 0;
|
||||
double d = fabs(*a - *b);
|
||||
|
@ -144,7 +144,7 @@ static void write_messages(grib_handle* h1, grib_handle* h2)
|
|||
write_message(h2, "error2");
|
||||
}
|
||||
|
||||
static double compare_double_relative(double* a, double* b, double* err)
|
||||
static double compare_double_relative(const double* a, const double* b, const double* err)
|
||||
{
|
||||
double relativeError;
|
||||
|
||||
|
|
Loading…
Reference in New Issue