From 458b278053d6210f44e84098e7879727aa2e58ec Mon Sep 17 00:00:00 2001 From: "Yngve S. Kristiansen" Date: Wed, 23 Oct 2024 12:45:29 +0200 Subject: [PATCH] Check for exact, then partial response key match --- src/ert/dark_storage/common.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ert/dark_storage/common.py b/src/ert/dark_storage/common.py index ee00d770aba..2d21aeb5714 100644 --- a/src/ert/dark_storage/common.py +++ b/src/ert/dark_storage/common.py @@ -109,7 +109,14 @@ def data_for_key( key = key[6:] response_key_to_response_type = ensemble.experiment.response_key_to_response_type - response_key = next((k for k in response_key_to_response_type if k in key), None) + + # Check for exact match first. For example if key is "FOPRH" + # it may stop at "FOPR", which would be incorrect + response_key = next((k for k in response_key_to_response_type if k == key), None) + if response_key is None: + response_key = next( + (k for k in response_key_to_response_type if k in key), None + ) if response_key is not None: response_type = response_key_to_response_type[response_key]