mirror of https://github.com/ecmwf/eccodes.git
Single precision: codes_get_float implementation
This commit is contained in:
parent
4ba85d6f1b
commit
a268c22dfc
|
@ -337,6 +337,10 @@ int codes_get_double(const grib_handle* h, const char* key, double* value)
|
|||
{
|
||||
return grib_get_double(h, key, value);
|
||||
}
|
||||
int codes_get_float(const grib_handle* h, const char* key, float* value)
|
||||
{
|
||||
return grib_get_float(h, key, value);
|
||||
}
|
||||
|
||||
int codes_get_double_element(const grib_handle* h, const char* key, int i, double* value)
|
||||
{
|
||||
|
|
|
@ -775,6 +775,7 @@ int codes_get_long(const codes_handle* h, const char* key, long* value);
|
|||
* @return 0 if OK, integer value on error
|
||||
*/
|
||||
int codes_get_double(const codes_handle* h, const char* key, double* value);
|
||||
int codes_get_float(const codes_handle* h, const char* key, float* value);
|
||||
|
||||
/**
|
||||
* Get as double the i-th element of the "key" array
|
||||
|
|
|
@ -783,6 +783,7 @@ int grib_get_long(const grib_handle* h, const char* key, long* value);
|
|||
* @return 0 if OK, integer value on error
|
||||
*/
|
||||
int grib_get_double(const grib_handle* h, const char* key, double* value);
|
||||
int grib_get_float(const grib_handle* h, const char* key, float* value);
|
||||
|
||||
/**
|
||||
* Get as double the i-th element of the "key" array
|
||||
|
|
|
@ -1055,6 +1055,29 @@ int grib_get_double(const grib_handle* h, const char* name, double* val)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int grib_get_float(const grib_handle* h, const char* name, float* val)
|
||||
{
|
||||
size_t length = 1;
|
||||
grib_accessor* a = NULL;
|
||||
grib_accessors_list* al = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (name[0] == '/') {
|
||||
al = grib_find_accessors_list(h, name);
|
||||
if (!al)
|
||||
return GRIB_NOT_FOUND;
|
||||
ret = grib_unpack_float(al->accessor, val, &length);
|
||||
grib_context_free(h->context, al);
|
||||
}
|
||||
else {
|
||||
a = grib_find_accessor(h, name);
|
||||
if (!a)
|
||||
return GRIB_NOT_FOUND;
|
||||
ret = grib_unpack_float(a, val, &length);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int grib_get_double_element_internal(grib_handle* h, const char* name, int i, double* val)
|
||||
{
|
||||
int ret = grib_get_double_element(h, name, i, val);
|
||||
|
|
Loading…
Reference in New Issue