diff --git a/docs/images/Horizontal indexing in MOM6.ipynb b/docs/images/Horizontal indexing in MOM6.ipynb new file mode 100644 index 0000000000..4307c544f5 --- /dev/null +++ b/docs/images/Horizontal indexing in MOM6.ipynb @@ -0,0 +1,128 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Generates schematics of horizontal indexing conventions" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import numpy, matplotlib.pyplot as plt\n", + "%matplotlib inline\n", + "plt.xkcd();" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Figure 1\n", + "def plot_grid(ni,nj,hi,hj,symmetric=True):\n", + " isc,jsc,iec,jec = 0.5,0.5,ni-.5,nj-.5\n", + " isd,jsd,ied,jed = isc-hi,jsc-hj,iec+hi,jec+hj\n", + " if symmetric:\n", + " IsdB,IedB,JsdB,JedB,IscB,IecB,JscB,JecB = isd-.5,ied+.5,jsd-.5,jed+.5,isc-.5,iec+.5,jsc-.5,jec+.5\n", + " else:\n", + " IsdB,IedB,JsdB,JedB,IscB,IecB,JscB,JecB = isd+.5,ied+.5,jsd+.5,jed+.5,isc+.5,iec+.5,jsc+.5,jec+.5\n", + " #XsdB,XedB,YsdB,YedB = isd-.5,ied+.5,jsd-.5,jed+.5\n", + " fig = plt.figure()\n", + " ax1 = fig.add_subplot(111)\n", + " ax2 = ax1.twiny()\n", + " ax3 = ax1.twinx()\n", + " for ax in [ax1,ax2,ax3]:\n", + " ax.set_xlim(isd-1,ied+1)\n", + " ax.set_ylim(jsd-1,ied+1)\n", + " # Halos of data domain\n", + " #for x in numpy.arange(IsdB,IedB+1): ax1.plot([x,x],[JsdB,JedB],'k')\n", + " for x in numpy.arange(IsdB,IscB): ax1.plot([x,x],[jsd-.5,JedB],'b')\n", + " for x in numpy.arange(IecB+1,IedB+1): ax1.plot([x,x],[jsd-.5,JedB],'b')\n", + " for x in numpy.arange(IscB,IecB+1):\n", + " ax1.plot([x,x],[jsd-.5,jsc-.5],'b')\n", + " ax1.plot([x,x],[JecB,JedB],'b')\n", + " #for y in numpy.arange(JsdB,JedB+1): ax1.plot([IsdB,IedB],[y,y],'k')\n", + " for y in numpy.arange(JsdB,JscB): ax1.plot([isd-.5,IedB],[y,y],'b')\n", + " for y in numpy.arange(JecB+1,JedB+1): ax1.plot([isd-.5,IedB],[y,y],'b')\n", + " for y in numpy.arange(JscB,JecB+1):\n", + " ax1.plot([isd-.5,isc-.5],[y,y],'b')\n", + " ax1.plot([IecB,IedB],[y,y],'b')\n", + " # Computational domain\n", + " for x in numpy.arange(IscB,IecB+1): ax2.plot([x,x],[jsc-.5,jec+.5],'r')\n", + " for y in numpy.arange(JscB,JecB+1): ax2.plot([isc-.5,iec+.5],[y,y],'r')\n", + " for y in numpy.arange(jsd,jed+1):\n", + " for x in numpy.arange(isd,ied+1):\n", + " ax2.plot(x,y,'xb')\n", + " for y in numpy.arange(jsc,jec+1):\n", + " for x in numpy.arange(isc,iec+1):\n", + " ax2.plot(x,y,'xr')\n", + " for y in numpy.arange(JsdB,JedB+1):\n", + " for x in numpy.arange(IsdB,IedB+1):\n", + " ax2.plot(x,y,'ob')\n", + " for y in numpy.arange(JscB,JecB+1):\n", + " for x in numpy.arange(IscB,IecB+1):\n", + " ax2.plot(x,y,'or')\n", + " text_opts={'horizontalalignment':'center','verticalalignment':'center','backgroundcolor':'w'}\n", + " ax1.set_xticks([IsdB,IscB,IecB,IedB])\n", + " ax1.set_xticklabels(['IsdB','IscB','IecB','IedB'])\n", + " ax1.set_yticks([JsdB,JscB,JecB,JedB])\n", + " ax1.set_yticklabels(['JsdB','JscB','JecB','JedB'])\n", + " ax1.set_xlabel('q-/u-point I')\n", + " ax1.set_ylabel('q-/v-point J')\n", + " ax2.set_xticks([isd,isc,iec,ied])\n", + " ax2.set_xticklabels(['isd','isc','iec','ied'])\n", + " ax2.set_xlabel('h-/v-point i')\n", + " ax3.set_yticks([jsd,jsc,jec,jed])\n", + " ax3.set_yticklabels(['jsd','jsc','jec','jed'])\n", + " ax3.set_ylabel('h-/u-point j')\n", + " for ax in [ax1,ax2,ax3]:\n", + " ax.spines['bottom'].set_visible(False)\n", + " ax.spines['top'].set_visible(False)\n", + " ax.spines['left'].set_visible(False)\n", + " ax.spines['right'].set_visible(False)\n", + "plot_grid(5,5,2,2,symmetric=False)\n", + "plt.savefig('Horizontal_NE_indexing_nonsym.png',bbox_inches='tight')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plot_grid(5,5,2,2)\n", + "plt.savefig('Horizontal_NE_indexing_sym.png',bbox_inches='tight')" + ] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [default]", + "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.3" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/docs/images/Horizontal_NE_indexing_nonsym.png b/docs/images/Horizontal_NE_indexing_nonsym.png index 6316a64e7a..3106749e3a 100644 Binary files a/docs/images/Horizontal_NE_indexing_nonsym.png and b/docs/images/Horizontal_NE_indexing_nonsym.png differ