{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "varchanges={\n", " 'zz_rate_mesozoo_MicroPref': 'zz_rate_mesozoo_diatPref',\n", " 'zz_rate_mesozoo_MicroPredslope': 'zz_rate_mesozoo_diatPredslope',\n", " 'zz_rate_mesozoo_MicroHalfSat': 'zz_rate_mesozoo_diatHalfSat',\n", " 'zz_rate_uzoo_MicroPref': 'zz_rate_uzoo_diatPref',\n", " 'zz_rate_uzoo_MicroPredslope': 'zz_rate_uzoo_diatPredslope',\n", " 'zz_rate_uzoo_MicroHalfSat': 'zz_rate_uzoo_diatHalfSat',\n", " 'zz_w_sink_Pmicro_min': 'zz_w_sink_Pdiat_min',\n", " 'zz_w_sink_Pmicro_max': 'zz_w_sink_Pdiat_max',\n", " 'zz_rate_Si_ratio_nano': 'zz_rate_Si_ratio_flag',\n", " 'zz_rate_R_nano': 'zz_rate_R_flag',\n", " 'zz_rate_maxtemp_nano': 'zz_rate_maxtemp_flag',\n", " 'zz_rate_temprange_nano': 'zz_rate_temprange_flag',\n", " 'zz_PE_a_nano': 'zz_PE_a_flag',\n", " 'zz_PE_Iopt_nano': 'zz_PE_Iopt_flag',\n", " 'zz_rate_K_Si_nano': 'zz_rate_K_Si_flag',\n", " 'zz_rate_kapa_nano': 'zz_rate_kapa_flag',\n", " 'zz_rate_k_nano': 'zz_rate_k_flag',\n", " 'zz_rate_pico_Rm': 'zz_rate_flag_Rm',\n", " 'zz_rate_micro_Rm':'zz_rate_diat_Rm',\n", " 'zz_rate_pico_Rm':'zz_rate_flag_Rm',\n", " 'zz_rate_mesozoo_NanoPref':'zz_rate_mesozoo_myriPref',\n", " 'zz_rate_mesozoo_NanoPredslope':'zz_rate_mesozoo_myriPredslope',\n", " 'zz_rate_mesozoo_NanoHalfSat':'zz_rate_mesozoo_myriHalfSat',\n", " 'zz_rate_uzoo_NanoPref':'zz_rate_uzoo_myriPref',\n", " 'zz_rate_uzoo_NanoPredslope':'zz_rate_uzoo_myriPredslope',\n", " 'zz_rate_uzoo_NanoHalfSat':'zz_rate_uzoo_myriHalfSat' ,\n", " 'zz_rate_mesorub_PicoPredSlope':'zz_rate_mesorub_flagPredSlope',\n", " 'zz_rate_mesorub_PicoHalfSat':'zz_rate_mesorub_flagHalfSat',\n", " 'zz_rate_mesozoo_PicoPref':'zz_rate_mesozoo_flagPref',\n", " 'zz_rate_mesozoo_PicoPredslope':'zz_rate_mesozoo_flagPredslope',\n", " 'zz_rate_mesozoo_PicoHalfSat':'zz_rate_mesozoo_flagHalfSat',\n", " 'zz_rate_uzoo_PicoPref':'zz_rate_uzoo_flagPref',\n", " 'zz_rate_uzoo_PicoPredslope':'zz_rate_uzoo_flagPredslope',\n", " 'zz_rate_uzoo_PicoHalfSat':'zz_rate_uzoo_flagHalfSat',\n", " 'zz_frac_waste_NEM_NH':'zz_frac_waste_CEM_NH',\n", " 'zz_frac_waste_NEM_DON':'zz_frac_waste_CEM_DON',\n", " 'zz_frac_waste_NEM_PON':'zz_frac_waste_CEM_PON',\n", " 'zz_frac_waste_NEM_BSi':'zz_frac_waste_CEM_BSi',\n", " 'zz_frac_waste_NEZ_NH':'zz_frac_waste_CEZ_NH',\n", " 'zz_frac_waste_NEZ_DON':'zz_frac_waste_CEZ_DON',\n", " 'zz_frac_waste_NEZ_PON':'zz_frac_waste_CEZ_PON',\n", " 'zz_frac_waste_NEZ_BSi':'zz_frac_waste_CEZ_BSi',\n", " 'zz_frac_waste_FEN_NH':'zz_frac_waste_FEC_NH',\n", " 'zz_frac_waste_FEN_DON':'zz_frac_waste_FEC_DON',\n", " 'zz_frac_waste_FEN_PON':'zz_frac_waste_FEC_PON',\n", " 'zz_frac_waste_FEN_BSi':'zz_frac_waste_FEC_BSi',\n", " 'zz_frac_waste_NNM_NH':'zz_frac_waste_CNM_NH',\n", " 'zz_frac_waste_NNM_DON':'zz_frac_waste_CNM_DON',\n", " 'zz_frac_waste_NNM_PON':'zz_frac_waste_CNM_PON',\n", " 'zz_frac_waste_NNM_Bsi':'zz_frac_waste_CNM_Bsi',\n", "}\n", "# deleted:\n", "# zz_frac_waste_NNM_Ref\n", "# zz_frac_waste_DNM_Ref\n", "# zz_frac_waste_FNM_Ref" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "sed -i 's/zz_rate_mesozoo_MicroPref/zz_rate_mesozoo_diatPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_MicroPredslope/zz_rate_mesozoo_diatPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_MicroHalfSat/zz_rate_mesozoo_diatHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_MicroPref/zz_rate_uzoo_diatPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_MicroPredslope/zz_rate_uzoo_diatPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_MicroHalfSat/zz_rate_uzoo_diatHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_w_sink_Pmicro_min/zz_w_sink_Pdiat_min/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_w_sink_Pmicro_max/zz_w_sink_Pdiat_max/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_Si_ratio_nano/zz_rate_Si_ratio_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_R_nano/zz_rate_R_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_maxtemp_nano/zz_rate_maxtemp_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_temprange_nano/zz_rate_temprange_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_PE_a_nano/zz_PE_a_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_PE_Iopt_nano/zz_PE_Iopt_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_K_Si_nano/zz_rate_K_Si_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_kapa_nano/zz_rate_kapa_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_k_nano/zz_rate_k_flag/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_pico_Rm/zz_rate_flag_Rm/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_micro_Rm/zz_rate_diat_Rm/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_NanoPref/zz_rate_mesozoo_myriPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_NanoPredslope/zz_rate_mesozoo_myriPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_NanoHalfSat/zz_rate_mesozoo_myriHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_NanoPref/zz_rate_uzoo_myriPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_NanoPredslope/zz_rate_uzoo_myriPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_NanoHalfSat/zz_rate_uzoo_myriHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesorub_PicoPredSlope/zz_rate_mesorub_flagPredSlope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesorub_PicoHalfSat/zz_rate_mesorub_flagHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_PicoPref/zz_rate_mesozoo_flagPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_PicoPredslope/zz_rate_mesozoo_flagPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_mesozoo_PicoHalfSat/zz_rate_mesozoo_flagHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_PicoPref/zz_rate_uzoo_flagPref/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_PicoPredslope/zz_rate_uzoo_flagPredslope/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_rate_uzoo_PicoHalfSat/zz_rate_uzoo_flagHalfSat/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEM_NH/zz_frac_waste_CEM_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEM_DON/zz_frac_waste_CEM_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEM_PON/zz_frac_waste_CEM_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEM_BSi/zz_frac_waste_CEM_BSi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEZ_NH/zz_frac_waste_CEZ_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEZ_DON/zz_frac_waste_CEZ_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEZ_PON/zz_frac_waste_CEZ_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NEZ_BSi/zz_frac_waste_CEZ_BSi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_FEN_NH/zz_frac_waste_FEC_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_FEN_DON/zz_frac_waste_FEC_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_FEN_PON/zz_frac_waste_FEC_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_FEN_BSi/zz_frac_waste_FEC_BSi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NNM_NH/zz_frac_waste_CNM_NH/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NNM_DON/zz_frac_waste_CNM_DON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NNM_PON/zz_frac_waste_CNM_PON/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n", "sed -i 's/zz_frac_waste_NNM_Bsi/zz_frac_waste_CNM_Bsi/g' /data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H \n" ] } ], "source": [ "for fpath in ('/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_H',):\n", " #('/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_HC201812equiv',\n", " #'/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_HC201905equiv'):\n", " #('/data/eolson/results/MEOPAR/tmp/namelist_smelt_ref_newvars',\n", " # '/data/eolson/results/MEOPAR/tmp/namelist_smelt_cfg_newvars'):\n", " for el in varchanges.keys():\n", " sedcmd=f\"sed -i 's/{el}/{varchanges[el]}/g' {fpath} \"\n", " print(sedcmd)\n", " os.system(sedcmd)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python (py39)", "language": "python", "name": "py39" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.2" } }, "nbformat": 4, "nbformat_minor": 4 }