diff --git a/Cartopy/cartopy-favicon.ipynb b/Cartopy/cartopy-favicon.ipynb index 66ae826..6417a2a 100644 --- a/Cartopy/cartopy-favicon.ipynb +++ b/Cartopy/cartopy-favicon.ipynb @@ -28,30 +28,12 @@ "\n", " ax.coastlines()\n", " ax.gridlines()\n", + " ax.stock_img()\n", "\n", - " im = ax.stock_img()\n", - "\n", - " def on_draw(event=None):\n", - " \"\"\"\n", - " Hook into matplotlib's event mechanism to define the clip path of the\n", - " background image.\n", - "\n", - " \"\"\"\n", - " # Clip the image to the current background boundary.\n", - " im.set_clip_path(ax.background_patch.get_path(),\n", - " transform=ax.background_patch.get_transform())\n", - "\n", - " # Register the on_draw method and call it once now.\n", - " fig.canvas.mpl_connect('draw_event', on_draw)\n", - " on_draw()\n", - "\n", - " # Generate a matplotlib path representing the character \"C\".\n", - " fp = FontProperties(family='Bitstream Vera Sans', weight='bold')\n", + " # Generate a matplotlib path representing the character "C".\n", + " fp = FontProperties(family='DejaVu Sans', weight='bold')\n", " logo_path = matplotlib.textpath.TextPath((-4.5e7, -3.7e7),\n", - " 'C', size=1, prop=fp)\n", - "\n", - " # Scale the letter up to an appropriate X and Y scale.\n", - " logo_path._vertices *= np.array([103250000, 103250000])\n", + " 'C', size=103250000, prop=fp)\n", "\n", " # Add the path as a patch, drawing black outlines around the text.\n", " patch = matplotlib.patches.PathPatch(logo_path, facecolor='white',\n", @@ -59,6 +41,7 @@ " transform=ccrs.SouthPolarStereo())\n", " ax.add_patch(patch)\n", " plt.show()\n", + "\n", "\n" ] }, diff --git a/Cartopy/cartopy-feature-creation.ipynb b/Cartopy/cartopy-feature-creation.ipynb index d7c0644..5d00802 100644 --- a/Cartopy/cartopy-feature-creation.ipynb +++ b/Cartopy/cartopy-feature-creation.ipynb @@ -61,9 +61,9 @@ "\n", " # Add a text annotation for the license information to the\n", " # the bottom right corner.\n", - " text = AnchoredText(r'$\\mathcircled{{c}}$ {}; license: {}'\n", + " text = AnchoredText(r'(c) {}; license: {}'\n", " ''.format(SOURCE, LICENSE),\n", - " loc=4, prop={'size': 12}, frameon=True)\n", + " loc=4, prop={'size': 10}, frameon=True)\n", " ax.add_artist(text)\n", "\n", " plt.show()" diff --git a/Cartopy/cartopy-logo.ipynb b/Cartopy/cartopy-logo.ipynb index 1324b34..722fbd4 100644 --- a/Cartopy/cartopy-logo.ipynb +++ b/Cartopy/cartopy-logo.ipynb @@ -21,35 +21,35 @@ "outputs": [], "source": [ "\n", - "def main():\n", " fig = plt.figure(figsize=[12, 6])\n", - " ax = fig.add_subplot(1, 1, 1, projection=ccrs.Robinson())\n", - "\n", - " ax.coastlines()\n", + " ax = fig.add_subplot(1, 1, 1, projection=ccrs.Robinson())\n", + " \n", + " ax.coastlines()\n", " ax.gridlines()\n", - "\n", - " # generate a matplotlib path representing the word \"cartopy\"\n", - " fp = FontProperties(family='Bitstream Vera Sans', weight='bold')\n", - " logo_path = matplotlib.textpath.TextPath((-175, -35), 'cartopy',\n", - " size=1, prop=fp)\n", - " # scale the letters up to sensible longitude and latitude sizes\n", - " logo_path._vertices *= np.array([80, 160])\n", - "\n", - " # add a background image\n", - " im = ax.stock_img()\n", - " # clip the image according to the logo_path. mpl v1.2.0 does not support\n", - " # the transform API that cartopy makes use of, so we have to convert the\n", - " # projection into a transform manually\n", - " plate_carree_transform = ccrs.PlateCarree()._as_mpl_transform(ax)\n", - " im.set_clip_path(logo_path, transform=plate_carree_transform)\n", - "\n", - " # add the path as a patch, drawing black outlines around the text\n", - " patch = matplotlib.patches.PathPatch(logo_path,\n", - " facecolor='none', edgecolor='black',\n", - " transform=ccrs.PlateCarree())\n", - " ax.add_patch(patch)\n", - "\n", - " plt.show()\n" + " \n", + " # generate a matplotlib path representing the word "cartopy"\n", + " fp = FontProperties(family='DejaVu Sans', weight='bold')\n", + " logo_path = matplotlib.textpath.TextPath((-175, -35), 'cartopy',\n", + " size=80, prop=fp)\n", + " # scale the letters up to sensible longitude and latitude sizes\n", + " transform = matplotlib.transforms.Affine2D().scale(1, 2).translate(0, 35)\n", + " \n", + " # add a background image\n", + " im = ax.stock_img()\n", + " # Apply the scale transform and then the map coordinate transform\n", + " plate_carree_transform = (transform +\n", + " ccrs.PlateCarree()._as_mpl_transform(ax))\n", + " \n", + " # add the path as a patch, drawing black outlines around the text\n", + " patch = matplotlib.patches.PathPatch(logo_path,\n", + " facecolor='none', edgecolor='black',\n", + " transform=plate_carree_transform)\n", + " im.set_clip_path(patch)\n", + " ax.add_patch(patch)\n", + " \n", + " plt.show()\n", + " \n", + "\n" ] }, { diff --git a/Cartopy/cartopy-quiver.ipynb b/Cartopy/cartopy-quiver.ipynb index dfeda60..e7f1aa2 100644 --- a/Cartopy/cartopy-quiver.ipynb +++ b/Cartopy/cartopy-quiver.ipynb @@ -16,13 +16,6 @@ "import cartopy.crs as ccrs" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### http://scitools.org.uk/iris/docs/v1.9.0/html/gallery.html" - ] - }, { "cell_type": "code", "execution_count": 2, diff --git a/Cartopy/cartopy-shapely-katrina.ipynb b/Cartopy/cartopy-shapely-katrina.ipynb index a6f2afb..3599743 100644 --- a/Cartopy/cartopy-shapely-katrina.ipynb +++ b/Cartopy/cartopy-shapely-katrina.ipynb @@ -56,7 +56,7 @@ "\n", " ax.set_extent([-125, -66.5, 20, 50], ccrs.Geodetic())\n", "\n", - " shapename = 'admin_1_states_provinces_lakes_shp'\n", + " shapename = 'admin_1_states_provinces_lakes'\n", " states_shp = shpreader.natural_earth(resolution='110m',\n", " category='cultural', name=shapename)\n", "\n", diff --git a/Cartopy/cartopy-streamplot.ipynb b/Cartopy/cartopy-streamplot.ipynb deleted file mode 100644 index a936936..0000000 --- a/Cartopy/cartopy-streamplot.ipynb +++ /dev/null @@ -1,72 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "\n", - "import cartopy.crs as ccrs\n", - "from cartopy.examples.arrows import sample_data\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def main():\n", - " fig = plt.figure(figsize=(10, 5))\n", - " ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())\n", - " ax.set_extent([-90, 75, 10, 85], crs=ccrs.PlateCarree())\n", - " ax.coastlines()\n", - "\n", - " x, y, u, v, vector_crs = sample_data(shape=(80, 100))\n", - " magnitude = (u ** 2 + v ** 2) ** 0.5\n", - " ax.streamplot(x, y, u, v, transform=vector_crs,\n", - " linewidth=2, density=2, color=magnitude)\n", - " plt.show()\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "main()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/Cartopy/cartopy-un-flag.ipynb b/Cartopy/cartopy-un-flag.ipynb index 383d0b8..1b85c24 100644 --- a/Cartopy/cartopy-un-flag.ipynb +++ b/Cartopy/cartopy-un-flag.ipynb @@ -123,8 +123,10 @@ " ax = fig.add_axes([0.25, 0.24, 0.5, 0.54], projection=az_eq)\n", "\n", " # The background patch and outline patch are not needed in this example.\n", - " ax.background_patch.set_facecolor('none')\n", - " ax.outline_patch.set_edgecolor('none')\n", + " ax.patch.set_facecolor('none')\n", + " # The Axes frame produces the outer meridian line.\n", + " for spine in ax.spines.values():\n", + " spine.update({'edgecolor': 'white', 'linewidth': 2})\n", "\n", " # We want the map to go down to -60 degrees latitude.\n", " ax.set_extent([-180, 180, -60, 90], ccrs.PlateCarree())\n", diff --git a/README.md b/README.md index e1c5758..0f3f3cc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ### OSGeoLive Notebook Gallery ### -[logo]: http://live.osgeo.org/_images/banner.png "OSGeoLive" +[logo]: https://live.osgeo.org/_images/banner.png "OSGeoLive" -This directory hosts a set of **[Jupyter Notebooks](https://jupyter.org/)** that demonstrate the *Open Source Geospatial Tools* capabilities on **[OSGeoLive](http://live.osgeo.org/en/index.html)**. +This directory hosts a set of **[Jupyter Notebooks](https://jupyter.org/)** that demonstrate the *Open Source Geospatial Tools* capabilities on **[OSGeoLive](https://live.osgeo.org/en/index.html)**. To start the *Jupyter* server on *OSGeoLive*, use the menu item *Geospatial -> Spatial Tools -> Jupyter Notebook*. diff --git a/Running the Notebook Server.ipynb b/Running the Notebook Server.ipynb index 7399258..0d68130 100644 --- a/Running the Notebook Server.ipynb +++ b/Running the Notebook Server.ipynb @@ -11,14 +11,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The IPython notebook server is a custom web server that runs the notebook web application. Most of the time, users run the notebook server on their local computer using IPython's command line interface." + "The Jupyter notebook server runs Notebooks on the web." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Starting the notebook server using the command line" + "## Starting a notebook server using the command line" ] }, { @@ -27,7 +27,7 @@ "source": [ "You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n", "\n", - " ipython notebook\n", + " jupyter notebook\n", "\n", "This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n", "\n", @@ -37,18 +37,18 @@ "\n", "You can also specify the port manually:\n", "\n", - " ipython notebook --port 9999\n", + " jupyter notebook --port 8883\n", "\n", "Or start notebook server without opening a web browser.\n", "\n", - " ipython notebook --no-browser\n", + " jupyter notebook --no-browser\n", "\n", "The notebook server has a number of other command line arguments that can be displayed with the `--help` flag: \n", "\n", - " ipython notebook --help\n", + " jupyter notebook --help\n", "\n", "
--pylab inline
from the command line. This is deprecated in IPython 2.0 and will be removed in IPython 3.0. To enable matplotlib based plotting for the Python kernel use the %matplotlib
magic command.\n",
+ " \n",
"