Skip to content

Negative scaledValueOfFirstFixedSurface and SecondFixedSurface fails #512

Description

@ColemanTom

What happened?

eccodes sets scaledValueOf*FixedSurface to be unsigned[4]. See https://github.com/ecmwf/eccodes/blob/develop/definitions/grib2/templates/template.4.horizontal.def#L12 . This is generally fine, but it does not cover all use cases. Potential vorticity levels in the southern hemisphere are negative. If you try to do grib_set -s typeOfFirstFixedSurface=109,scaledValueOfFirstFixedSurface=-2 file, it will fail because the level value is negative.

Could you please allow negative values for the scaledValueOf*FixedSurface metadata items as it is quite reasonable to have negative levels.

What are the steps to reproduce the bug?

grib_set -s typeOfFirstFixedSurface=109,scaledValueOfFirstFixedSurface=-2 file

Version

All

Platform (OS and architecture)

Linux

Relevant log output

$ grib_set -s typeOfFirstFixedSurface=109,scaledValueOfFirstFixedSurface=-2 z.54.grb2 z.54.grb22
ECCODES ERROR   :  Key "scaledValueOfFirstFixedSurface": Trying to encode a negative value of -2 for key of type unsigned
ECCODES ERROR   :  grib_set_values[1] scaledValueOfFirstFixedSurface (type=long) failed: Encoding invalid (message 1)

Accompanying data

No response

Organisation

Bureau of Meteorology

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions