{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "## Nutrient Limitation\n", "\n", "Compute biomass-weighted-mean limitation terms in the upper ocean (i.e., top 150 m).\n", "\n", "Make 3 panel plot: maps of most limiting nutrient for each phytoplankton taxa (diatom, small phyto, diazotrophs)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import os\n", "\n", "import cftime\n", "\n", "import xarray as xr\n", "import numpy as np\n", "\n", "import matplotlib.pyplot as plt\n", "import matplotlib.gridspec as gridspec\n", "import matplotlib.colors as colors\n", "from matplotlib.colors import ListedColormap\n", "\n", "import seaborn as sns\n", "\n", "import cartopy\n", "import cartopy.crs as ccrs\n", "\n", "import intake\n", "import intake_esm\n", "import ann_avg_utils as aau\n", "\n", "import ncar_jobqueue\n", "from dask.distributed import Client\n", "\n", "import xpersist as xp\n", "# Set up xperist cache\n", "cache_dir = os.path.join(os.path.sep, 'glade', 'p', 'cgd', 'oce', 'projects', 'cesm2-marbl', 'xpersist_cache')\n", "if (os.path.isdir(cache_dir)):\n", " xp.settings['cache_dir'] = cache_dir\n", "xp_dir = 'nutrient_limitation'\n", "os.makedirs(os.path.join(xp.settings['cache_dir'], xp_dir), exist_ok=True)\n", "\n", "import utils\n", "\n", "# MCL: commenting this out, getting type error\n", "#%load_ext watermark\n", "#%watermark -a \"Mike Levy\" -d -iv -m -g -h" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Spin up a Dask Cluster" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/glade/u/home/mgrover/miniconda3/envs/cesm2-marbl/lib/python3.7/site-packages/distributed/node.py:164: UserWarning: Port 8787 is already in use.\n", "Perhaps you already have a cluster running?\n", "Hosting the HTTP server on port 33872 instead\n", " expected, actual\n" ] }, { "data": { "text/html": [ "
\n",
"Client\n", "
| \n",
"\n",
"Cluster\n", "
| \n",
"