How to use the cfgrib.bindings.codes_set function in cfgrib

To help you get started, we’ve selected a few cfgrib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ecmwf / cfgrib / tests / test_10_bindings.py View on Github external
def test_codes_set():
    message_id = bindings.codes_new_from_samples('regular_ll_sfc_grib2')

    bindings.codes_set(message_id, 'endStep', 2)
    bindings.codes_set(message_id, 'longitudeOfFirstGridPointInDegrees', 1.0)
    bindings.codes_set(message_id, 'gridType', 'regular_ll')

    with pytest.raises(TypeError):
        bindings.codes_set(message_id, 'endStep', [])
github ecmwf / cfgrib / tests / test_10_bindings.py View on Github external
def test_codes_set():
    message_id = bindings.codes_new_from_samples('regular_ll_sfc_grib2')

    bindings.codes_set(message_id, 'endStep', 2)
    bindings.codes_set(message_id, 'longitudeOfFirstGridPointInDegrees', 1.0)
    bindings.codes_set(message_id, 'gridType', 'regular_ll')

    with pytest.raises(TypeError):
        bindings.codes_set(message_id, 'endStep', [])
github ecmwf / cfgrib / tests / test_10_bindings.py View on Github external
def test_codes_set():
    message_id = bindings.codes_new_from_samples('regular_ll_sfc_grib2')

    bindings.codes_set(message_id, 'endStep', 2)
    bindings.codes_set(message_id, 'longitudeOfFirstGridPointInDegrees', 1.0)
    bindings.codes_set(message_id, 'gridType', 'regular_ll')

    with pytest.raises(TypeError):
        bindings.codes_set(message_id, 'endStep', [])
github ecmwf / cfgrib / tests / test_10_bindings.py View on Github external
def test_codes_set():
    message_id = bindings.codes_new_from_samples('regular_ll_sfc_grib2')

    bindings.codes_set(message_id, 'endStep', 2)
    bindings.codes_set(message_id, 'longitudeOfFirstGridPointInDegrees', 1.0)
    bindings.codes_set(message_id, 'gridType', 'regular_ll')

    with pytest.raises(TypeError):
        bindings.codes_set(message_id, 'endStep', [])
github ecmwf / cfgrib / cfgrib / messages.py View on Github external
def message_set(self, item, value):
        # type: (str, T.Any) -> None
        set_array = isinstance(value, T.Sequence) and not isinstance(value, (str, bytes))
        if set_array:
            eccodes.codes_set_array(self.codes_id, item, value)
        else:
            eccodes.codes_set(self.codes_id, item, value)