Skip to content
This repository was archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Move the nan filtering to after index filtering
Browse files Browse the repository at this point in the history
When nans were filtered out before the index list
was applied the index would not match the input data
  • Loading branch information
oyvindeide committed Oct 21, 2019
1 parent 948bad2 commit 88ad44a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/res/enkf/jobs/scaling/job_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def build_schema():
"index": {
MK.Required: False,
MK.LayerTransformation: _to_int_list,
MK.Description: (
"Index list where scaling factor is calculatied, must match the simulated data"
),
MK.Type: types.List,
MK.ElementValidators: (_min_length,),
MK.Content: {
Expand Down
3 changes: 2 additions & 1 deletion python/res/enkf/jobs/scaling/measured_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ class MeasuredData(object):

def __init__(self, ert, events):
self.data = self._get_data(ert, events.keys)
self.remove_nan()
self.filter_on_column_index(events.index)
self.remove_nan()
self.filter_out_outliers(events)


def remove_nan(self):
self.data = self.data.dropna(axis=1)

Expand Down
4 changes: 4 additions & 0 deletions python/tests/res/enkf/jobs/scaling/test_enkf_scaling_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,10 @@ def test_main_entry_point_summary_data_calc():

arguments["CALCULATE_KEYS"].update({"index":[1, 2, 3]})

with pytest.raises(ValueError): # Will give an empty data set
scaling_job.scaling_job(ert, arguments)

arguments["CALCULATE_KEYS"].update({"index": [8, 35, 71]})
scaling_job.scaling_job(ert, arguments)

for index, node in enumerate(obs_vector):
Expand Down

0 comments on commit 88ad44a

Please sign in to comment.