From 3bf2b9ad4aba73e590a685b14bb7a55a98a0e0b9 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Wed, 8 Mar 2023 14:24:11 +0100
Subject: [PATCH] move metadata creation afte index creation

---
 notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb
index ace91cc29..db677fcd6 100644
--- a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb
+++ b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb
@@ -378,6 +378,12 @@
     "        with DataFile(out_file, \"w\") as ofile:\n",
     "            # Create INDEX datasets.\n",
     "            ofile.create_index(dc.train_ids, from_file=dc.files[0])\n",
+    "            # Create METDATA datasets\n",
+    "            ofile.create_metadata(\n",
+    "                like=dc,\n",
+    "                sequence=dc.run_metadata()[\"sequenceNumber\"],\n",
+    "                instrument_channels=(f\"{instrument_src}/data\",)\n",
+    "            )\n",
     "\n",
     "            # Create Instrument section to later add corrected datasets.\n",
     "            outp_source = ofile.create_instrument_source(instrument_src)\n",
@@ -408,12 +414,6 @@
     "            )\n",
     "            outp_source.create_compressed_key(f\"data.mask\", data=mask)\n",
     "\n",
-    "            # Create METDATA datasets\n",
-    "            ofile.create_metadata(\n",
-    "                like=dc,\n",
-    "                sequence=dc.run_metadata()[\"sequenceNumber\"]\n",
-    "            )\n",
-    "\n",
     "        step_timer.done_step(\"Storing data\")"
    ]
   },
-- 
GitLab