diff --git a/src/ert/analysis/_es_update.py b/src/ert/analysis/_es_update.py index 3cbd40f56ed..f8c068972e9 100644 --- a/src/ert/analysis/_es_update.py +++ b/src/ert/analysis/_es_update.py @@ -305,6 +305,7 @@ def _get_obs_and_measure_data( for obs_key, obs_active_list in selected_observations: observation = observations[obs_key] group = observation.attrs["response"] + if obs_active_list: index = observation.coords.to_index()[obs_active_list] sub_selection = { @@ -312,6 +313,7 @@ def _get_obs_and_measure_data( } observation = observation.sel(sub_selection) ds = source_fs.load_responses(group, tuple(iens_active_index)) + try: filtered_ds = observation.merge(ds, join="left") except KeyError as e: diff --git a/src/ert/config/summary_config.py b/src/ert/config/summary_config.py index 9eb89b76dae..681af753a00 100644 --- a/src/ert/config/summary_config.py +++ b/src/ert/config/summary_config.py @@ -43,8 +43,13 @@ def read_from_file(self, run_path: str, iens: int) -> xr.Dataset: f"{last} from: {run_path}/{filename}.UNSMRY" ) + # Internally we need to use strings to represent time because numpy.datetime64[ns] only allows time until 2262 (for now) + # Convert the time_map from datetime.datetime to string + time_map = [datetime.isoformat(t, timespec="microseconds") for t in time_map] + ds = xr.Dataset( {"values": (["name", "time"], data)}, coords={"time": time_map, "name": keys}, ) + return ds.drop_duplicates("time") diff --git a/src/ert/data/_measured_data.py b/src/ert/data/_measured_data.py index d4c1a2c7019..d1d26416ee8 100644 --- a/src/ert/data/_measured_data.py +++ b/src/ert/data/_measured_data.py @@ -115,6 +115,7 @@ def _get_data( raise ResponseError(_msg) except KeyError as e: raise ResponseError(_msg) from e + ds = obs.merge( response, join="left", diff --git a/src/ert/storage/local_ensemble.py b/src/ert/storage/local_ensemble.py index 155e72226e6..a1a4649e071 100644 --- a/src/ert/storage/local_ensemble.py +++ b/src/ert/storage/local_ensemble.py @@ -378,6 +378,7 @@ def load_responses( ds = xr.open_dataset(input_path, engine="scipy") loaded.append(ds) response = xr.combine_nested(loaded, concat_dim="realization") + assert isinstance(response, xr.Dataset) return response @@ -419,7 +420,9 @@ def load_all_summary_data( summary_keys = self.get_summary_keyset() try: - df = self.load_responses("summary", tuple(realizations)).to_dataframe() + df = self.load_responses("summary", tuple(realizations)).to_dataframe( + ["time", "name", "realization"] + ) except (ValueError, KeyError): return pd.DataFrame() diff --git a/src/ert/storage/local_experiment.py b/src/ert/storage/local_experiment.py index c78b6f3fada..82991acb710 100644 --- a/src/ert/storage/local_experiment.py +++ b/src/ert/storage/local_experiment.py @@ -130,11 +130,20 @@ def response_configuration(self) -> Dict[str, ResponseConfig]: @property def observations(self) -> Dict[str, xr.Dataset]: - observations = list(self.mount_point.glob("observations/*")) - return { - observation.name: xr.open_dataset(observation, engine="scipy") - for observation in observations - } + observations = {} + for observation in list(self.mount_point.glob("observations/*")): + ds = xr.open_dataset(observation, engine="scipy") + if "time" in ds.coords: + # Internally we need to use strings to represent time because numpy.datetime64[ns] only allows time until 2262 (for now) + # Convert the time for the observation from numpy.datetime64[ns] (nanosecords) to datetime64[us] (microseconds) then to string + ds.coords["time"] = [ + t + for t in ds.coords["time"] + .values.astype("datetime64[us]") + .astype(str) + ] + observations[observation.name] = ds + return observations class LocalExperimentAccessor(LocalExperimentReader): diff --git a/tests/unit_tests/data/snapshots/test_integration_data/test_all_measured_snapshot/0/snake_oil_measured_output.csv b/tests/unit_tests/data/snapshots/test_integration_data/test_all_measured_snapshot/0/snake_oil_measured_output.csv index b508a4bf1aa..01504e8c2c9 100644 --- a/tests/unit_tests/data/snapshots/test_integration_data/test_all_measured_snapshot/0/snake_oil_measured_output.csv +++ b/tests/unit_tests/data/snapshots/test_integration_data/test_all_measured_snapshot/0/snake_oil_measured_output.csv @@ -1,5 +1,5 @@ ,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,FOPR,WOPR_OP1_108,WOPR_OP1_144,WOPR_OP1_190,WOPR_OP1_36,WOPR_OP1_72,WOPR_OP1_9,WPR_DIFF_1,WPR_DIFF_1,WPR_DIFF_1,WPR_DIFF_1 -key_index,2010-01-10 00:00:00,2010-01-20 00:00:00,2010-01-30 00:00:00,2010-02-09 00:00:00,2010-02-19 00:00:00,2010-03-01 00:00:00,2010-03-11 00:00:00,2010-03-21 00:00:00,2010-03-31 00:00:00,2010-04-10 00:00:00,2010-04-20 00:00:00,2010-04-30 00:00:00,2010-05-10 00:00:00,2010-05-20 00:00:00,2010-05-30 00:00:00,2010-06-09 00:00:00,2010-06-19 00:00:00,2010-06-29 00:00:00,2010-07-09 00:00:00,2010-07-19 00:00:00,2010-07-29 00:00:00,2010-08-08 00:00:00,2010-08-18 00:00:00,2010-08-28 00:00:00,2010-09-07 00:00:00,2010-09-17 00:00:00,2010-09-27 00:00:00,2010-10-07 00:00:00,2010-10-17 00:00:00,2010-10-27 00:00:00,2010-11-06 00:00:00,2010-11-16 00:00:00,2010-11-26 00:00:00,2010-12-06 00:00:00,2010-12-16 00:00:00,2010-12-26 00:00:00,2011-01-05 00:00:00,2011-01-15 00:00:00,2011-01-25 00:00:00,2011-02-04 00:00:00,2011-02-14 00:00:00,2011-02-24 00:00:00,2011-03-06 00:00:00,2011-03-16 00:00:00,2011-03-26 00:00:00,2011-04-05 00:00:00,2011-04-15 00:00:00,2011-04-25 00:00:00,2011-05-05 00:00:00,2011-05-15 00:00:00,2011-05-25 00:00:00,2011-06-04 00:00:00,2011-06-14 00:00:00,2011-06-24 00:00:00,2011-07-04 00:00:00,2011-07-14 00:00:00,2011-07-24 00:00:00,2011-08-03 00:00:00,2011-08-13 00:00:00,2011-08-23 00:00:00,2011-09-02 00:00:00,2011-09-12 00:00:00,2011-09-22 00:00:00,2011-10-02 00:00:00,2011-10-12 00:00:00,2011-10-22 00:00:00,2011-11-01 00:00:00,2011-11-11 00:00:00,2011-11-21 00:00:00,2011-12-01 00:00:00,2011-12-11 00:00:00,2011-12-21 00:00:00,2011-12-31 00:00:00,2012-01-10 00:00:00,2012-01-20 00:00:00,2012-01-30 00:00:00,2012-02-09 00:00:00,2012-02-19 00:00:00,2012-02-29 00:00:00,2012-03-10 00:00:00,2012-03-20 00:00:00,2012-03-30 00:00:00,2012-04-09 00:00:00,2012-04-19 00:00:00,2012-04-29 00:00:00,2012-05-09 00:00:00,2012-05-19 00:00:00,2012-05-29 00:00:00,2012-06-08 00:00:00,2012-06-18 00:00:00,2012-06-28 00:00:00,2012-07-08 00:00:00,2012-07-18 00:00:00,2012-07-28 00:00:00,2012-08-07 00:00:00,2012-08-17 00:00:00,2012-08-27 00:00:00,2012-09-06 00:00:00,2012-09-16 00:00:00,2012-09-26 00:00:00,2012-10-06 00:00:00,2012-10-16 00:00:00,2012-10-26 00:00:00,2012-11-05 00:00:00,2012-11-15 00:00:00,2012-11-25 00:00:00,2012-12-05 00:00:00,2012-12-15 00:00:00,2012-12-25 00:00:00,2013-01-04 00:00:00,2013-01-14 00:00:00,2013-01-24 00:00:00,2013-02-03 00:00:00,2013-02-13 00:00:00,2013-02-23 00:00:00,2013-03-05 00:00:00,2013-03-15 00:00:00,2013-03-25 00:00:00,2013-04-04 00:00:00,2013-04-14 00:00:00,2013-04-24 00:00:00,2013-05-04 00:00:00,2013-05-14 00:00:00,2013-05-24 00:00:00,2013-06-03 00:00:00,2013-06-13 00:00:00,2013-06-23 00:00:00,2013-07-03 00:00:00,2013-07-13 00:00:00,2013-07-23 00:00:00,2013-08-02 00:00:00,2013-08-12 00:00:00,2013-08-22 00:00:00,2013-09-01 00:00:00,2013-09-11 00:00:00,2013-09-21 00:00:00,2013-10-01 00:00:00,2013-10-11 00:00:00,2013-10-21 00:00:00,2013-10-31 00:00:00,2013-11-10 00:00:00,2013-11-20 00:00:00,2013-11-30 00:00:00,2013-12-10 00:00:00,2013-12-20 00:00:00,2013-12-30 00:00:00,2014-01-09 00:00:00,2014-01-19 00:00:00,2014-01-29 00:00:00,2014-02-08 00:00:00,2014-02-18 00:00:00,2014-02-28 00:00:00,2014-03-10 00:00:00,2014-03-20 00:00:00,2014-03-30 00:00:00,2014-04-09 00:00:00,2014-04-19 00:00:00,2014-04-29 00:00:00,2014-05-09 00:00:00,2014-05-19 00:00:00,2014-05-29 00:00:00,2014-06-08 00:00:00,2014-06-18 00:00:00,2014-06-28 00:00:00,2014-07-08 00:00:00,2014-07-18 00:00:00,2014-07-28 00:00:00,2014-08-07 00:00:00,2014-08-17 00:00:00,2014-08-27 00:00:00,2014-09-06 00:00:00,2014-09-16 00:00:00,2014-09-26 00:00:00,2014-10-06 00:00:00,2014-10-16 00:00:00,2014-10-26 00:00:00,2014-11-05 00:00:00,2014-11-15 00:00:00,2014-11-25 00:00:00,2014-12-05 00:00:00,2014-12-15 00:00:00,2014-12-25 00:00:00,2015-01-04 00:00:00,2015-01-14 00:00:00,2015-01-24 00:00:00,2015-02-03 00:00:00,2015-02-13 00:00:00,2015-02-23 00:00:00,2015-03-05 00:00:00,2015-03-15 00:00:00,2015-03-25 00:00:00,2015-04-04 00:00:00,2015-04-14 00:00:00,2015-04-24 00:00:00,2015-05-04 00:00:00,2015-05-14 00:00:00,2015-05-24 00:00:00,2015-06-03 00:00:00,2015-06-13 00:00:00,2015-06-23 00:00:00,2012-12-15 00:00:00,2013-12-10 00:00:00,2015-03-15 00:00:00,2010-12-26 00:00:00,2011-12-21 00:00:00,2010-03-31 00:00:00,400,800,1200,1800 +key_index,2010-01-10T00:00:00.000000,2010-01-20T00:00:00.000000,2010-01-30T00:00:00.000000,2010-02-09T00:00:00.000000,2010-02-19T00:00:00.000000,2010-03-01T00:00:00.000000,2010-03-11T00:00:00.000000,2010-03-21T00:00:00.000000,2010-03-31T00:00:00.000000,2010-04-10T00:00:00.000000,2010-04-20T00:00:00.000000,2010-04-30T00:00:00.000000,2010-05-10T00:00:00.000000,2010-05-20T00:00:00.000000,2010-05-30T00:00:00.000000,2010-06-09T00:00:00.000000,2010-06-19T00:00:00.000000,2010-06-29T00:00:00.000000,2010-07-09T00:00:00.000000,2010-07-19T00:00:00.000000,2010-07-29T00:00:00.000000,2010-08-08T00:00:00.000000,2010-08-18T00:00:00.000000,2010-08-28T00:00:00.000000,2010-09-07T00:00:00.000000,2010-09-17T00:00:00.000000,2010-09-27T00:00:00.000000,2010-10-07T00:00:00.000000,2010-10-17T00:00:00.000000,2010-10-27T00:00:00.000000,2010-11-06T00:00:00.000000,2010-11-16T00:00:00.000000,2010-11-26T00:00:00.000000,2010-12-06T00:00:00.000000,2010-12-16T00:00:00.000000,2010-12-26T00:00:00.000000,2011-01-05T00:00:00.000000,2011-01-15T00:00:00.000000,2011-01-25T00:00:00.000000,2011-02-04T00:00:00.000000,2011-02-14T00:00:00.000000,2011-02-24T00:00:00.000000,2011-03-06T00:00:00.000000,2011-03-16T00:00:00.000000,2011-03-26T00:00:00.000000,2011-04-05T00:00:00.000000,2011-04-15T00:00:00.000000,2011-04-25T00:00:00.000000,2011-05-05T00:00:00.000000,2011-05-15T00:00:00.000000,2011-05-25T00:00:00.000000,2011-06-04T00:00:00.000000,2011-06-14T00:00:00.000000,2011-06-24T00:00:00.000000,2011-07-04T00:00:00.000000,2011-07-14T00:00:00.000000,2011-07-24T00:00:00.000000,2011-08-03T00:00:00.000000,2011-08-13T00:00:00.000000,2011-08-23T00:00:00.000000,2011-09-02T00:00:00.000000,2011-09-12T00:00:00.000000,2011-09-22T00:00:00.000000,2011-10-02T00:00:00.000000,2011-10-12T00:00:00.000000,2011-10-22T00:00:00.000000,2011-11-01T00:00:00.000000,2011-11-11T00:00:00.000000,2011-11-21T00:00:00.000000,2011-12-01T00:00:00.000000,2011-12-11T00:00:00.000000,2011-12-21T00:00:00.000000,2011-12-31T00:00:00.000000,2012-01-10T00:00:00.000000,2012-01-20T00:00:00.000000,2012-01-30T00:00:00.000000,2012-02-09T00:00:00.000000,2012-02-19T00:00:00.000000,2012-02-29T00:00:00.000000,2012-03-10T00:00:00.000000,2012-03-20T00:00:00.000000,2012-03-30T00:00:00.000000,2012-04-09T00:00:00.000000,2012-04-19T00:00:00.000000,2012-04-29T00:00:00.000000,2012-05-09T00:00:00.000000,2012-05-19T00:00:00.000000,2012-05-29T00:00:00.000000,2012-06-08T00:00:00.000000,2012-06-18T00:00:00.000000,2012-06-28T00:00:00.000000,2012-07-08T00:00:00.000000,2012-07-18T00:00:00.000000,2012-07-28T00:00:00.000000,2012-08-07T00:00:00.000000,2012-08-17T00:00:00.000000,2012-08-27T00:00:00.000000,2012-09-06T00:00:00.000000,2012-09-16T00:00:00.000000,2012-09-26T00:00:00.000000,2012-10-06T00:00:00.000000,2012-10-16T00:00:00.000000,2012-10-26T00:00:00.000000,2012-11-05T00:00:00.000000,2012-11-15T00:00:00.000000,2012-11-25T00:00:00.000000,2012-12-05T00:00:00.000000,2012-12-15T00:00:00.000000,2012-12-25T00:00:00.000000,2013-01-04T00:00:00.000000,2013-01-14T00:00:00.000000,2013-01-24T00:00:00.000000,2013-02-03T00:00:00.000000,2013-02-13T00:00:00.000000,2013-02-23T00:00:00.000000,2013-03-05T00:00:00.000000,2013-03-15T00:00:00.000000,2013-03-25T00:00:00.000000,2013-04-04T00:00:00.000000,2013-04-14T00:00:00.000000,2013-04-24T00:00:00.000000,2013-05-04T00:00:00.000000,2013-05-14T00:00:00.000000,2013-05-24T00:00:00.000000,2013-06-03T00:00:00.000000,2013-06-13T00:00:00.000000,2013-06-23T00:00:00.000000,2013-07-03T00:00:00.000000,2013-07-13T00:00:00.000000,2013-07-23T00:00:00.000000,2013-08-02T00:00:00.000000,2013-08-12T00:00:00.000000,2013-08-22T00:00:00.000000,2013-09-01T00:00:00.000000,2013-09-11T00:00:00.000000,2013-09-21T00:00:00.000000,2013-10-01T00:00:00.000000,2013-10-11T00:00:00.000000,2013-10-21T00:00:00.000000,2013-10-31T00:00:00.000000,2013-11-10T00:00:00.000000,2013-11-20T00:00:00.000000,2013-11-30T00:00:00.000000,2013-12-10T00:00:00.000000,2013-12-20T00:00:00.000000,2013-12-30T00:00:00.000000,2014-01-09T00:00:00.000000,2014-01-19T00:00:00.000000,2014-01-29T00:00:00.000000,2014-02-08T00:00:00.000000,2014-02-18T00:00:00.000000,2014-02-28T00:00:00.000000,2014-03-10T00:00:00.000000,2014-03-20T00:00:00.000000,2014-03-30T00:00:00.000000,2014-04-09T00:00:00.000000,2014-04-19T00:00:00.000000,2014-04-29T00:00:00.000000,2014-05-09T00:00:00.000000,2014-05-19T00:00:00.000000,2014-05-29T00:00:00.000000,2014-06-08T00:00:00.000000,2014-06-18T00:00:00.000000,2014-06-28T00:00:00.000000,2014-07-08T00:00:00.000000,2014-07-18T00:00:00.000000,2014-07-28T00:00:00.000000,2014-08-07T00:00:00.000000,2014-08-17T00:00:00.000000,2014-08-27T00:00:00.000000,2014-09-06T00:00:00.000000,2014-09-16T00:00:00.000000,2014-09-26T00:00:00.000000,2014-10-06T00:00:00.000000,2014-10-16T00:00:00.000000,2014-10-26T00:00:00.000000,2014-11-05T00:00:00.000000,2014-11-15T00:00:00.000000,2014-11-25T00:00:00.000000,2014-12-05T00:00:00.000000,2014-12-15T00:00:00.000000,2014-12-25T00:00:00.000000,2015-01-04T00:00:00.000000,2015-01-14T00:00:00.000000,2015-01-24T00:00:00.000000,2015-02-03T00:00:00.000000,2015-02-13T00:00:00.000000,2015-02-23T00:00:00.000000,2015-03-05T00:00:00.000000,2015-03-15T00:00:00.000000,2015-03-25T00:00:00.000000,2015-04-04T00:00:00.000000,2015-04-14T00:00:00.000000,2015-04-24T00:00:00.000000,2015-05-04T00:00:00.000000,2015-05-14T00:00:00.000000,2015-05-24T00:00:00.000000,2015-06-03T00:00:00.000000,2015-06-13T00:00:00.000000,2015-06-23T00:00:00.000000,2012-12-15T00:00:00.000000,2013-12-10T00:00:00.000000,2015-03-15T00:00:00.000000,2010-12-26T00:00:00.000000,2011-12-21T00:00:00.000000,2010-03-31T00:00:00.000000,400,800,1200,1800 data_index,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,107,143,189,35,71,8,400,800,1200,1800 OBS,0.0016968873096629977,0.007549144793301821,0.017537245526909828,0.03158785030245781,0.04960281774401665,0.07146798074245453,0.09703561663627625,0.12614504992961884,0.1586153209209442,0.1942545473575592,0.23281694948673248,0.27404671907424927,0.3176907002925873,0.3634442389011383,0.4109863340854645,0.46002548933029175,0.5102593302726746,0.5614363551139832,0.6133571267127991,0.6655344367027283,0.7178515791893005,0.7704011797904968,0.8226962685585022,0.8746448755264282,0.9261661171913147,0.977008044719696,1.0266836881637573,1.0750459432601929,1.12155020236969,1.1657692193984985,1.207544207572937,1.2470088005065918,1.2835049629211426,1.3167047500610352,1.346083641052246,1.3711466789245605,1.3915883302688599,1.4073505401611328,1.4176363945007324,1.4222338199615479,1.4235652685165405,1.4251763820648193,1.4272525310516357,1.4300298690795898,1.4334416389465332,1.43769371509552,1.4429181814193726,1.4488641023635864,1.4547947645187378,1.4603124856948853,1.465605616569519,1.4704256057739258,1.4741872549057007,1.4752846956253052,1.4738245010375977,1.4694164991378784,1.4611896276474,1.4494869709014893,1.4363856315612793,1.4213961362838745,1.4026654958724976,1.3793243169784546,1.3527154922485352,1.3241467475891113,1.296581506729126,1.270460844039917,1.2434195280075073,1.2160032987594604,1.1891443729400635,1.161468505859375,1.1344152688980103,1.111630916595459,1.0911470651626587,1.071900486946106,1.0527071952819824,1.0326411724090576,1.0128751993179321,0.9945804476737976,0.975469708442688,0.9557305574417114,0.9363316893577576,0.9158328175544739,0.8928252458572388,0.8686985969543457,0.8423308730125427,0.8124594688415527,0.7789327502250671,0.7419267892837524,0.7024903893470764,0.661297619342804,0.6193501949310303,0.5782303810119629,0.5396573543548584,0.5051060914993286,0.47489526867866516,0.4502047300338745,0.43144863843917847,0.4186316132545471,0.410041481256485,0.40574684739112854,0.40424859523773193,0.3991520404815674,0.3887236714363098,0.37419527769088745,0.3551763594150543,0.331745445728302,0.30616295337677,0.28151485323905945,0.26365551352500916,0.24812838435173035,0.23326681554317474,0.21852639317512512,0.20469489693641663,0.19195015728473663,0.17977432906627655,0.16876085102558136,0.15952761471271515,0.15166985988616943,0.14568953216075897,0.14111457765102386,0.13730789721012115,0.13369180262088776,0.1301889419555664,0.12653681635856628,0.12283045053482056,0.11926789581775665,0.11993221193552017,0.12808072566986084,0.1359952986240387,0.1433563381433487,0.14990629255771637,0.1549033373594284,0.15908613801002502,0.16274403035640717,0.16555064916610718,0.1669514924287796,0.16719110310077667,0.1661362498998642,0.16499200463294983,0.16432030498981476,0.165121391415596,0.169014111161232,0.17592155933380127,0.18565155565738678,0.19735679030418396,0.2105773389339447,0.2247595340013504,0.23917199671268463,0.2524295449256897,0.2640857398509979,0.2746853232383728,0.2849123775959015,0.2945040166378021,0.3027935326099396,0.30875587463378906,0.3120051324367523,0.31252342462539673,0.3097202479839325,0.3039141893386841,0.2956465780735016,0.28585320711135864,0.2753968834877014,0.2641619145870209,0.2527305483818054,0.24120257794857025,0.22952820360660553,0.21775572001934052,0.20688839256763458,0.19651590287685394,0.18688032031059265,0.17763660848140717,0.1682787537574768,0.1587630957365036,0.14956273138523102,0.14119677245616913,0.13354657590389252,0.12660714983940125,0.12049901485443115,0.11532926559448242,0.11091870814561844,0.10653064399957657,0.10148541629314423,0.09563612192869186,0.0887933000922203,0.08123061805963516,0.0733993723988533,0.0654938817024231,0.05767139419913292,0.05034296214580536,0.04377567023038864,0.03793442249298096,0.032930485904216766,0.02895224094390869,0.025974156334996223,0.023769771680235863,0.022172002121806145,0.021033743396401405,0.020261472091078758,0.019794177263975143,0.01961757428944111,0.3,0.2,0.015,0.7,0.5,0.1,0.0,0.1,0.2,0.0 STD,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.10266836732625961,0.10750459879636765,0.112155020236969,0.11657692492008209,0.1207544207572937,0.1247008815407753,0.12835049629211426,0.13167047500610352,0.13460837304592133,0.13711467385292053,0.13915883004665375,0.14073505997657776,0.14176364243030548,0.14222338795661926,0.1423565298318863,0.14251764118671417,0.14272525906562805,0.14300298690795898,0.14334416389465332,0.14376936852931976,0.14429181814193726,0.14488641917705536,0.1454794853925705,0.1460312455892563,0.14656056463718414,0.14704255759716034,0.14741872251033783,0.14752846956253052,0.147382453083992,0.1469416469335556,0.14611896872520447,0.14494870603084564,0.14363856613636017,0.14213961362838745,0.140266552567482,0.1379324346780777,0.13527154922485352,0.13241468369960785,0.12965814769268036,0.12704609334468842,0.12434195727109909,0.12160032987594604,0.11891444027423859,0.11614685505628586,0.11344152688980103,0.11116309463977814,0.10911470651626587,0.10719005018472672,0.10527072101831436,0.10326411575078964,0.10128752142190933,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.075,0.035,0.01,0.07,0.05,0.05,0.1,0.2,0.15,0.05 diff --git a/tests/unit_tests/data/test_integration_data.py b/tests/unit_tests/data/test_integration_data.py index 6b940307da8..f0b9f9f7d85 100644 --- a/tests/unit_tests/data/test_integration_data.py +++ b/tests/unit_tests/data/test_integration_data.py @@ -48,9 +48,10 @@ def test_summary_obs(create_measured_data): summary_obs.remove_inactive_observations() assert all(summary_obs.data.columns.get_level_values("data_index").values == [71]) # Only one observation, we check the key_index is what we expect: - assert summary_obs.data.columns.get_level_values("key_index").values[ - 0 - ] == np.datetime64("2011-12-21") + assert ( + summary_obs.data.columns.get_level_values("key_index").values[0] + == "2011-12-21T00:00:00.000000" + ) @pytest.mark.filterwarnings("ignore::ert.config.ConfigWarning") @@ -106,7 +107,8 @@ def test_gen_obs_and_summary(create_measured_data): def test_gen_obs_and_summary_index_range(create_measured_data): - df = create_measured_data(["WPR_DIFF_1", "FOPR"], [[800], [datetime(2010, 4, 20)]]) + t = datetime.isoformat(datetime(2010, 4, 20), timespec="microseconds") + df = create_measured_data(["WPR_DIFF_1", "FOPR"], [[800], [t]]) df.remove_inactive_observations() assert df.data.columns.get_level_values(0).to_list() == [ diff --git a/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_1.csv b/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_1.csv index aee5554b0e1..8bba6869a37 100644 --- a/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_1.csv +++ b/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_1.csv @@ -1,5 +1,5 @@ Realization,Date,"BPR:1,3,8","BPR:5,5,5",FGIP,FGIPH,FGOR,FGORH,FGPR,FGPRH,FGPT,FGPTH,FOIP,FOIPH,FOPR,FOPRH,FOPT,FOPTH,FWCT,FWCTH,FWIP,FWIPH,FWPR,FWPRH,FWPT,FWPTH,WGOR:OP1,WGOR:OP2,WGORH:OP1,WGORH:OP2,WGPR:OP1,WGPR:OP2,WGPRH:OP1,WGPRH:OP2,WOPR:OP1,WOPR:OP2,WOPRH:OP1,WOPRH:OP2,WWCT:OP1,WWCT:OP2,WWCTH:OP1,WWCTH:OP2,WWPR:OP1,WWPR:OP2,WWPRH:OP1,WWPRH:OP2 -0,2010-01-10,0.9996,0.9996,2499.4473,2499.9956,1.0,1.0,0.0557,0.0012,0.5528,0.0044,1999.4462,1999.994,0.056,0.0017,0.5538,0.0059,0.1776,0.0002,2249.4492,2249.9998,0.0551,0.0,0.5507,1e-04,1.0,1.0,1.0,1.0,0.0557,0.0,0.0006,0.0006,0.056,0.0,0.0008,0.0008,0.3552,0.0,1e-04,0.0002,0.0551,0.0,0.0,0.0 -1,2010-01-10,0.9996,0.9996,2499.8467,2499.9956,1.0,1.0,0.0157,0.0012,0.1533,0.0044,1999.8458,1999.994,0.016,0.0017,0.1542,0.0059,0.0657,0.0002,2249.8489,2249.9998,0.0151,0.0,0.1512,1e-04,1.0,1.0,1.0,1.0,0.0,0.0157,0.0006,0.0006,0.0,0.016,0.0008,0.0008,0.0,0.1314,1e-04,0.0002,0.0,0.0151,0.0,0.0 -2,2010-01-10,0.9996,0.9996,2500.0,2499.9956,1.0,1.0,0.0,0.0012,0.0,0.0044,2000.0,1999.994,0.0,0.0017,0.0,0.0059,0.0,0.0002,2250.0,2249.9998,0.0,0.0,0.0,1e-04,1.0,1.0,1.0,1.0,0.0,0.0,0.0006,0.0006,0.0,0.0,0.0008,0.0008,0.0,0.0,1e-04,0.0002,0.0,0.0,0.0,0.0 -3,2010-01-10,0.9996,0.9996,2497.1733,2499.9956,0.9994,1.0,0.2835,0.0012,2.8267,0.0044,1997.1716,1999.994,0.284,0.0017,2.8285,0.0059,0.4825,0.0002,2247.1775,2249.9998,0.2823,0.0,2.8224,1e-04,1.0,0.9987,1.0,1.0,0.0879,0.1956,0.0006,0.0006,0.0882,0.1958,0.0008,0.0008,0.4661,0.4989,1e-04,0.0002,0.0873,0.195,0.0,0.0 +0,2010-01-10T00:00:00.000000,0.9996,0.9996,2499.4473,2499.9956,1.0,1.0,0.0557,0.0012,0.5528,0.0044,1999.4462,1999.994,0.056,0.0017,0.5538,0.0059,0.1776,0.0002,2249.4492,2249.9998,0.0551,0.0,0.5507,1e-04,1.0,1.0,1.0,1.0,0.0557,0.0,0.0006,0.0006,0.056,0.0,0.0008,0.0008,0.3552,0.0,1e-04,0.0002,0.0551,0.0,0.0,0.0 +1,2010-01-10T00:00:00.000000,0.9996,0.9996,2499.8467,2499.9956,1.0,1.0,0.0157,0.0012,0.1533,0.0044,1999.8458,1999.994,0.016,0.0017,0.1542,0.0059,0.0657,0.0002,2249.8489,2249.9998,0.0151,0.0,0.1512,1e-04,1.0,1.0,1.0,1.0,0.0,0.0157,0.0006,0.0006,0.0,0.016,0.0008,0.0008,0.0,0.1314,1e-04,0.0002,0.0,0.0151,0.0,0.0 +2,2010-01-10T00:00:00.000000,0.9996,0.9996,2500.0,2499.9956,1.0,1.0,0.0,0.0012,0.0,0.0044,2000.0,1999.994,0.0,0.0017,0.0,0.0059,0.0,0.0002,2250.0,2249.9998,0.0,0.0,0.0,1e-04,1.0,1.0,1.0,1.0,0.0,0.0,0.0006,0.0006,0.0,0.0,0.0008,0.0008,0.0,0.0,1e-04,0.0002,0.0,0.0,0.0,0.0 +3,2010-01-10T00:00:00.000000,0.9996,0.9996,2497.1733,2499.9956,0.9994,1.0,0.2835,0.0012,2.8267,0.0044,1997.1716,1999.994,0.284,0.0017,2.8285,0.0059,0.4825,0.0002,2247.1775,2249.9998,0.2823,0.0,2.8224,1e-04,1.0,0.9987,1.0,1.0,0.0879,0.1956,0.0006,0.0006,0.0882,0.1958,0.0008,0.0008,0.4661,0.4989,1e-04,0.0002,0.0873,0.195,0.0,0.0 diff --git a/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_2.csv b/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_2.csv index 972fb720302..cd9caf94754 100644 --- a/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_2.csv +++ b/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_2.csv @@ -1,5 +1,5 @@ Realization,Date,WWCT:OP1,WWCT:OP2 -0,2010-01-10,0.35516918,0.0 -1,2010-01-10,0.0,0.1313817 -2,2010-01-10,0.0,0.0 -3,2010-01-10,0.46613,0.49889395 +0,2010-01-10T00:00:00.000000,0.35516918,0.0 +1,2010-01-10T00:00:00.000000,0.0,0.1313817 +2,2010-01-10T00:00:00.000000,0.0,0.0 +3,2010-01-10T00:00:00.000000,0.46613,0.49889395 diff --git a/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_3.csv b/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_3.csv index f6289d47497..f1d63de5bbf 100644 --- a/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_3.csv +++ b/tests/unit_tests/snapshots/test_libres_facade/test_summary_collector/0/summary_collector_3.csv @@ -1,5 +1,5 @@ Realization,Date,WWCT:OP1,WWCT:OP2 -4,2010-01-10,0.19479288,0.0 -4,2010-01-20,0.1951685,0.0 -4,2010-01-30,0.19581304,0.0 -4,2010-02-09,0.19672726,0.0 +4,2010-01-10T00:00:00.000000,0.19479288,0.0 +4,2010-01-20T00:00:00.000000,0.1951685,0.0 +4,2010-01-30T00:00:00.000000,0.19581304,0.0 +4,2010-02-09T00:00:00.000000,0.19672726,0.0 diff --git a/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_head.csv b/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_head.csv index 06558871da3..9e1a9b4872d 100644 --- a/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_head.csv +++ b/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_head.csv @@ -1,8 +1,8 @@ ,FOPR,FOPR,FOPR,FOPR,FOPR Realization,0,1,2,3,4 Date,,,,, -2010-01-10,0.055961154,0.0159828,0.0,0.2839923,0.02509654 -2010-01-20,0.05905991,0.01898478,0.0,0.2900899,0.028275477 -2010-01-30,0.064337626,0.024110613,0.0,0.30051348,0.03370005 -2010-02-09,0.07174286,0.031328063,0.0009306805,0.31520578,0.041331254 -2010-02-19,0.081208415,0.04059234,0.009585856,0.33403203,0.0511149 +2010-01-10T00:00:00.000000,0.055961154,0.0159828,0.0,0.2839923,0.02509654 +2010-01-20T00:00:00.000000,0.05905991,0.01898478,0.0,0.2900899,0.028275477 +2010-01-30T00:00:00.000000,0.064337626,0.024110613,0.0,0.30051348,0.03370005 +2010-02-09T00:00:00.000000,0.07174286,0.031328063,0.0009306805,0.31520578,0.041331254 +2010-02-19T00:00:00.000000,0.081208415,0.04059234,0.009585856,0.33403203,0.0511149 diff --git a/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_tail.csv b/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_tail.csv index 04ecf554393..c1050ad0f82 100644 --- a/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_tail.csv +++ b/tests/unit_tests/snapshots/test_libres_facade/test_summary_data_verify_indices_and_values/0/summary_tail.csv @@ -1,8 +1,8 @@ ,FOPR,FOPR,FOPR,FOPR,FOPR Realization,0,1,2,3,4 Date,,,,, -2015-05-14,0.05978195,0.028228229,0.0,0.2988855,0.03184779 -2015-05-24,0.06022726,0.02732692,0.0,0.2993037,0.032080103 -2015-06-03,0.060678575,0.026679888,0.0,0.29959962,0.032258306 -2015-06-13,0.06101494,0.026284758,0.0,0.2997273,0.03237228 -2015-06-23,0.061153173,0.026137633,0.0,0.29976672,0.032415867 +2015-05-14T00:00:00.000000,0.05978195,0.028228229,0.0,0.2988855,0.03184779 +2015-05-24T00:00:00.000000,0.06022726,0.02732692,0.0,0.2993037,0.032080103 +2015-06-03T00:00:00.000000,0.060678575,0.026679888,0.0,0.29959962,0.032258306 +2015-06-13T00:00:00.000000,0.06101494,0.026284758,0.0,0.2997273,0.03237228 +2015-06-23T00:00:00.000000,0.061153173,0.026137633,0.0,0.29976672,0.032415867 diff --git a/tests/unit_tests/snapshots/test_summary_response/test_load_summary_response_restart_not_zero/summary_restart b/tests/unit_tests/snapshots/test_summary_response/test_load_summary_response_restart_not_zero/summary_restart index 3cfe2809703..00abe1f0987 100644 --- a/tests/unit_tests/snapshots/test_summary_response/test_load_summary_response_restart_not_zero/summary_restart +++ b/tests/unit_tests/snapshots/test_summary_response/test_load_summary_response_restart_not_zero/summary_restart @@ -1,7 +1,7 @@ Realization,Date,FGIP,FGIR,FGIRH,FGIT,FGITH,FGLIR,FGLR,FGOR,FGORH,FGPP,FGPR,FGPRF,FGPRH,FGPRS,FGPT -0,2020-07-02,5737580500.0,0.0,0.0,0.0,0.0,0.0,68.796104,146.78568,146.78568,2777220.0,853880.56,165187.05,853880.56,688693.56,1168540500.0 -0,2020-08-01,5711617500.0,0.0,0.0,0.0,0.0,0.0,68.93971,151.33902,151.33902,2757425.0,866019.94,192419.36,866019.94,673600.56,1194503800.0 -0,2020-09-01,5684979000.0,0.0,0.0,0.0,0.0,0.0,68.258804,154.72658,154.72658,2712226.0,856132.9,208552.92,856132.9,647579.94,1221141900.0 -0,2020-10-01,5659591700.0,0.0,0.0,0.0,0.0,0.0,66.956535,156.4753,156.4753,2654457.8,837970.5,214351.67,837970.5,623618.9,1246529300.0 -0,2020-11-01,5634260500.0,0.0,0.0,0.0,0.0,0.0,64.80198,155.93571,155.93571,2580463.0,809597.94,207660.8,809597.94,601937.1,1271860400.0 -0,2020-12-01,5610946000.0,0.0,0.0,0.0,0.0,0.0,62.265244,153.91632,153.91632,2505382.5,777148.44,193741.4,777148.44,583407.06,1295174900.0 +0,2020-07-02T00:00:00.000000,5737580500.0,0.0,0.0,0.0,0.0,0.0,68.796104,146.78568,146.78568,2777220.0,853880.56,165187.05,853880.56,688693.56,1168540500.0 +0,2020-08-01T00:00:00.000000,5711617500.0,0.0,0.0,0.0,0.0,0.0,68.93971,151.33902,151.33902,2757425.0,866019.94,192419.36,866019.94,673600.56,1194503800.0 +0,2020-09-01T00:00:00.000000,5684979000.0,0.0,0.0,0.0,0.0,0.0,68.258804,154.72658,154.72658,2712226.0,856132.9,208552.92,856132.9,647579.94,1221141900.0 +0,2020-10-01T00:00:00.000000,5659591700.0,0.0,0.0,0.0,0.0,0.0,66.956535,156.4753,156.4753,2654457.8,837970.5,214351.67,837970.5,623618.9,1246529300.0 +0,2020-11-01T00:00:00.000000,5634260500.0,0.0,0.0,0.0,0.0,0.0,64.80198,155.93571,155.93571,2580463.0,809597.94,207660.8,809597.94,601937.1,1271860400.0 +0,2020-12-01T00:00:00.000000,5610946000.0,0.0,0.0,0.0,0.0,0.0,62.265244,153.91632,153.91632,2505382.5,777148.44,193741.4,777148.44,583407.06,1295174900.0 diff --git a/tests/unit_tests/test_load_forward_model.py b/tests/unit_tests/test_load_forward_model.py index d00c99bdbc8..37d85066aa7 100644 --- a/tests/unit_tests/test_load_forward_model.py +++ b/tests/unit_tests/test_load_forward_model.py @@ -7,6 +7,7 @@ import numpy as np import pytest +import xarray as xr from resdata.summary import Summary from ert.config import ErtConfig @@ -111,6 +112,42 @@ def test_load_inconsistent_time_map_summary(caplog): assert loaded == 1 +@pytest.mark.usefixtures("copy_snake_oil_case_storage") +def test_datetime_2500(): + """ + Test that we are able to work with dates past year 2263 in summary files. + + """ + cwd = os.getcwd() + + # Get rid of GEN_DATA as we are only interested in SUMMARY + with fileinput.input("snake_oil.ert", inplace=True) as fin: + for line in fin: + if line.startswith("GEN_DATA"): + continue + print(line, end="") + + facade = LibresFacade.from_config_file("snake_oil.ert") + storage_path = ErtConfig.from_file("snake_oil.ert").ens_path + storage = open_storage(storage_path, mode="w") + ensemble = storage.get_ensemble_by_name("default_0") + + # Create a result that is incompatible with the refcase + run_path = Path("storage") / "snake_oil" / "runpath" / "realization-0" / "iter-0" + os.chdir(run_path) + ecl_sum = run_simulator(100, datetime(2500, 1, 1)) + ecl_sum.fwrite() + os.chdir(cwd) + + realizations = [False] * facade.get_ensemble_size() + realizations[0] = True + facade.load_from_forward_model(ensemble, realizations, 0) + + dataset = ensemble.load_responses("summary", tuple([0])) + assert dataset.coords["time"].data.dtype == np.dtype("object") + assert dataset.coords["time"].values[0] == "2500-01-10T00:00:00.000000" + + @pytest.mark.usefixtures("copy_snake_oil_case_storage") def test_load_forward_model(snake_oil_default_storage): """