mirror of https://github.com/ecmwf/eccodes.git
Refactoring: move the function grib_producing_large_constant_fields to grib_utils
This commit is contained in:
parent
3cc42eff1e
commit
5ca6092822
|
@ -1444,6 +1444,7 @@ int grib2_select_PDTN(int is_eps, int is_instant, int is_chemical, int is_chemic
|
||||||
size_t sum_of_pl_array(const long* pl, size_t plsize);
|
size_t sum_of_pl_array(const long* pl, size_t plsize);
|
||||||
int grib_is_earth_oblate(grib_handle* h);
|
int grib_is_earth_oblate(grib_handle* h);
|
||||||
int grib_check_data_values_range(grib_handle* h, const double min_val, const double max_val);
|
int grib_check_data_values_range(grib_handle* h, const double min_val, const double max_val);
|
||||||
|
int grib_producing_large_constant_fields(grib_handle* h, int edition);
|
||||||
int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max_val);
|
int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max_val);
|
||||||
|
|
||||||
/* bufr_util.c */
|
/* bufr_util.c */
|
||||||
|
|
|
@ -474,27 +474,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||||
#undef restrict
|
#undef restrict
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Return true(1) if large constant fields are to be created, otherwise false(0) */
|
|
||||||
static int producing_large_constant_fields(grib_handle* h, int edition)
|
|
||||||
{
|
|
||||||
/* First check if the transient key is set */
|
|
||||||
grib_context* c = h->context;
|
|
||||||
long produceLargeConstantFields = 0;
|
|
||||||
if (grib_get_long(h, "produceLargeConstantFields", &produceLargeConstantFields) == GRIB_SUCCESS &&
|
|
||||||
produceLargeConstantFields != 0) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c->gribex_mode_on == 1 && edition == 1) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Finally check the environment variable via the context */
|
|
||||||
return c->large_constant_fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static int producing_large_constant_fields(const grib_context* c, grib_handle* h, int edition)
|
static int grib_producing_large_constant_fields(const grib_context* c, grib_handle* h, int edition)
|
||||||
{
|
{
|
||||||
/* GRIB-802: If override key is set, ignore env. var and produce compressed fields */
|
/* GRIB-802: If override key is set, ignore env. var and produce compressed fields */
|
||||||
if (c->large_constant_fields) { /* This is set by the environment variable */
|
if (c->large_constant_fields) { /* This is set by the environment variable */
|
||||||
|
@ -597,7 +578,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||||
Assert(ref == reference_value);
|
Assert(ref == reference_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
large_constant_fields = producing_large_constant_fields(gh, self->edition);
|
large_constant_fields = grib_producing_large_constant_fields(gh, self->edition);
|
||||||
if (large_constant_fields) {
|
if (large_constant_fields) {
|
||||||
if ((err = grib_set_long_internal(gh, self->binary_scale_factor, 0)) != GRIB_SUCCESS)
|
if ((err = grib_set_long_internal(gh, self->binary_scale_factor, 0)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -2229,6 +2229,26 @@ int grib_check_data_values_range(grib_handle* h, const double min_val, const dou
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return true(1) if large constant fields are to be created, otherwise false(0) */
|
||||||
|
int grib_producing_large_constant_fields(grib_handle* h, int edition)
|
||||||
|
{
|
||||||
|
/* First check if the transient key is set */
|
||||||
|
grib_context* c = h->context;
|
||||||
|
long produceLargeConstantFields = 0;
|
||||||
|
if (grib_get_long(h, "produceLargeConstantFields", &produceLargeConstantFields) == GRIB_SUCCESS &&
|
||||||
|
produceLargeConstantFields != 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->gribex_mode_on == 1 && edition == 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finally check the environment variable via the context */
|
||||||
|
return c->large_constant_fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max_val)
|
int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max_val)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
Loading…
Reference in New Issue