diff --git a/Trajectories/Tests/component_60148580.graphml b/Trajectories/Tests/component_60148580.graphml
index a47c6945d48fb3831479ff1fcafcd12f82bf25cf..a7b6d0f3a5b6ab272ef72041b75ea049c2f1b8bf 100644
--- a/Trajectories/Tests/component_60148580.graphml
+++ b/Trajectories/Tests/component_60148580.graphml
@@ -18,6 +18,7 @@
   <key id="key11" for="node" attr.name="name" attr.type="int" />
   <key id="key12" for="node" attr.name="pos_first" attr.type="vector_float" />
   <key id="key13" for="node" attr.name="pos_last" attr.type="vector_float" />
+  <key id="key14" for="graph" attr.name="orientation" attr.type="string" />
 
   <graph id="G" edgedefault="directed" parse.nodeids="canonical" parse.edgeids="canonical" parse.order="nodesfirst">
 
@@ -25,6 +26,7 @@
    <data key="key0">0</data>
    <data key="key2">0</data>
    <data key="key5">3401</data>
+   <data key="key14">Anticyclones</data>
 
    <!-- vertices -->
     <node id="n0">
diff --git a/Trajectories/Tests/example_2.graphml b/Trajectories/Tests/example_2.graphml
index 75e85fb4ad64978407ce2b49c31e1af0e73f182f..b0c809dd7f554483fa4b992893f6097b532b43da 100644
--- a/Trajectories/Tests/example_2.graphml
+++ b/Trajectories/Tests/example_2.graphml
@@ -8,11 +8,13 @@
   <key id="key1" for="edge" attr.name="cost_function" attr.type="float" />
   <key id="key2" for="node" attr.name="name" attr.type="int" />
   <key id="key3" for="node" attr.name="inst_eddies" attr.type="vector_int" />
+  <key id="key4" for="graph" attr.name="orientation" attr.type="string" />
 
   <graph id="G" edgedefault="directed" parse.nodeids="canonical" parse.edgeids="canonical" parse.order="nodesfirst">
 
    <!-- graph properties -->
    <data key="key0">10</data>
+   <data key="key4">Anticyclones</data>
 
    <!-- vertices -->
     <node id="n0">
diff --git a/Trajectories/Tests/segments_cost.graphml b/Trajectories/Tests/segments_cost.graphml
index 1966235dc2e0af9f2c9b4e41e1e728edd827f7ad..8aef13106ea4e7bb21db5b9eff1445c6f54f1248 100644
--- a/Trajectories/Tests/segments_cost.graphml
+++ b/Trajectories/Tests/segments_cost.graphml
@@ -6,6 +6,7 @@
   <!-- property keys -->
   <key id="key0" for="edge" attr.name="cost_function" attr.type="float" />
   <key id="key1" for="graph" attr.name="e_overestim" attr.type="int" />
+  <key id="key2" for="graph" attr.name="orientation" attr.type="string" />
   <key id="key3" for="node" attr.name="inst_eddies" attr.type="vector_int" />
   <key id="key6" for="node" attr.name="name" attr.type="int" />
 
@@ -13,6 +14,7 @@
 
    <!-- graph properties -->
    <data key="key1">10</data>
+   <data key="key2">Anticyclones</data>
 
    <!-- vertices -->
     <node id="n0">
diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py
index b4fec82e48a01223b953a6d42e92e201006470a2..86feaaedcec54a18b2c8c6b90ee6dc780670f1da 100755
--- a/Trajectories/cost_function.py
+++ b/Trajectories/cost_function.py
@@ -121,6 +121,11 @@ t1 = time.perf_counter()
 timings.write(f"loading: {t1 - t0:.0f} s\n")
 t0 = t1
 
+# It is useful to save the orientation to the output graph of this
+# script for further processing of the output graph by other scripts:
+g.graph_properties["orientation"] = g.new_graph_property("string")
+g.graph_properties["orientation"] = args.orientation
+
 pos_first = g.new_vp('vector<double>')
 pos_last = g.new_vp('vector<double>')
 first_av_rad = g.new_vp('float')