def test_codes_index_select(key, value): grib_index = eccodes.codes_index_new_from_file(TEST_DATA_B, [key]) eccodes.codes_index_select(grib_index, key, value) grib_handle = eccodes.codes_new_from_index(grib_index) result = eccodes.codes_get(grib_handle, key) assert result == value
def test_codes_get_length(): grib_index = eccodes.codes_index_new_from_file(TEST_DATA_B, [b'paramId']) eccodes.codes_index_select(grib_index, b'paramId', 130) grib_handle = eccodes.codes_new_from_index(grib_index) result = [] result.append(eccodes.codes_get_length(grib_handle, b'numberOfForecastsInEnsemble')) result.append(eccodes.codes_get_length(grib_handle, b'marsParam')) assert result[0] == 1025 assert result[1] == 8