{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Notebook to Set-up and Run Ariane for Mixing Paper" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import os\n", "import RunAriane" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def _make_namelist (minvalue, maxvalue, dir_name):\n", " template_filename = 'namelist_template'\n", " namelist_filename = 'namelist'\n", " with open(os.path.join(dir_name, namelist_filename), 'wt') as namelist:\n", " with open(os.path.join(dir_name, template_filename)) as template:\n", " for line in template.readlines():\n", " if line[2:6] == 'lmin':\n", " namelist.writelines(' lmin= {},\\n'.format(minvalue))\n", " elif line[2:6] == 'lmax':\n", " namelist.writelines(' lmax= {},\\n'.format(maxvalue))\n", " else:\n", " namelist.writelines(line)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/ocean/sallen/allen/research/Meopar/Ariane/mixing_paper/base_jul/FluxesSouth\n", "Start 1\n", "End 1\n" ] } ], "source": [ "dir_name = './'\n", "! pwd\n", "#for nday in range(args.numberofdays):\n", "for nday in range(1):\n", " print ('Start', nday+1)\n", " _make_namelist(nday+1, nday+2, dir_name)\n", " RunAriane.run_ariane()\n", " RunAriane.rename_results(nday=nday, labeltype='day')\n", " print ('End', nday+1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "if __name__ == '__main__':\n", " parser = argparse.ArgumentParser()\n", " parser.add_argument(\n", " 'numberofdays', help='Number of different dates to do', type=int)\n", " args = parser.parse_args()\n", " main(args)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "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.5.1" } }, "nbformat": 4, "nbformat_minor": 0 }