Skip to content

Commit

Permalink
deploy: 14f5059
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc2 committed Apr 5, 2024
1 parent d2a66de commit ad8a9fc
Show file tree
Hide file tree
Showing 11 changed files with 786 additions and 3,339 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

121 changes: 5 additions & 116 deletions _preview/11/_sources/notebooks/03-uxarray-vis/03-polygons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@
"execution_count": null,
"outputs": [],
"source": [
"fig_size = 400\n",
"plot_kwargs = {\"backend\": \"matplotlib\",\n",
" \"aspect\": 2,\n",
" \"fig_size\": 250}"
" \"fig_size\": fig_size}"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -232,7 +233,7 @@
"outputs": [],
"source": [
"(uxds_mpas[\"bottomDepth\"].plot.rasterize(xlim=(-20, 0), ylim=(-5, 5), pixel_ratio=2.0, **plot_kwargs) +\n",
"uxds_mpas[\"bottomDepth\"].plot.rasterize(xlim=(-20, 0), ylim=(-5, 5), pixel_ratio=4.0, **plot_kwargs)).opts(fig_size=250)"
"uxds_mpas[\"bottomDepth\"].plot.rasterize(xlim=(-20, 0), ylim=(-5, 5), pixel_ratio=4.0, **plot_kwargs)).opts(fig_size=fig_size).cols(1)"
],
"metadata": {
"collapsed": false
Expand All @@ -258,7 +259,7 @@
"outputs": [],
"source": [
"(uxds_mpas[\"bottomDepth\"].plot.polygons(xlim=(-185, -175), ylim=(-5, 5), exclude_antimeridian=False, **plot_kwargs) +\n",
"uxds_mpas[\"bottomDepth\"].plot.polygons(xlim=(175, 185), ylim=(-5, 5), exclude_antimeridian=False, **plot_kwargs)).opts(fig_size=250)"
"uxds_mpas[\"bottomDepth\"].plot.polygons(xlim=(175, 185), ylim=(-5, 5), exclude_antimeridian=False, **plot_kwargs)).opts(fig_size=fig_size).cols(1)"
],
"metadata": {
"collapsed": false
Expand All @@ -270,7 +271,7 @@
"outputs": [],
"source": [
"(uxds_mpas[\"bottomDepth\"].plot.polygons(xlim=(-185, -175), ylim=(-5, 5), exclude_antimeridian=True, **plot_kwargs) +\n",
"uxds_mpas[\"bottomDepth\"].plot.polygons(xlim=(175, 185), ylim=(-5, 5), exclude_antimeridian=True, **plot_kwargs)).opts(fig_size=250)"
"uxds_mpas[\"bottomDepth\"].plot.polygons(xlim=(175, 185), ylim=(-5, 5), exclude_antimeridian=True, **plot_kwargs)).opts(fig_size=fig_size).cols(1)"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -387,118 +388,6 @@
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"uxds_mpas[\"bottomDepth\"].plot.polygons(width=900, height=400)"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"uxds_geoflow[\"v1\"].nodal_average()[0][0].plot.polygons(\n",
" cmap=\"coolwarm\", width=900, height=400\n",
")"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"source": [
":::{attention}\n",
"\n",
":::\n",
"\n",
"<div class=\"admonition alert alert-warning\">\n",
" <p class=\"admonition-title\" style=\"font-weight:bold\">Attention!</p>\n",
" For moderately to high resolution grids, it's not recommended to directly plot polygons. <br>\n",
" Plotting each polygon is extremely computationally expensive to render and may not provide the most visually-appealing plots.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"source": [
"## Rasterized Polygon Plots\n",
"\n",
"Instead of plotting the geometry of each polygon directly, we can rasterize our set of polygons to obtain a raster plot.\n",
"\n",
"<div class=\"admonition alert alert-info\">\n",
" <p class=\"admonition-title\" style=\"font-weight:bold\">Hint</p>\n",
" A raster plot of any set of geometric elements (in this case Polygons) renders each data into a regularly shaped array as opposed to rendering each\n",
" shape directly.\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": [
"uxds_mpas[\"bottomDepth\"].plot.rasterize(method=\"polygon\", width=900, height=400)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": [
"uxds_geoflow[\"v1\"].nodal_average()[0][0].plot.rasterize(\n",
" method=\"polygon\", cmap=\"coolwarm\", width=900, height=400\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"source": [
"You can select whether to include or exclude these antimeridian polygons by using the `exclude_antimeridian` parameter. \n",
"\n",
"<div class=\"admonition alert alert-warning\">\n",
" <p class=\"admonition-title\" style=\"font-weight:bold\">Attention!</p>\n",
" For larger, higher-resolution, grids, it's suggested to keep `exclude_antimeridian=True` to decrease the time needed to process the grid for\n",
" visualization.\n",
"</div>"
]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ <h2>Structured Grids<a class="headerlink" href="#structured-grids" title="Link t
warnings.warn(f&#39;Downloading: {url}&#39;, DownloadWarning)
</pre></div>
</div>
<img alt="../../_images/c1a63bf430c34a612fe4af23b2824805b102757be3c22081d319c1a5be8af258.png" src="../../_images/c1a63bf430c34a612fe4af23b2824805b102757be3c22081d319c1a5be8af258.png" />
<img alt="../../_images/1b796ff42a875abbb0b4b3e493ab2e49cf39db685d1ff85baf66bc424887ed09.png" src="../../_images/1b796ff42a875abbb0b4b3e493ab2e49cf39db685d1ff85baf66bc424887ed09.png" />
</div>
</div>
</section>
Expand Down
16 changes: 8 additions & 8 deletions _preview/11/notebooks/01-intro/02-data-structures.html

Large diffs are not rendered by default.

Loading

0 comments on commit ad8a9fc

Please sign in to comment.