Files
GEOS-Chem-adjoint-v35-note/code/objects.sh
2018-08-28 00:46:26 -04:00

158 lines
3.6 KiB
Bash

#!/bin/bash
INPUT_FOLDER=`cat INPUT_FOLDER`
cp Objects.default Objects.mkl
# Note this line gives an error but WORKS correctly
if [ -n $(grep ' => offdiagonal : F' $INPUT_FOLDER/input.gcadj) ]; then
find="geos_chem_adj_mod.o"
replace="covariance_mod.o \
geos_chem_adj_mod.o"
sed -e "s/$find/$replace/g" Objects.mkl > Objects.off-diag
mv Objects.off-diag Objects.mkl
fi
# Note this line gives an error but WORKS correctly
if [ -n $(grep 'Compute BFGS inverse Hessian : F' $INPUT_FOLDER/input.gcadj) ]; then
find="inv_hessian_mod.o"
replace="inv_hessian_mod.o \
inv_hessian_lbfgs_mod.o"
sed -e "s/$find/$replace/g" Objects.mkl > Objects.lbfgs
mv Objects.lbfgs Objects.mkl
fi
if [ $1 = "HDF" ]; then
find="getifsun.o"
replace="getifsun.o \
gvchsq.o "
sed -e "s/$find/$replace/g" Objects.mkl > output1
find="input_mod.o"
replace="input_mod.o \
He4IncludeModule.o \
He4ErrorModule.o \
He4GridModule.o \
He4SwathModule.o \
findinv.o \
airsv5_mod.o \
airs_co_obs_mod.o \
HdfIncludeModule.o \
HdfSdModule.o \
HdfVdModule.o \
mls_o3_obs_mod.o \
mls_hno3_obs_mod.o \
omi_no2_obs_mod.o \
omi_so2_obs_mod.o \
omi_ch2o_obs_mod.o \
osiris_no2_obs_mod.o \
interp.o \
gaussj.o \
iasi_co_obs_mod.o \
mopitt_obs_mod.o"
sed -e "s/$find/$replace/g" output1 > output
rm output1
mv output Objects.mk
fi
if [ $1 = "SAT_NETCDF" ]; then
find="rpmares_mod.o"
replace="rpmares_mod.o \
gosat_co2_mod.o \
tes_nh3_mod.o \
tes_o3_mod.o \
iasi_o3_obs_mod.o \
tes_o3_irk_mod.o"
sed -e "s/$find/$replace/g" Objects.mkl > output1
find="tes_ch4_mod.o"
replace="tes_ch4_mod.o \
scia_ch4_mod.o"
sed -e "s/$find/$replace/g" output1 > output
rm output1
mv output Objects.mk
fi
if [ $1 = "LIDORT" ]; then
find="population_mod.o"
replace="population_mod.o \
mie_mod.o \
lidort_mod.o"
sed -e "s/$find/$replace/g" Objects.mkl > output
mv output Objects.mk
fi
if [ $1 = "DEFAULT" ]; then
mv Objects.mkl Objects.mk
fi
if [ $1 = "HDF_NETCDF" ]; then
find="rpmares_mod.o"
replace="rpmares_mod.o \
gosat_co2_mod.o \
tes_nh3_mod.o \
tes_o3_mod.o \
iasi_o3_obs_mod.o \
tes_o3_irk_mod.o"
sed -e "s/$find/$replace/g" Objects.mkl > output1
find="tes_ch4_mod.o"
replace="tes_ch4_mod.o \
scia_ch4_mod.o"
sed -e "s/$find/$replace/g" output1 > output2
#rm output1
#mv output Objects.mk
find="getifsun.o"
replace="getifsun.o \
gvchsq.o "
sed -e "s/$find/$replace/g" output2 > output3
find="input_mod.o"
replace="input_mod.o \
He4IncludeModule.o \
He4ErrorModule.o \
He4GridModule.o \
He4SwathModule.o \
findinv.o \
airsv5_mod.o \
airs_co_obs_mod.o \
HdfIncludeModule.o \
HdfSdModule.o \
HdfVdModule.o \
mls_o3_obs_mod.o \
mls_hno3_obs_mod.o \
omi_no2_obs_mod.o \
omi_so2_obs_mod.o \
omi_ch2o_obs_mod.o \
osiris_no2_obs_mod.o \
interp.o \
gaussj.o \
iasi_co_obs_mod.o \
mopitt_obs_mod.o"
sed -e "s/$find/$replace/g" output3 > output
rm output1
rm output2
rm output3
mv output Objects.mk
fi