-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add processor to insert CO2 level into NOAH-MP
See #30
- Loading branch information
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |