From d34523b8b10c4a2bcc23733dab08abd9e6e37d1d Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Wed, 12 May 2021 19:36:22 +0100
Subject: [PATCH] Fixed the output ensemble to have the metadata added later,
 before the merging.

---
 binarycpython/utils/grid.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index f60a1dfe5..345f88fe0 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -887,6 +887,10 @@ class Population:
         self.grid_ensemble_results = combined_output_dict[
             "ensemble_results"
         ]  # Ensemble results are also passed as output from that dictionary
+
+        # Add some metadata
+        self.grid_ensemble_results['population_id'] = self.grid_options["_population_id"]
+
         self.grid_options["_failed_count"] = combined_output_dict["_failed_count"]
         self.grid_options["_failed_prob"] = combined_output_dict["_failed_prob"]
         self.grid_options["_failed_systems_error_codes"] = list(
@@ -1155,9 +1159,6 @@ class Population:
                     ensemble_raw_output
                 )  # Load this into a dict so that we can combine it later
 
-                # 
-                ensemble_json["population_id"] = self.grid_options["_population_id"]
-
             else:
                 # If we do not allow this, automatically we will export this to the data_dir, in some formatted way
                 output_file = os.path.join(
-- 
GitLab