diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5e94a0757f1e4a7d52fe17ff3402717284ebff99..d31f3ae74ad592bb2babc8f0a157c9d502f42dad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -135,6 +135,14 @@ losoto_interpolate:
   allow_failure: true
   script:
     - cwl-runner --no-container steps/LoSoTo.Interpolate.cwl test_jobs/losoto_interpolate.json
+
+losoto_reweight:
+  stage: test_steps
+  allow_failure: true
+  script:
+   - cwl-runner --no-container steps/LoSoTo.Reweight.cwl test_jobs/losoto_reweight.json
+
+
 losoto_residual:
   stage: test_steps
   allow_failure: true
diff --git a/steps/LoSoTo.Reweight.cwl b/steps/LoSoTo.Reweight.cwl
new file mode 100644
index 0000000000000000000000000000000000000000..abe16e2c611af5d5bd82cd9c56e03e9af6b0a486
--- /dev/null
+++ b/steps/LoSoTo.Reweight.cwl
@@ -0,0 +1,81 @@
+#!/usr/bin/env cwl-runner
+
+class: CommandLineTool
+cwlVersion: v1.0
+id: losoto_reweight
+
+$namespaces:
+  lofar: https://git.astron.nl/eosc/ontologies/raw/master/schema/lofar.owl
+doc: |
+  Change the the weight values.
+  Parameters
+
+
+requirements:
+  InlineJavascriptRequirement:
+    expressionLib:
+      - { $include: utils.js}
+  InitialWorkDirRequirement:
+    listing:
+      - entryname: 'parset.config'
+        entry: $(get_losoto_config('REWEIGHT').join('\n'))
+
+      - entryname: $(inputs.input_h5parm.basename)
+        entry: $(inputs.input_h5parm)
+        writable: true
+
+baseCommand: "losoto"
+
+arguments:
+  - $(inputs.input_h5parm.basename)
+  - parset.config
+
+hints:
+  DockerRequirement:
+    dockerPull: lofareosc/lofar-pipeline-ci:latest
+
+inputs:
+  - id: input_h5parm
+    type: File
+    format: lofar:#H5Parm
+  - id: soltab
+    type: string
+    doc: "Solution table"
+  - id: mode
+    default: 'uniform'
+    type:
+      - type: enum
+        symbols:
+          - uniform
+          - window
+          - copy
+    doc: One of 'uniform' (single value), 'window' (sliding window in time), or 'copy' (copy from another table), by default 'uniform'.
+  - id: weightVal
+    type: float?
+    doc: Set weights to this values (0=flagged), by default 1.
+  - id: nmedian
+    type: int?
+    doc: |
+      Median window size in number of timeslots for 'window' mode.
+      If nonzero, a median-smoothed version of the input values is
+      subtracted to detrend them. If 0, no smoothing or subtraction is
+      done, by default 3.
+  - id: nstddev
+    type: int?
+    doc: Standard deviation window size in number of timeslots for 'window' mode, by default 251.
+  - id: soltabImport
+    type: string?
+    doc: Name of a soltab. Copy weights from this soltab (must have same axes shape), by default none.
+  - id: flagBad
+    type: boolean?
+    doc: Re-apply flags to bad values (1 for amp, 0 for other tables), by default False.
+
+
+outputs:
+  - id: output_h5parm
+    type: File
+    format: lofar:#H5Parm
+    outputBinding:
+      glob: $(inputs.input_h5parm.basename)
+$schema:
+  - https://git.astron.nl/eosc/ontologies/raw/master/schema/lofar.owl
diff --git a/steps/utils.js b/steps/utils.js
index 27b21ab866c538d67828e46514205281a1dee5ff..3b3804b579810fc924e3a7dba9dab0513f123e68 100644
--- a/steps/utils.js
+++ b/steps/utils.js
@@ -1,6 +1,7 @@
 function get_losoto_config(step_name) {
     var par = ['soltab = ' + inputs.soltab]
-    if (inputs.ncpu !== null) par.push('ncpu='+inputs.ncpu);
+    if (inputs.ncpu !== null && inputs.ncpu !== undefined) par.push('ncpu='+inputs.ncpu);
+    console.log(inputs, par)
     par.push("[" + step_name + "]")
     par.push('operation=' + step_name)
     for(var field_name in inputs){
diff --git a/test_jobs/losoto_reweight.json b/test_jobs/losoto_reweight.json
new file mode 100644
index 0000000000000000000000000000000000000000..eb5cd88a2898fe8d5f301a7073cc77cc08870fbb
--- /dev/null
+++ b/test_jobs/losoto_reweight.json
@@ -0,0 +1,4 @@
+{
+  "input_h5parm": {"class": "File", "path": "/data/example.h5", "format": "lofar:#H5Parm"},
+  "soltab":  "sol000/phase000"
+}