From e3fe59be7fff525228867a3acf3613c184b1ac15 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Fri, 3 Feb 2023 12:28:13 +0000 Subject: [PATCH] Add processor to insert CO2 level into NOAH-MP See #30 --- wrf4g/data/wn/bin/icbcprocessor.mptableCO2 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 wrf4g/data/wn/bin/icbcprocessor.mptableCO2 diff --git a/wrf4g/data/wn/bin/icbcprocessor.mptableCO2 b/wrf4g/data/wn/bin/icbcprocessor.mptableCO2 new file mode 100755 index 00000000..10b138e4 --- /dev/null +++ b/wrf4g/data/wn/bin/icbcprocessor.mptableCO2 @@ -0,0 +1,16 @@ +#!/bin/bash +set -e +# Processor to insert CO2 level corresponding to date into NOAH-MP, via the +# MPTABLE.TBL file + +sformateddate=$1 # initial date to process as YYYY-MM-DD_HH:MM:SS (Ex. 1983-08-27_00:00:00) +eformateddate=$2 # end date to process +tblpath=$3 # run directory where CAMtr_volume_mixing_ratio and MPTABLE.TBL are located + +read iyy imm trash <<< `echo $sformateddate | tr '_T:-' ' '` +read fyy fmm trash <<< `echo $eformateddate | tr '_T:-' ' '` + +# Extract CO2 level for current chunk (just the year, no interpolation) +co2ppm=$(awk '$1 == '${iyy}' {print $2}' ${tblpath}/CAMtr_volume_mixing_ratio) +# Replace CO2 level in MPTABLE +sed -i -e 's/ CO2 = .*e-06/ CO2 = '${co2ppm}'e-06/' ${tblpath}/MPTABLE.TBL