Skip to content

Commit

Permalink
adding descriptions to all notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-meza committed Jul 6, 2024
1 parent a26559f commit acb2f5a
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 21 deletions.
Binary file added .DS_Store
Binary file not shown.
44 changes: 41 additions & 3 deletions budget_examples/EulerianVolumeBudgetExample.ipynb
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
53 changes: 37 additions & 16 deletions budget_examples/HeatBudgetExample copy.ipynb
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
37 changes: 36 additions & 1 deletion budget_examples/ResidualVolumeBudgetExample.ipynb
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
38 changes: 37 additions & 1 deletion diagnostic_examples/Interpolations.ipynb
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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",
Expand Down Expand Up @@ -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,
Expand All @@ -80,6 +102,13 @@
"display(fig)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Interpolate onto a regular grid"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand All @@ -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,
Expand Down

0 comments on commit acb2f5a

Please sign in to comment.