From f6ec1a6730ea1de947e5400a32aada32d95ee5df Mon Sep 17 00:00:00 2001
From: mancini <mancini@astron.nl>
Date: Fri, 8 Nov 2019 18:54:33 +0100
Subject: [PATCH] Add LoSoTo reset

---
 .gitlab-ci.yml              |  6 +++++
 steps/LoSoTo.Reset.cwl      | 49 +++++++++++++++++++++++++++++++++++++
 test_jobs/losoto_reset.json |  7 ++++++
 3 files changed, 62 insertions(+)
 create mode 100644 steps/LoSoTo.Reset.cwl
 create mode 100644 test_jobs/losoto_reset.json

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 79e85731..345f3cae 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -59,6 +59,12 @@ losoto_norm:
   script:
     - cwl-runner --no-container steps/LoSoTo.Norm.cwl test_jobs/losoto_norm.json
 
+losoto_reset:
+  stage: test_steps
+  allow_failure: true
+  script:
+    - cwl-runner --no-container steps/LoSoTo.Reset.cwl test_jobs/losoto_reset.json
+
 
 parset_selector:
   stage: test_steps
diff --git a/steps/LoSoTo.Reset.cwl b/steps/LoSoTo.Reset.cwl
new file mode 100644
index 00000000..149587c9
--- /dev/null
+++ b/steps/LoSoTo.Reset.cwl
@@ -0,0 +1,49 @@
+#!/usr/bin/env cwl-runner
+
+class: CommandLineTool
+cwlVersion: v1.0
+id: losoto_reset
+
+doc: Subtract/divide two tables or a clock/tec/tec3rd/rm from a phase.
+
+requirements:
+  InlineJavascriptRequirement: {}
+  InitialWorkDirRequirement:
+    listing:
+      - entryname: 'parset.config'
+        entry: |
+          [reset]
+          soltab = $(inputs.soltab)
+          operation = RESET
+          $(inputs.dataVal !== null? 'dataVal=' + inputs.dataVal: '')
+
+      - entryname: $(inputs.input_h5parm.basename)
+        entry: $(inputs.input_h5parm)
+        writable: true
+
+baseCommand: "losoto"
+
+arguments:
+  - $(inputs.input_h5parm.basename)
+  - parset.config
+
+hints:
+  DockerRequirement:
+    dockerPull: lofareosc/prefactor-ci:master
+
+inputs:
+  - id: input_h5parm
+    type: File
+  - id: soltab
+    type: string
+    doc: "Solution table"
+  - id: dataVal
+    type: float?
+    doc: |
+      If given set values to this number, otherwise uses 1 for amplitude and 0
+      for all other soltab types.
+outputs:
+  - id: output_h5parm
+    type: File
+    outputBinding:
+      glob: $(inputs.input_h5parm.basename)
diff --git a/test_jobs/losoto_reset.json b/test_jobs/losoto_reset.json
new file mode 100644
index 00000000..ff1cfa0f
--- /dev/null
+++ b/test_jobs/losoto_reset.json
@@ -0,0 +1,7 @@
+{
+    "input_h5parm": {
+            "class": "File",
+            "path": "/data/example.h5"
+        },
+    "soltab": "sol000/amplitude000"
+}
-- 
GitLab