import os
varchanges={
'zz_rate_mesozoo_MicroPref': 'zz_rate_mesozoo_diatPref',
'zz_rate_mesozoo_MicroPredslope': 'zz_rate_mesozoo_diatPredslope',
'zz_rate_mesozoo_MicroHalfSat': 'zz_rate_mesozoo_diatHalfSat',
'zz_rate_uzoo_MicroPref': 'zz_rate_uzoo_diatPref',
'zz_rate_uzoo_MicroPredslope': 'zz_rate_uzoo_diatPredslope',
'zz_rate_uzoo_MicroHalfSat': 'zz_rate_uzoo_diatHalfSat',
'zz_w_sink_Pmicro_min': 'zz_w_sink_Pdiat_min',
'zz_w_sink_Pmicro_max': 'zz_w_sink_Pdiat_max',
'zz_rate_Si_ratio_nano': 'zz_rate_Si_ratio_flag',
'zz_rate_R_nano': 'zz_rate_R_flag',
'zz_rate_maxtemp_nano': 'zz_rate_maxtemp_flag',
'zz_rate_temprange_nano': 'zz_rate_temprange_flag',
'zz_PE_a_nano': 'zz_PE_a_flag',
'zz_PE_Iopt_nano': 'zz_PE_Iopt_flag',
'zz_rate_K_Si_nano': 'zz_rate_K_Si_flag',
'zz_rate_kapa_nano': 'zz_rate_kapa_flag',
'zz_rate_k_nano': 'zz_rate_k_flag',
'zz_rate_pico_Rm': 'zz_rate_flag_Rm',
'zz_rate_micro_Rm':'zz_rate_diat_Rm',
'zz_rate_pico_Rm':'zz_rate_flag_Rm',
'zz_rate_mesozoo_NanoPref':'zz_rate_mesozoo_myriPref',
'zz_rate_mesozoo_NanoPredslope':'zz_rate_mesozoo_myriPredslope',
'zz_rate_mesozoo_NanoHalfSat':'zz_rate_mesozoo_myriHalfSat',
'zz_rate_uzoo_NanoPref':'zz_rate_uzoo_myriPref',
'zz_rate_uzoo_NanoPredslope':'zz_rate_uzoo_myriPredslope',
'zz_rate_uzoo_NanoHalfSat':'zz_rate_uzoo_myriHalfSat' ,
'zz_rate_mesorub_PicoPredSlope':'zz_rate_mesorub_flagPredSlope',
'zz_rate_mesorub_PicoHalfSat':'zz_rate_mesorub_flagHalfSat',
'zz_rate_mesozoo_PicoPref':'zz_rate_mesozoo_flagPref',
'zz_rate_mesozoo_PicoPredslope':'zz_rate_mesozoo_flagPredslope',
'zz_rate_mesozoo_PicoHalfSat':'zz_rate_mesozoo_flagHalfSat',
'zz_rate_uzoo_PicoPref':'zz_rate_uzoo_flagPref',
'zz_rate_uzoo_PicoPredslope':'zz_rate_uzoo_flagPredslope',
'zz_rate_uzoo_PicoHalfSat':'zz_rate_uzoo_flagHalfSat',
'zz_frac_waste_NEM_NH':'zz_frac_waste_CEM_NH',
'zz_frac_waste_NEM_DON':'zz_frac_waste_CEM_DON',
'zz_frac_waste_NEM_PON':'zz_frac_waste_CEM_PON',
'zz_frac_waste_NEM_BSi':'zz_frac_waste_CEM_BSi',
'zz_frac_waste_NEZ_NH':'zz_frac_waste_CEZ_NH',
'zz_frac_waste_NEZ_DON':'zz_frac_waste_CEZ_DON',
'zz_frac_waste_NEZ_PON':'zz_frac_waste_CEZ_PON',
'zz_frac_waste_NEZ_BSi':'zz_frac_waste_CEZ_BSi',
'zz_frac_waste_FEN_NH':'zz_frac_waste_FEC_NH',
'zz_frac_waste_FEN_DON':'zz_frac_waste_FEC_DON',
'zz_frac_waste_FEN_PON':'zz_frac_waste_FEC_PON',
'zz_frac_waste_FEN_BSi':'zz_frac_waste_FEC_BSi',
'zz_frac_waste_NNM_NH':'zz_frac_waste_CNM_NH',
'zz_frac_waste_NNM_DON':'zz_frac_waste_CNM_DON',
'zz_frac_waste_NNM_PON':'zz_frac_waste_CNM_PON',
'zz_frac_waste_NNM_Bsi':'zz_frac_waste_CNM_Bsi',
}
# deleted:
# zz_frac_waste_NNM_Ref
# zz_frac_waste_DNM_Ref
# zz_frac_waste_FNM_Ref
for fpath in ('/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H',):
#('/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_HC201812equiv',
#'/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_HC201905equiv'):
#('/data/eolson/results/MEOPAR/tmp/namelist_smelt_ref_newvars',
# '/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_newvars'):
for el in varchanges.keys():
sedcmd=f"sed -i 's/{el}/{varchanges[el]}/g' {fpath} "
print(sedcmd)
os.system(sedcmd)
sed -i 's/zz_rate_mesozoo_MicroPref/zz_rate_mesozoo_diatPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_MicroPredslope/zz_rate_mesozoo_diatPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_MicroHalfSat/zz_rate_mesozoo_diatHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_MicroPref/zz_rate_uzoo_diatPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_MicroPredslope/zz_rate_uzoo_diatPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_MicroHalfSat/zz_rate_uzoo_diatHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_w_sink_Pmicro_min/zz_w_sink_Pdiat_min/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_w_sink_Pmicro_max/zz_w_sink_Pdiat_max/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_Si_ratio_nano/zz_rate_Si_ratio_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_R_nano/zz_rate_R_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_maxtemp_nano/zz_rate_maxtemp_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_temprange_nano/zz_rate_temprange_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_PE_a_nano/zz_PE_a_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_PE_Iopt_nano/zz_PE_Iopt_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_K_Si_nano/zz_rate_K_Si_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_kapa_nano/zz_rate_kapa_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_k_nano/zz_rate_k_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_pico_Rm/zz_rate_flag_Rm/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_micro_Rm/zz_rate_diat_Rm/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_NanoPref/zz_rate_mesozoo_myriPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_NanoPredslope/zz_rate_mesozoo_myriPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_NanoHalfSat/zz_rate_mesozoo_myriHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_NanoPref/zz_rate_uzoo_myriPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_NanoPredslope/zz_rate_uzoo_myriPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_NanoHalfSat/zz_rate_uzoo_myriHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesorub_PicoPredSlope/zz_rate_mesorub_flagPredSlope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesorub_PicoHalfSat/zz_rate_mesorub_flagHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_PicoPref/zz_rate_mesozoo_flagPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_PicoPredslope/zz_rate_mesozoo_flagPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_mesozoo_PicoHalfSat/zz_rate_mesozoo_flagHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_PicoPref/zz_rate_uzoo_flagPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_PicoPredslope/zz_rate_uzoo_flagPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_rate_uzoo_PicoHalfSat/zz_rate_uzoo_flagHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEM_NH/zz_frac_waste_CEM_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEM_DON/zz_frac_waste_CEM_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEM_PON/zz_frac_waste_CEM_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEM_BSi/zz_frac_waste_CEM_BSi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEZ_NH/zz_frac_waste_CEZ_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEZ_DON/zz_frac_waste_CEZ_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEZ_PON/zz_frac_waste_CEZ_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NEZ_BSi/zz_frac_waste_CEZ_BSi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_FEN_NH/zz_frac_waste_FEC_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_FEN_DON/zz_frac_waste_FEC_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_FEN_PON/zz_frac_waste_FEC_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_FEN_BSi/zz_frac_waste_FEC_BSi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NNM_NH/zz_frac_waste_CNM_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NNM_DON/zz_frac_waste_CNM_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NNM_PON/zz_frac_waste_CNM_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H sed -i 's/zz_frac_waste_NNM_Bsi/zz_frac_waste_CNM_Bsi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H