mirror of https://github.com/ecmwf/eccodes.git
ECC-1572: Fortran codes_get/grib_get fails to get array of 32-bit real numbers
This commit is contained in:
parent
a42a8547bc
commit
1ef77a8b47
|
@ -16,7 +16,7 @@ program grib_get_pv
|
|||
integer :: infile
|
||||
integer :: igrib
|
||||
integer :: PVPresent, nb_pv
|
||||
real(kind=8), dimension(:), allocatable :: pv
|
||||
real(kind=4), dimension(:), allocatable :: pv
|
||||
|
||||
call codes_open_file(infile, '../../data/reduced_gaussian_model_level.grib1', 'r')
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
rlen = count;
|
||||
|
||||
if (*len < rlen) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%lu) for %s, it contains %lu values", *len, a->name, rlen);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %lu values", *len, a->name, rlen);
|
||||
*len = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
@ -163,6 +163,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
// ECC-1572: TODO(masn) use templates
|
||||
static int unpack_float(grib_accessor* a, float* val, size_t* len)
|
||||
{
|
||||
unsigned long rlen = 0;
|
||||
|
@ -177,7 +178,7 @@ static int unpack_float(grib_accessor* a, float* val, size_t* len)
|
|||
rlen = count;
|
||||
|
||||
if (*len < rlen) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%lu) for %s, it contains %lu values", *len, a->name, rlen);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %lu values", *len, a->name, rlen);
|
||||
*len = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
return err;
|
||||
|
||||
if (*len < (size_t)rlen) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%lu) for %s, it contains %ld values", *len, a->name, rlen);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen);
|
||||
*len = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
@ -206,6 +206,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
// ECC-1572: TODO(masn) use templates
|
||||
static int unpack_float(grib_accessor* a, float* val, size_t* len)
|
||||
{
|
||||
long rlen = 0;
|
||||
|
@ -218,7 +219,7 @@ static int unpack_float(grib_accessor* a, float* val, size_t* len)
|
|||
return err;
|
||||
|
||||
if (*len < (size_t)rlen) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%lu) for %s, it contains %ld values", *len, a->name, rlen);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen);
|
||||
*len = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue