From f697aec3210cda3da03c3babef3c636203548ad2 Mon Sep 17 00:00:00 2001 From: rmshkv Date: Mon, 3 Jun 2024 12:47:05 -0600 Subject: [PATCH] Commenting out heavy computational cells in macronutrients notebook --- notebooks/ocn-macronuts.ipynb | 150 ++++++++++++++-------------------- 1 file changed, 62 insertions(+), 88 deletions(-) diff --git a/notebooks/ocn-macronuts.ipynb b/notebooks/ocn-macronuts.ipynb index 89edfd7..c9be3fb 100644 --- a/notebooks/ocn-macronuts.ipynb +++ b/notebooks/ocn-macronuts.ipynb @@ -316,48 +316,42 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "02d46a8a-7de9-4ed9-a672-f692856a799e", + "cell_type": "raw", + "id": "21b76c34-1205-4c05-8480-8c4303ce0947", "metadata": {}, - "outputs": [], "source": [ "ds_annual = year_mean(ds)\n", "ds_annual" ] }, { - "cell_type": "markdown", - "id": "0915979c-58e5-4217-83ff-e5bb7a93a0b2", + "cell_type": "raw", + "id": "63b605f1-3171-45fe-a2a0-83df48c5d308", "metadata": {}, "source": [ "Note that our time coordinate is now called `year` instead, and has only years now. We can select specific years to plot:" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "044ce3e1-394d-471a-a8e6-5e99ce72f087", + "cell_type": "raw", + "id": "4e9186e0-f42f-4906-96fd-c72c6579884d", "metadata": {}, - "outputs": [], "source": [ "ds_annual['NO3'].sel(year=2010).isel(z_t=0).plot()" ] }, { - "cell_type": "markdown", - "id": "79c5d1a6-8987-4d23-82ef-e4e9b0e35227", + "cell_type": "raw", + "id": "4d5135be-7e07-45f5-86bf-022db9ab48ee", "metadata": {}, "source": [ "### Let's make a nicer-looking map" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "85d669d3-24e7-4626-b862-20123b0f9816", + "cell_type": "raw", + "id": "3de10a7a-3036-429b-b79f-cd14c80d83bb", "metadata": {}, - "outputs": [], "source": [ "fig = plt.figure(figsize=(8,6))\n", "\n", @@ -374,8 +368,8 @@ ] }, { - "cell_type": "markdown", - "id": "b741fef7-406c-4186-bf26-479c03ca8fae", + "cell_type": "raw", + "id": "21b6b012-cc2f-43e2-9aa7-10558d9c83b7", "metadata": {}, "source": [ "## Compare long-term mean to World Ocean Atlas 2018\n", @@ -391,11 +385,9 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "f7d11915-3fe0-4037-8cba-cce3929cb7c9", + "cell_type": "raw", + "id": "6301b55e-bdfb-4587-bdc0-9a4250469386", "metadata": {}, - "outputs": [], "source": [ "woa_file_path = 's3://pythia/ocean-bgc/obs/WOA2018_POPgrid.nc'\n", "\n", @@ -407,21 +399,17 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "7e2adc2d-ab7c-4e85-b3fe-d17480e5e90d", + "cell_type": "raw", + "id": "f4c321db-9498-4e47-856c-a195cd957a13", "metadata": {}, - "outputs": [], "source": [ "ds_mean = ds_annual.mean(\"year\").compute()" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "36254386-83a7-4e53-a221-9316b54e762c", + "cell_type": "raw", + "id": "c270fb67-a0dc-4422-aa2b-c087262cdf80", "metadata": {}, - "outputs": [], "source": [ "NO3_diff = ds_mean.NO3 - ds_woa.NO3\n", "PO4_diff = ds_mean.PO4 - ds_woa.PO4\n", @@ -429,8 +417,8 @@ ] }, { - "cell_type": "markdown", - "id": "71607513-6627-4425-b360-8e83a3038e0a", + "cell_type": "raw", + "id": "80ae3f57-db24-43ed-a276-57d99743426a", "metadata": {}, "source": [ "### Surface comparison\n", @@ -438,11 +426,9 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "9621fecf-9123-4534-ac8d-85fb24c9a50a", + "cell_type": "raw", + "id": "6d73c7e6-d114-4877-add9-954c9003e555", "metadata": {}, - "outputs": [], "source": [ "ds_dict_surf = {'CESMNO3': {'title': 'CESM surface NO$_3$',\n", " 'label': 'NO$_3$ (mmol m$^{-3}$)',\n", @@ -494,19 +480,17 @@ ] }, { - "cell_type": "markdown", - "id": "9a240b2d-69fb-465a-871b-16948706490f", + "cell_type": "raw", + "id": "c7f315eb-b00e-46e1-900d-ec897d7b10f7", "metadata": {}, "source": [ "Here we pull from the above dictionary to actually make the plots." ] }, { - "cell_type": "code", - "execution_count": null, - "id": "8bf55132-8eee-40e0-81aa-f7485ea31361", + "cell_type": "raw", + "id": "d5f515d7-9ab5-4c55-bdca-bc3885e7269f", "metadata": {}, - "outputs": [], "source": [ "fig = plt.figure(figsize=(18,10))\n", "\n", @@ -527,27 +511,25 @@ ] }, { - "cell_type": "markdown", - "id": "2103fda4-e9a9-4ae9-bb3d-37dc728dc99b", + "cell_type": "raw", + "id": "e24ad4f6-f703-40be-85df-7b33f4d0a760", "metadata": {}, "source": [ "### Comparison at 100m" ] }, { - "cell_type": "markdown", - "id": "9428e5cb-d301-4e2a-bdf4-35140408390c", + "cell_type": "raw", + "id": "73cc42f7-ddb8-4ded-b3b8-0f01616c62f6", "metadata": {}, "source": [ "Similar to above, but at a depth of 100m rather than at the surface." ] }, { - "cell_type": "code", - "execution_count": null, - "id": "6744ba94-b999-41dd-b8da-ecd88b33cb56", + "cell_type": "raw", + "id": "cd28703f-82c9-4c76-af79-4f1469a3b4f5", "metadata": {}, - "outputs": [], "source": [ "ds_dict_100m = {'CESMNO3': {'title': 'CESM 100m NO$_3$',\n", " 'label': 'NO$_3$ (mmol m$^{-3}$)',\n", @@ -599,11 +581,9 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "9780941b-7fe9-4db7-9618-c1692a36c787", + "cell_type": "raw", + "id": "ed52d30f-9b42-4583-890e-a1dc15b4efb2", "metadata": {}, - "outputs": [], "source": [ "fig = plt.figure(figsize=(18,10))\n", "\n", @@ -623,27 +603,25 @@ ] }, { - "cell_type": "markdown", - "id": "63d10d8b-09c6-41b4-97d4-2913b1d9872e", + "cell_type": "raw", + "id": "287cbdd6-82b9-4b22-b79c-ec98e723d06f", "metadata": {}, "source": [ "## Global mean macronutrient profiles" ] }, { - "cell_type": "markdown", - "id": "30e9b004-6c9f-4768-a1f7-893686fd9419", + "cell_type": "raw", + "id": "e16ab1e8-0f9c-4bd1-897b-3d046b4bcb1a", "metadata": {}, "source": [ " Let's write a function to take a global mean of the variables we're interested in, so that we can look at some depth profiles rather than maps. Also remember that we already took a mean over the whole time range (and the WOA dataset already had this mean taken), so this is a mean in time as well. Like the above maps, we also plot a bias panel to directly compare the difference between the datasets." ] }, { - "cell_type": "code", - "execution_count": null, - "id": "5a4d8ed0-b740-4c70-9478-544153e3ad35", + "cell_type": "raw", + "id": "fa908ee6-3f4a-4352-b977-93fe95527233", "metadata": {}, - "outputs": [], "source": [ "def global_mean(ds, ds_grid, compute_vars, include_ms=False):\n", " \"\"\"\n", @@ -677,39 +655,33 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "04bf0b7e-d2d1-4ec3-b630-63496058754e", + "cell_type": "raw", + "id": "a7540610-7135-4c7f-807e-6bead0f2547d", "metadata": {}, - "outputs": [], "source": [ "ds_glb = global_mean(ds_mean, ds_grid, ['NO3','PO4','SiO3']).compute()" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "f53e0d97-d55a-471f-aaa0-54fa36350a2a", + "cell_type": "raw", + "id": "11726462-0ff0-48fa-ba30-a5a33b5cc28a", "metadata": {}, - "outputs": [], "source": [ "ds_glb_woa = global_mean(ds_woa, ds_grid, ['NO3','PO4','SiO3']).compute()" ] }, { - "cell_type": "markdown", - "id": "03bdf16c-6e83-418a-a896-5ba2599d8cbd", + "cell_type": "raw", + "id": "5ec97a98-8ed6-4ff2-9f43-9ebca68834d3", "metadata": {}, "source": [ "Rather than setting up a dictionary of parameters, here we choose to make the plots inline since there aren't as many." ] }, { - "cell_type": "code", - "execution_count": null, - "id": "69c80aff-2e77-4566-a570-fc4034411e96", + "cell_type": "raw", + "id": "08533f63-af14-4e65-aca5-d7278cb7eb4f", "metadata": {}, - "outputs": [], "source": [ "fig = plt.figure(figsize=(6,10))\n", "\n", @@ -777,34 +749,32 @@ ] }, { - "cell_type": "markdown", - "id": "49ec424d-e651-48df-ae02-b99fa2802efa", + "cell_type": "raw", + "id": "fe4bf978-0bf6-4ce9-9d3b-6534ced341d9", "metadata": {}, "source": [ "And close the Dask cluster we spun up at the beginning." ] }, { - "cell_type": "code", - "execution_count": null, - "id": "cbbc29ed-b235-4c8f-8d76-50ce3d576ecb", + "cell_type": "raw", + "id": "3503dd15-89bf-4a8f-86f1-958d32dd70c1", "metadata": {}, - "outputs": [], "source": [ "cluster.close()" ] }, { - "cell_type": "markdown", - "id": "74857cbe-daae-40a6-b19c-10e7048d6a4d", + "cell_type": "raw", + "id": "b4db0ee7-b64b-434b-92bd-7295ebb12c4c", "metadata": {}, "source": [ "---" ] }, { - "cell_type": "markdown", - "id": "0fa03354-c521-44e3-9ed3-634fbb5141d1", + "cell_type": "raw", + "id": "b27f59b1-8edf-4748-9fbc-90d4291f0802", "metadata": {}, "source": [ "## Summary\n", @@ -812,8 +782,8 @@ ] }, { - "cell_type": "markdown", - "id": "6ffae2b4-18ff-4e05-8ce7-b9baf77b4516", + "cell_type": "raw", + "id": "2db28b89-d481-421e-8bc4-80e028e374d9", "metadata": {}, "source": [ "## Resources and references\n", @@ -825,6 +795,10 @@ } ], "metadata": { + "kernelspec": { + "display_name": "", + "name": "" + }, "language_info": { "name": "python" }