Difference between revisions of "Copying CO2 values"

 
Line 12: Line 12:
  
 
First create some shell variables for the names of the source and target files, which are used in the commands below:
 
First create some shell variables for the names of the source and target files, which are used in the commands below:
<syntaxhighlight>
+
<syntaxhighlight lang=bash>
 
SOURCE_JOB=~/umui_jobs/basis_vefgh.vn7.3
 
SOURCE_JOB=~/umui_jobs/basis_vefgh.vn7.3
 
TARGET_JOB=~/umui_jobs/basis_vabcd.vn7.3
 
TARGET_JOB=~/umui_jobs/basis_vabcd.vn7.3
Line 18: Line 18:
  
 
To delete the existing values from the target basis job so that they can be replaced, run the following shell commands (setting <span style="font-family:monospace">TARGET_JOB</span> to the appropriate file):
 
To delete the existing values from the target basis job so that they can be replaced, run the following shell commands (setting <span style="font-family:monospace">TARGET_JOB</span> to the appropriate file):
<syntaxhighlight>
+
<syntaxhighlight lang=bash>
 
for val in CO2NGASL CO2YGASL CO2VGASL; do
 
for val in CO2NGASL CO2YGASL CO2VGASL; do
 
  sed -i $TARGET_JOB -e '/'${val}'=.*[^,]\s*$/d' -e '/'${val}'=.*,\s*$/,/[^,]$/d';
 
  sed -i $TARGET_JOB -e '/'${val}'=.*[^,]\s*$/d' -e '/'${val}'=.*,\s*$/,/[^,]$/d';
Line 25: Line 25:
  
 
Copying the new values from the source to the target file then uses the commands:
 
Copying the new values from the source to the target file then uses the commands:
<syntaxhighlight>
+
<syntaxhighlight lang=bash>
 
for val in CO2NGASL CO2YGASL CO2VGASL; do
 
for val in CO2NGASL CO2YGASL CO2VGASL; do
 
  sed -n $SOURCE_JOB -e '/'${val}'=.*[^,]\s*$/p' -e '/'${val}'=.*,\s*$/,/[^,]$/p' | sed -i $TARGET_JOB -e '/a2312/r /dev/stdin';
 
  sed -n $SOURCE_JOB -e '/'${val}'=.*[^,]\s*$/p' -e '/'${val}'=.*,\s*$/,/[^,]$/p' | sed -i $TARGET_JOB -e '/a2312/r /dev/stdin';

Latest revision as of 23:29, 11 December 2019

The CO2 table is stored in the UMUI variables:

  • CO2NGASL - Count of table rows for C02 linear interpolation
  • CO2YGASL - List of years for C02 linear interpolation
  • CO2VGASL - List of mass mixing ratios for C02 linear interpolation

To copy the values to a new job you'll first need to extract them from the UMUI config. Export both the source and target UMUI jobs to text format by using the `Export` button on each job, which will create two files like '~/umui_jobs/basis_$RUNID.vn7.3'.

We'll now do the following: 1. Delete the existing values from the target basis file 2. Copy the values from the source basis file into the target basis file 3. Load the edited target basis file back into the UMUI

First create some shell variables for the names of the source and target files, which are used in the commands below:

SOURCE_JOB=~/umui_jobs/basis_vefgh.vn7.3
TARGET_JOB=~/umui_jobs/basis_vabcd.vn7.3

To delete the existing values from the target basis job so that they can be replaced, run the following shell commands (setting TARGET_JOB to the appropriate file):

for val in CO2NGASL CO2YGASL CO2VGASL; do
 sed -i $TARGET_JOB -e '/'${val}'=.*[^,]\s*$/d' -e '/'${val}'=.*,\s*$/,/[^,]$/d';
done

Copying the new values from the source to the target file then uses the commands:

for val in CO2NGASL CO2YGASL CO2VGASL; do
 sed -n $SOURCE_JOB -e '/'${val}'=.*[^,]\s*$/p' -e '/'${val}'=.*,\s*$/,/[^,]$/p' | sed -i $TARGET_JOB -e '/a2312/r /dev/stdin';
done

Once the basis file has been modified you can import it back into the UMUI. It's a good idea to do the import in a new copy, so that if there are any issues you still have the original to go back to - e.g. in this example copy 'vabcd' to 'vabce' and do the import in the new job. The 'Import' button is on the main job window, right above 'Export'. Specify your newly modified target basis file, then once it's been imported check that the CO2 values are as expected.