mirror of https://github.com/ecmwf/eccodes.git
ECC-1722: API: Allow setting integer key as missing via codes_set_string
This commit is contained in:
parent
ddc1d47a6d
commit
2d128f5b6c
|
@ -59,6 +59,10 @@ int main(int argc, char** argv)
|
|||
CODES_CHECK(codes_set_missing(h, "scaleFactorOfFirstFixedSurface"), 0);
|
||||
CODES_CHECK(codes_set_missing(h, "scaledValueOfFirstFixedSurface"), 0);
|
||||
|
||||
/* Can also set to MISSING via codes_set_string */
|
||||
CODES_CHECK(codes_set_string(h, "scaleFactorOfFirstFixedSurface", "missing", &str_len), 0);
|
||||
CODES_CHECK(codes_set_string(h, "scaledValueOfFirstFixedSurface", "missing", &str_len), 0);
|
||||
|
||||
/* see GRIB-490 */
|
||||
CODES_CHECK(codes_get_long(h, "Ni", &Ni), 0);
|
||||
is_missing = codes_is_missing(h, "Ni", &err);
|
||||
|
|
|
@ -257,10 +257,10 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
{
|
||||
long v = 0; /* The converted value */
|
||||
|
||||
// Requires more work e.g. filter
|
||||
//if (strcmp_nocase(val, "missing")==0) {
|
||||
// return pack_missing(a);
|
||||
//}
|
||||
// ECC-1722
|
||||
if (strcmp_nocase(val, "missing")==0) {
|
||||
return pack_missing(a);
|
||||
}
|
||||
|
||||
if (string_to_long(val, &v, 1) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
|
|
Loading…
Reference in New Issue