From acb2f5a1dba5ed4876b2fcd9536764e75dd44b7e Mon Sep 17 00:00:00 2001 From: anthony-meza Date: Sat, 6 Jul 2024 08:27:42 -0400 Subject: [PATCH] adding descriptions to all notebooks --- .DS_Store | Bin 0 -> 6148 bytes .../EulerianVolumeBudgetExample.ipynb | 44 ++++++++++++++- budget_examples/HeatBudgetExample copy.ipynb | 53 ++++++++++++------ .../ResidualVolumeBudgetExample.ipynb | 37 +++++++++++- diagnostic_examples/Interpolations.ipynb | 38 ++++++++++++- 5 files changed, 151 insertions(+), 21 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cdf1e239790900a9bece4ca7ef2b7bd80f133612 GIT binary patch literal 6148 zcmeHKyG{c^3>-s>NED=`++W}iR#EtZd;kvxr3nE6L6leVU3?njhmcMeBpMntmh9Q} zd3JSEoX-GkdDvV63jlMvBR)J#&7ZqZ?4&YAr1Ok>yyBYi9k-L};|b@U;|>RGupRLq z@Pr*RFK_GT{qAwU&0CHiqpTE=0#ZNOzY%~lhN#qB)5 zMLDb|DoOz#QsA!@_ySEZ7p4FJ literal 0 HcmV?d00001 diff --git a/budget_examples/EulerianVolumeBudgetExample.ipynb b/budget_examples/EulerianVolumeBudgetExample.ipynb index 536d45c..e4e278e 100644 --- a/budget_examples/EulerianVolumeBudgetExample.ipynb +++ b/budget_examples/EulerianVolumeBudgetExample.ipynb @@ -1,5 +1,19 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Computing the Eulerian Volume Budget for an Arbitrary Cell in ECCO V4r4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Load in packages and relevant LLC90 grid information" + ] + }, { "cell_type": "code", "execution_count": 9, @@ -60,6 +74,13 @@ "cell_volumes = get_cell_volumes(area, cell_depths);" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Load in $u, v$, and $w$ from directory" + ] + }, { "cell_type": "code", "execution_count": 27, @@ -68,7 +89,10 @@ "source": [ "#define experimennt\n", "expname = \"iter129_bulkformula\"\n", - "get_data_files(xx, expname) = filter(x -> occursin(\"data\",x),searchdir(diagpath[expname],xx))\n", + "diagnostics_directory = diagpath[expname]\n", + "\n", + "#filter function\n", + "get_data_files(xx, expname) = filter(x -> occursin(\"data\",x),searchdir(diagnostics_directory,xx))\n", "\n", "#define the file names\n", "datafilelist_uvw = get_data_files(\"trsp_3d_set1\", expname);\n", @@ -79,13 +103,20 @@ "u, v, w = extract_eulerian_velocities(diagpath, expname, fnameuvw, γ);" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Compute in $\\nabla_H \\cdot u_H$ and $\\frac{\\partial w}{\\partial z}$ using MeshArrays.jl and ECCOtour.jl" + ] + }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ - "Utrsp, Vtrsp = UVtoTrsp(u, v, Γ, γ)\n", + "Utrsp, Vtrsp = UVtoTrsp(u, v, Γ, γ) #convert velocities to volume fluxes\n", "Wtrsp = w .* area32;\n", "\n", "UV_conv3D = MeshArray(γ,Float32,50);\n", @@ -95,6 +126,13 @@ "calc_W_conv3D!(Wtrsp, W_conv3D) #vertical diffusive converegence\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Select arbitrary grid cell and plot an instantaneous snapshot of the volume budget" + ] + }, { "cell_type": "code", "execution_count": 26, @@ -723,7 +761,7 @@ } ], "source": [ - "select_cell(x) = x[4, 20][110, 45]\n", + "select_cell(x::MeshArray) = x[4, 20][110, 45]\n", "\n", "vars = [select_cell(UV_conv3D), \n", " select_cell(W_conv3D)] \n", diff --git a/budget_examples/HeatBudgetExample copy.ipynb b/budget_examples/HeatBudgetExample copy.ipynb index f62eacb..9bb03fb 100644 --- a/budget_examples/HeatBudgetExample copy.ipynb +++ b/budget_examples/HeatBudgetExample copy.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Computing the Heat Budget for an Arbitrary Cell in ECCO V4r4" + ] + }, { "cell_type": "code", "execution_count": 5, @@ -32,6 +39,13 @@ "include(\"../src/config_exp.jl\");" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Load in packages and relevant LLC90 grid information" + ] + }, { "cell_type": "code", "execution_count": 13, @@ -78,21 +92,11 @@ ] }, { - "cell_type": "code", - "execution_count": 14, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1992.0:0.08333333333333333:2018.0" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [] + "source": [ + "#### Load in $\\theta, \\eta$. Also load in advective and diffusive heat fluxes" + ] }, { "cell_type": "code", @@ -102,7 +106,8 @@ "source": [ "#define experimennt\n", "expname = \"iter129_bulkformula\"\n", - "get_data_files(xx, expname) = filter(x -> occursin(\"data\",x),searchdir(diagpath[expname],xx))\n", + "diagnostic_directory = diagpath[expname] #directory that contains the data\n", + "get_data_files(xx, expname) = filter(x -> occursin(\"data\",x),searchdir(diagnostic_directory,xx))\n", "\n", "#define the file names\n", "datafilelist_H = get_data_files(\"trsp_3d_set2\", expname)\n", @@ -161,6 +166,13 @@ "κzθp1, wθp1 = extract_vertical_heatbudget(diagpath, expname , fnameRp1, γ);" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Compute vertical and horizontal heat convergences" + ] + }, { "cell_type": "code", "execution_count": 44, @@ -189,6 +201,15 @@ "calc_W_conv3D!(κzθp1, κzθ_convp1) #vertical advective converegence" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Select arbitrary grid cell and plot an monthly snapshot of the heat budget. Since we are not using daily snapshots of $\\eta$ and $\\theta$, the RHS and LHS are not guaranteed to balance. \n", + "\n", + "*It is pretty close sometimes though!*" + ] + }, { "cell_type": "code", "execution_count": 45, @@ -1288,7 +1309,7 @@ "vars = vars ./ select_cell(cell_volumes)\n", "push!(vars, select_cell(dθdt))\n", "\n", - "labels = [\"∇ₕ⋅(κ ∇ₕθ)\", \"∇ₕ⋅(uₕθ)\", \"∂(wθ)/∂z\", \"∂(κ(∂θ/∂z))/∂z\", \"GTF\", \"Approx\\ndθ/dt\", \"dθ/dt\"]\n", + "labels = [\"∇ₕ⋅(κ ∇ₕθ)\", \"-∇ₕ⋅(uₕθ)\", \"∂(wθ)/∂z\", \"∂(κ(∂θ/∂z))/∂z\", \"GTF\", \"Approx\\ndθ/dt\", \"dθ/dt\"]\n", "\n", "fig, ax = plt.subplots(figsize = (10, 4))\n", "sns.barplot(x=labels, y=vars, ax = ax)\n", diff --git a/budget_examples/ResidualVolumeBudgetExample.ipynb b/budget_examples/ResidualVolumeBudgetExample.ipynb index f217c9b..9e854b8 100644 --- a/budget_examples/ResidualVolumeBudgetExample.ipynb +++ b/budget_examples/ResidualVolumeBudgetExample.ipynb @@ -1,8 +1,22 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Computing the Eulerian Volume Budget for an Arbitrary Cell in ECCO V4r4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Load in packages and relevant LLC90 grid information" + ] + }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -59,6 +73,13 @@ "cell_volumes = get_cell_volumes(area, cell_depths);" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Load in $u, v$, $w$, $u^*, v^*$, and $w^*$ from directory" + ] + }, { "cell_type": "code", "execution_count": 19, @@ -108,6 +129,13 @@ "wres = w .+ wb" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Compute in $\\nabla_H \\cdot u^{res}_H$ and $\\frac{\\partial w^{res}}{\\partial z}$ using MeshArrays.jl and ECCOtour.jl" + ] + }, { "cell_type": "code", "execution_count": 20, @@ -124,6 +152,13 @@ "calc_W_conv3D!(Wrestrsp, Wres_conv3D) #vertical diffusive converegence" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Select arbitrary grid cell and plot a monthly snapshot of the volume budget" + ] + }, { "cell_type": "code", "execution_count": 21, diff --git a/diagnostic_examples/Interpolations.ipynb b/diagnostic_examples/Interpolations.ipynb index a069ca4..ba0a63f 100644 --- a/diagnostic_examples/Interpolations.ipynb +++ b/diagnostic_examples/Interpolations.ipynb @@ -1,5 +1,19 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Interpolating native ECCO V4r4 onto a $0.5^\\circ$ grid using MeshArrays.jl and ECCOtour.jl" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Load in packages and relevant LLC90 grid information" + ] + }, { "cell_type": "code", "execution_count": 1, @@ -12,7 +26,8 @@ " LaTeXStrings\n", "using PythonCall\n", "import PythonPlot as plt\n", - "# plt.matplotlib.rcParams[\"figure.dpi\"] = 50\n", + "\n", + "plt.matplotlib.rcParams[\"figure.dpi\"] = 50\n", "# plt.pygui(false)\n", "\n", "matplotlib = pyimport(\"matplotlib\")\n", @@ -60,6 +75,13 @@ "Depth = Γ.Depth;" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Plot the depth of each column in ECCO V4r4 (as best we can)" + ] + }, { "cell_type": "code", "execution_count": 19, @@ -80,6 +102,13 @@ "display(fig)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Interpolate onto a regular grid" + ] + }, { "cell_type": "code", "execution_count": 4, @@ -99,6 +128,13 @@ "DD = reshape(DD, size(lon));" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Plot interpolated depths, *looks pretty good*! " + ] + }, { "cell_type": "code", "execution_count": 5,