ECC-1467: GRIB: Support data values array decoded as floats (Part 06)

This commit is contained in:
Shahram Najm 2022-12-31 14:27:06 +00:00
parent c36ac36a29
commit 6fcef54935
5 changed files with 33 additions and 0 deletions

View File

@ -399,6 +399,7 @@ int codes_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes,
{
return grib_set_bytes(h, key, bytes, length);
}
int codes_set_double_array(grib_handle* h, const char* key, const double* vals, size_t length)
{
return grib_set_double_array(h, key, vals, length);
@ -407,6 +408,15 @@ int codes_set_force_double_array(grib_handle* h, const char* key, const double*
{
return grib_set_force_double_array(h, key, vals, length);
}
int codes_set_float_array(grib_handle* h, const char* key, const float* vals, size_t length)
{
return grib_set_float_array(h, key, vals, length);
}
int codes_set_force_float_array(grib_handle* h, const char* key, const float* vals, size_t length)
{
return grib_set_force_float_array(h, key, vals, length);
}
int codes_set_long_array(grib_handle* h, const char* key, const long* vals, size_t length)
{
return grib_set_long_array(h, key, vals, length);

View File

@ -930,12 +930,14 @@ int codes_set_bytes(codes_handle* h, const char* key, const unsigned char* bytes
* @return 0 if OK, integer value on error
*/
int codes_set_double_array(codes_handle* h, const char* key, const double* vals, size_t length);
int codes_set_float_array(codes_handle* h, const char* key, const float* vals, size_t length);
/**
* Same as codes_set_double_array but allows setting of READ-ONLY keys like codedValues.
* Use with great caution!!
*/
int codes_set_force_double_array(codes_handle* h, const char* key, const double* vals, size_t length);
int codes_set_force_float_array(codes_handle* h, const char* key, const float* vals, size_t length);
/**

View File

@ -1235,6 +1235,9 @@ int grib_set_flag(grib_handle* h, const char* name, unsigned long flag);
int grib_set_double_array_internal(grib_handle* h, const char* name, const double* val, size_t length);
int grib_set_force_double_array(grib_handle* h, const char* name, const double* val, size_t length);
int grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length);
int grib_set_float_array_internal(grib_handle* h, const char* name, const float* val, size_t length);
int grib_set_force_float_array(grib_handle* h, const char* name, const float* val, size_t length);
int grib_set_float_array(grib_handle* h, const char* name, const float* val, size_t length);
int grib_set_long_array_internal(grib_handle* h, const char* name, const long* val, size_t length);
int grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length);
int grib_get_long_internal(grib_handle* h, const char* name, long* val);

View File

@ -945,12 +945,14 @@ int grib_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes,
* @return 0 if OK, integer value on error
*/
int grib_set_double_array(grib_handle* h, const char* key, const double* vals, size_t length);
int grib_set_float_array(grib_handle* h, const char* key, const float* vals, size_t length);
/**
* Same as grib_set_double_array but allows setting of READ-ONLY keys like codedValues.
* Use with great caution!!
*/
int grib_set_force_double_array(grib_handle* h, const char* key, const double* vals, size_t length);
int grib_set_force_float_array(grib_handle* h, const char* key, const float* vals, size_t length);
/**

View File

@ -779,6 +779,10 @@ int grib_set_double_array_internal(grib_handle* h, const char* name, const doubl
/*if (h->context->debug) fprintf(stderr,"ECCODES DEBUG grib_set_double_array_internal key=%s --DONE\n",name);*/
return ret;
}
int grib_set_float_array_internal(grib_handle* h, const char* name, const float* val, size_t length)
{
return GRIB_NOT_IMPLEMENTED;
}
static int __grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length, int check)
{
@ -852,11 +856,23 @@ int grib_set_force_double_array(grib_handle* h, const char* name, const double*
/* Use with great caution!! */
return __grib_set_double_array(h, name, val, length, /*check=*/0);
}
int grib_set_force_float_array(grib_handle* h, const char* name, const float* val, size_t length)
{
/* GRIB-285: Same as grib_set_float_array but allows setting of READ-ONLY keys like codedValues */
/* Use with great caution!! */
//return __grib_set_double_array(h, name, val, length, /*check=*/0);
return GRIB_NOT_IMPLEMENTED;
}
int grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length)
{
return __grib_set_double_array(h, name, val, length, /*check=*/1);
}
int grib_set_float_array(grib_handle* h, const char* name, const float* val, size_t length)
{
//return __grib_set_double_array(h, name, val, length, /*check=*/1);
return GRIB_NOT_IMPLEMENTED;
}
static int _grib_set_long_array_internal(grib_handle* h, grib_accessor* a, const long* val, size_t buffer_len, size_t* encoded_length, int check)
{