ECC-445: Refactoring: put test for key in one place

This commit is contained in:
Shahram Najm 2018-06-21 11:33:01 +01:00
parent c16a93101f
commit 87a34bfd0f
4 changed files with 13 additions and 7 deletions

View File

@ -1462,6 +1462,7 @@ int is_productDefinitionTemplateNumber_Aerosol(long productDefinitionTemplateNum
int is_index_file(const char *filename);
char get_dir_separator_char(void);
char *codes_getenv(const char *name);
int expandedBoundingBox(grib_handle* h);
/* bufr_util.c */
int compute_bufr_key_rank(grib_handle *h, grib_string_list *keys, const char *key);

View File

@ -291,10 +291,7 @@ static void gaussian_reduced_row(
/* --------------------------------------------------------------------------------------------------- */
void grib_get_reduced_row_wrapper(grib_handle* h, long pl, double lon_first, double lon_last, long* npoints, long* ilon_first, long* ilon_last)
{
int err = 0;
long expandedBoundingBox = 0;
err = grib_get_long(h, "expandedBoundingBox", &expandedBoundingBox);
if (!err && expandedBoundingBox == 1) {
if (expandedBoundingBox(h)) {
grib_get_reduced_row2(pl, lon_first, lon_last, npoints, ilon_first, ilon_last);
} else {
grib_get_reduced_row(pl, lon_first, lon_last, npoints, ilon_first, ilon_last);

View File

@ -185,9 +185,7 @@ static int iterate_reduced_gaussian_subarea_wrapper(grib_iterator* iter, grib_ha
double* lats, long* pl, size_t plsize)
{
int err = 0;
long expandedBoundingBox = 0;
err = grib_get_long(h, "expandedBoundingBox", &expandedBoundingBox);
if (!err && expandedBoundingBox == 1) {
if (expandedBoundingBox(h)) {
return iterate_reduced_gaussian_subarea(iter, h, lat_first, lon_first, lat_last, lon_last, lats, pl, plsize, 1);
}

View File

@ -1848,3 +1848,13 @@ char* codes_getenv(const char* name)
}
return result;
}
int expandedBoundingBox(grib_handle* h)
{
long expandedBoundingBox = 0;
int err = grib_get_long(h, "expandedBoundingBox", &expandedBoundingBox);
if (!err && expandedBoundingBox == 1) {
return 1;
}
return 0;
}