Skip to content

Commit

Permalink
Add processor to insert CO2 level into NOAH-MP
Browse files Browse the repository at this point in the history
See #30
  • Loading branch information
jesusff committed Feb 3, 2023
1 parent e37e5f1 commit e3fe59b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions wrf4g/data/wn/bin/icbcprocessor.mptableCO2
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e3fe59b

Please sign in to comment.