Download WRF-GHG
Transcript
Technical Report No. 25: The WRF Greenhouse Gas Model
Here ncks is used to extract just the variable of interest, “Wetlands”, and saves it in
a temporary file called dummy.nc.
ncecat dummy.nc dummy2.nc
The concatenation operator ncecat is used here not to concatenate files but rather to
add a record dimension (which will be renamed to “Time”) to the variable such that it
matches the dimensionality of the wrfinput file.
ncrename -v Wetlands,WETMAP -d ncl0,south_north -d ncl1,west_east \
-d record,Time dummy2.nc
ncrename is used to replace both the variable and all the dimension names in order to
match the wrfinput file.
ncks -A -v WETMAP dummy2.nc $wrfin
rm dummy*
Finally, the WETMAP variable is written into the wrfinput file and all the intermediary working files are removed.
For the VPRM pre-processed fields roughly the same procedure can be followed for
the following variables: VEG FRA, EVI MAX, EVI MIN, LSWI MAX, and LSWI MIN.
However for variables EVI and LSWI it’s a bit more complicated as the day of the year
needs to be taken into account, and a weighted average taken between adjacent values 8
days apart. When using Matlab, this would be carried out by f_vprm_in as described by
item 3 in Sec. 4.3. Here is how it was done using NCO and shell scripting:
fld=( evi lswi )
fld_upper=( EVI LSWI )
This just saves the original variable names (fld) and the target variable names (fld_upper)
as arrays that can be looped over.
for (( m=0; m<= 1; m++ ))
do
file_vprm=${vprmdir}/VPRM_input_${fld_upper[m]}_d0${d}_${year}.nc
doy_string=$(ncks -d start_day_of_year $file_vprm)
start_doy=${doy_string: -30:3}
let "diff=$doy-$start_doy-2"
61