Skip to content

Commit

Permalink
Merge pull request #65 from MaceKuailv/read-revisit
Browse files Browse the repository at this point in the history
Read revisit
  • Loading branch information
MaceKuailv authored Jun 30, 2023
2 parents b5a36b3 + 3abcebf commit 1a8e7a0
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 216 deletions.
67 changes: 29 additions & 38 deletions docs/notebook/global_ECCO.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -33,15 +32,14 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Loading Dataset\n",
"\n",
"The ECCO MITgcm run is a low-resolution global state estimate. An artifact of note is that this dataset has complex grid topology, which means there is a `face` (also called tile) dimension in the dataset.\n",
"\n",
"A built-in function in `seaduck.utils` can help access the snippet of ECCO that this example is based on."
"A built-in function in `seaduck.utils` can help access the snippet of ECCO that this example is based on. The grid of this dataset is the same as the original dataset, while all other variables are synthetic."
]
},
{
Expand All @@ -55,7 +53,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -75,7 +72,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -114,7 +110,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -134,14 +129,11 @@
"ax = plt.axes(projection=ccrs.PlateCarree())\n",
"ax.plot(x, y, \"ro\", markersize=0.5)\n",
"ax.coastlines()\n",
"# ax.set_xlim([-25, 0])\n",
"# ax.set_ylim([50, 70])\n",
"ax.set_title(\"Interpolation position\")\n",
"plt.show()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -164,7 +156,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -185,7 +176,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": [
Expand All @@ -196,6 +186,15 @@
"Plot the interpolated salinity, $u$, $\\eta$ field."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{warning}\n",
"In case you haven't notice, SALT, ETAN are purely synthetic. \n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -221,7 +220,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -231,7 +229,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -258,7 +255,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -288,11 +284,10 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"There are 4 output times. See also the diagnostic output from running the integration."
"There are 3 output times. See also the diagnostic output from running the integration."
]
},
{
Expand All @@ -305,7 +300,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -322,7 +316,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -340,7 +333,7 @@
"outputs": [],
"source": [
"ax = plt.axes(projection=ccrs.PlateCarree())\n",
"ax.scatter(lon[-1], lat[-1], c=s[-1], s=1)\n",
"ax.scatter(lon[-1], lat[-1], c=s[-1], s=6)\n",
"ax.coastlines()\n",
"ax.set_xlim([-70, 0])\n",
"ax.set_ylim([30, 70])\n",
Expand All @@ -349,7 +342,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -375,15 +367,14 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": [
"mdformat-skip"
]
},
"source": [
"Let's define derivative kernels for $\\partial / \\partial z$, $\\partial^2 / \\partial x^2$, and $\\partial / \\partial t$ as examples:"
"Let's define derivative kernels for $\\partial / \\partial z$, $\\partial^2 / \\partial x^2$, $\\partial^2 / \\partial y^2$, and $\\partial / \\partial t$ as examples:"
]
},
{
Expand All @@ -392,14 +383,13 @@
"metadata": {},
"outputs": [],
"source": [
"default = KnW()\n",
"dz_kernel = KnW(vkernel=\"dz\")\n",
"dx2_kernel = KnW(hkernel=\"dx\", h_order=2, inheritance=None, tkernel=\"linear\")\n",
"dx2_kernel = KnW(hkernel=\"dx\", h_order=2, inheritance=None)\n",
"dy2_kernel = KnW(hkernel=\"dy\", h_order=2, inheritance=None)\n",
"dt_kernel = KnW(tkernel=\"dt\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -412,24 +402,27 @@
"metadata": {},
"outputs": [],
"source": [
"[dsdz, (d2udx2, dvdt)] = sd.OceInterp(\n",
" ecco,\n",
" {\"SALT\": dz_kernel, (\"UVELMASS\", \"VVELMASS\"): (dx2_kernel, dt_kernel)},\n",
" x,\n",
" y,\n",
" z,\n",
" t,\n",
"d2edx2, d2edy2 = sd.OceInterp(\n",
" ecco, [\"ETAN\", \"ETAN\"], x, y, z, t, kernel_list=[dx2_kernel, dy2_kernel]\n",
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Plot one of the differentiated fields on the initial particle positions."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"laplacian = d2edx2 + d2edy2"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -441,12 +434,10 @@
"outputs": [],
"source": [
"ax = plt.axes(projection=ccrs.PlateCarree())\n",
"c = ax.scatter(x, y, c=d2udx2)\n",
"c = ax.scatter(x, y, c=laplacian, s=5)\n",
"ax.coastlines()\n",
"ax.set_xlim([-25, 0])\n",
"ax.set_ylim([50, 70])\n",
"plt.colorbar(c, location=\"bottom\", label=\"m/s per grid scale squared\")\n",
"plt.title(\"Second Derivative of the Zonal Velocity\")\n",
"plt.title(\"Laplacian of sea surface height\")\n",
"plt.show()"
]
}
Expand All @@ -468,7 +459,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 1a8e7a0

Please sign in to comment.