Skip to content

Commit

Permalink
add markdown for mpas-ocean
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc2 committed Jan 9, 2025
1 parent a7f0f7d commit 8e45ea8
Showing 1 changed file with 92 additions and 18 deletions.
110 changes: 92 additions & 18 deletions notebooks/04-recipes/mpas-ocean.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,24 @@
"cell_type": "code",
"id": "357ab34065819766",
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-19T05:14:32.248315Z",
"start_time": "2024-12-19T05:14:32.245410Z"
"jupyter": {
"is_executing": true
}
},
"source": [
"import cartopy.crs as ccrs\n",
"import uxarray as ux"
],
"outputs": [],
"execution_count": 5
"execution_count": null
},
{
"cell_type": "code",
"id": "c7be08740dfdd82e",
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-19T05:14:36.403235Z",
"start_time": "2024-12-19T05:14:36.339956Z"
"end_time": "2025-01-09T03:10:04.270173400Z",
"start_time": "2025-01-09T03:00:50.480335Z"
}
},
"source": [
Expand All @@ -65,27 +64,91 @@
"uxds = ux.open_dataset(grid_path, data_path)"
],
"outputs": [],
"execution_count": 7
"execution_count": 3
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"## Data Preparation\n",
"\n",
"### Global Ocean Data\n",
"The global MPAS-Ocean grid data requires no preprocessing for our visualization purposes, as it already encompasses the complete global domain."
],
"id": "8aa88b99936f899e"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-09T03:10:04.271091100Z",
"start_time": "2025-01-09T03:01:25.182149Z"
}
},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"bottom_depth = uxds[\"bottomDepth\"]"
"bottom_depth = uxds[\"bottomDepth\"]\n",
"bottom_depth.uxgrid.n_face"
],
"id": "ba611c00ef6a807d",
"outputs": [
{
"data": {
"text/plain": [
"28571"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"id": "ba611c00ef6a807d"
"execution_count": 7
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"### Regional Focus: Gulf of Mexico\n",
"To create a detailed regional visualization of the Gulf of Mexico, we'll perform a spatial subset of our global data. By applying a bounding circle operation centered at 90°W longitude and 25°N latitude with a 9-degree radius, we can focus our analysis specifically on the Gulf region. This subsetting approach significantly reduces the computational demands of our visualization routines.\n"
],
"id": "90086bf0ad76610b"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-09T03:10:04.271091100Z",
"start_time": "2025-01-09T03:01:19.669574Z"
}
},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"bottom_depth_gulf = bottom_depth.subset.bounding_circle((-90.0, 25.0), r=9)"
"bottom_depth_gulf = bottom_depth.subset.bounding_circle((-90.0, 25.0), r=9)\n",
"bottom_depth_gulf.uxgrid.n_face"
],
"id": "6376a47b3269f2bf",
"outputs": [
{
"data": {
"text/plain": [
"165"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 6
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"## Global Ocean Depth Visualization\n",
"\n",
"For our global visualization, we selected the Robinson projection combined with raster plotting to effectively display worldwide ocean depth data. The 4.0 pixel ratio setting ensures clear resolution while maintaining efficient performance across the entire global domain."
],
"id": "6376a47b3269f2bf"
"id": "62d1b6ea6613a169"
},
{
"cell_type": "code",
Expand All @@ -97,12 +160,13 @@
"width": 100
},
"ExecuteTime": {
"end_time": "2024-12-19T05:14:44.208444Z",
"end_time": "2025-01-09T03:10:04.271091100Z",
"start_time": "2024-12-19T05:14:36.596902Z"
}
},
"source": [
"bottom_depth.plot(\n",
"bottom_depth.plot.polygons(\n",
" rasterize=True,\n",
" backend=\"matplotlib\",\n",
" projection=ccrs.Robinson(),\n",
" coastline=\"110m\",\n",
Expand Down Expand Up @@ -133,6 +197,16 @@
],
"execution_count": 8
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"## Regional Visualization: Gulf of Mexico\n",
"\n",
"For our detailed analysis of the Gulf of Mexico region, we transition to a vector-based polygon visualization approach. This shift from our global visualization strategy is driven by the reduced computational demands of our regional subset, which contains only 164 faces. Vector polygons offer several advantages at this scale, including precise boundary representation and enhanced detail visualization.\n"
],
"id": "89eeb54318549aa2"
},
{
"cell_type": "code",
"id": "6d70f1f4-12bc-4c91-a49c-cbaed203ca1a",
Expand All @@ -143,7 +217,7 @@
"width": 100
},
"ExecuteTime": {
"end_time": "2024-12-19T05:14:56.829068Z",
"end_time": "2025-01-09T03:10:04.272090600Z",
"start_time": "2024-12-19T05:14:56.111652Z"
}
},
Expand Down

0 comments on commit 8e45ea8

Please sign in to comment.