mirror of https://github.com/ecmwf/eccodes.git
Add debug message. Also evaluate grib_handle_of_accessor once
This commit is contained in:
parent
feb0ef47ec
commit
39bd12d0aa
|
@ -185,10 +185,10 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
{
|
||||
grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
|
||||
int ret = 0;
|
||||
|
||||
double grid[6];
|
||||
size_t size = 6;
|
||||
double new_val = *val;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
|
||||
if (*len < 1) {
|
||||
ret = GRIB_ARRAY_TOO_SMALL;
|
||||
|
@ -197,11 +197,11 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
|
||||
if (self->given) {
|
||||
long given = *val != GRIB_MISSING_DOUBLE;
|
||||
if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->given, given)) != GRIB_SUCCESS)
|
||||
if ((ret = grib_set_long_internal(hand, self->given, given)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid, grid, &size)) != GRIB_SUCCESS)
|
||||
if ((ret = grib_get_double_array_internal(hand, self->grid, grid, &size)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* index 1 is longitudeOfFirstGridPointInDegrees
|
||||
|
@ -211,10 +211,13 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
/* WMO regulation for GRIB edition 2:
|
||||
* The longitude values shall be limited to the range 0 to 360 degrees inclusive */
|
||||
new_val = normalise_longitude_in_degrees(*val);
|
||||
if (hand->context->debug && new_val != *val) {
|
||||
fprintf(stderr, "ECCODES DEBUG pack_double g2latlon: normalise longitude %g -> %g\n", *val, new_val);//??
|
||||
}
|
||||
}
|
||||
grid[self->index] = new_val;
|
||||
|
||||
return grib_set_double_array_internal(grib_handle_of_accessor(a), self->grid, grid, size);
|
||||
return grib_set_double_array_internal(hand, self->grid, grid, size);
|
||||
}
|
||||
|
||||
static int pack_missing(grib_accessor* a)
|
||||
|
@ -234,10 +237,8 @@ static int is_missing(grib_accessor* a)
|
|||
grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
|
||||
long given = 1;
|
||||
|
||||
|
||||
if (self->given)
|
||||
grib_get_long_internal(grib_handle_of_accessor(a), self->given, &given);
|
||||
|
||||
|
||||
return !given;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue