From f3e496b87baec7c75700be6d841c3f53ef9f823d Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 09:56:56 +0200 Subject: [PATCH 01/51] Add basic code for tutorial showing the 'panel' --- .../tutorials/advanced/panel_extension.py | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100755 examples/tutorials/advanced/panel_extension.py diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py new file mode 100755 index 00000000000..c272cd0f446 --- /dev/null +++ b/examples/tutorials/advanced/panel_extension.py @@ -0,0 +1,113 @@ +r""" +Dynamic data visualization using `Panel` +======================================== +*Please run the following code examples in a notebook enviorement, e.g., +Jupyter notebook, otherwise the interactive parts of this tutorial do +not work* + +The library [`Panel`](https://panel.holoviz.org/index.html) can be used to +create interacitve dashboards by connecting user-defined widgets to plots. +`Panel` can be used as an extension to Jupyter notebook / lab. + +TODO +""" + +# sphinx_gallery_thumbnail_number = 3 + + +# Import the requiered packages +import numpy as np +import panel as pn +import pygmt + +pn.extension() + + +############################################################################### +# Make a static map +# ----------------- + +# Create figure instance +fig = pygmt.Figure() +fig.coast( + projection="G30/15/10c", # Orthographic projection + region="g", # global + frame="g30", # Add gridlines in steps of 30 degrees on top + land="gray", + water="lightblue", + shorelines="1/0.25p,gray50", +) +fig.show() + + +############################################################################### +# Make a dynamic map +# ------------------ +# Vary the central longitude used for the Orthographic projection to create +# a rotation of the Earth around the vertical axis. + +# Create a slider +slider_lon = pn.widgets.DiscreteSlider( + name="Central longitude", + options=list(np.arange(0, 361, 10)), + value=0, +) + +# Define a function for plotting the single slices +@pn.depends(central_lon=slider_lon) +def view(central_lon): + # Create figure instance + fig = pygmt.Figure() + fig.coast( + # Vary the central longitude used for the Orthographic projection + projection="G" + str(central_lon) + "/15/12c", + region="g", + frame="g30", # Add gridlines in steps of 30 degrees on top + land="gray", + water="lightblue", + shorelines="1/0.25p,gray50", + ) + return fig + +# Make an interactive dashboard +pn.Column(slider_lon, view) + + +############################################################################### +# Add a grid +# ---------- + +# Download grid for Earth relief +grd_relief = pygmt.datasets.load_earth_relief(resolution="10m") + +# Create a slider +slider_lon = pn.widgets.DiscreteSlider( + name="Central longitude", + options=list(np.arange(0, 361, 10)), + value=0, +) + +# Define a function for plotting the single slices +@pn.depends(central_lon=slider_lon) +def view(central_lon): + # Create figure instance + fig = pygmt.Figure() + # Set up a colormap for the elevation + pygmt.makecpt( + cmap="oleron", + series=[int(np.min(grd_relief)), int(np.max(grd_relief))+1, 100], + ) + # Plot the grid for the elevation + fig.grdimage( + projection="G" + str(central_lon) + "/15/12c", + region="g", + grid=grd_relief, # Use gird downloaded above + cmap=True, # Use colormap defined above + frame="g30", # Add gridlines in steps of 30 degrees on top + ) + # Add a colorbar for the elevation + fig.colorbar(frame=["a2000f1000", "x+lElevation", "y+lm"]) + return fig + +# Make an interactive dashboard +pn.Column(slider_lon, view) From 8e0e0dd18352931bda805308f2898e163cf1e6d2 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 10:11:58 +0200 Subject: [PATCH 02/51] Remove section 'Add a grid' --- .../tutorials/advanced/panel_extension.py | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index c272cd0f446..3344012d092 100755 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -71,43 +71,3 @@ def view(central_lon): # Make an interactive dashboard pn.Column(slider_lon, view) - - -############################################################################### -# Add a grid -# ---------- - -# Download grid for Earth relief -grd_relief = pygmt.datasets.load_earth_relief(resolution="10m") - -# Create a slider -slider_lon = pn.widgets.DiscreteSlider( - name="Central longitude", - options=list(np.arange(0, 361, 10)), - value=0, -) - -# Define a function for plotting the single slices -@pn.depends(central_lon=slider_lon) -def view(central_lon): - # Create figure instance - fig = pygmt.Figure() - # Set up a colormap for the elevation - pygmt.makecpt( - cmap="oleron", - series=[int(np.min(grd_relief)), int(np.max(grd_relief))+1, 100], - ) - # Plot the grid for the elevation - fig.grdimage( - projection="G" + str(central_lon) + "/15/12c", - region="g", - grid=grd_relief, # Use gird downloaded above - cmap=True, # Use colormap defined above - frame="g30", # Add gridlines in steps of 30 degrees on top - ) - # Add a colorbar for the elevation - fig.colorbar(frame=["a2000f1000", "x+lElevation", "y+lm"]) - return fig - -# Make an interactive dashboard -pn.Column(slider_lon, view) From 9274b855c0afbbe3084f0eee8f975ff2bce3c9e2 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 10:20:20 +0200 Subject: [PATCH 03/51] Fix code style - add blank line --- examples/tutorials/advanced/panel_extension.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 3344012d092..fb085a16536 100755 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -69,5 +69,6 @@ def view(central_lon): ) return fig + # Make an interactive dashboard pn.Column(slider_lon, view) From 013351280d8c103b6fd70084a8b20582c1649e09 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Sun, 16 Apr 2023 08:23:22 +0000 Subject: [PATCH 04/51] [format-command] fixes --- examples/tutorials/advanced/panel_extension.py | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 100644 examples/tutorials/advanced/panel_extension.py diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py old mode 100755 new mode 100644 index fb085a16536..7da6ca2f613 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -53,6 +53,7 @@ value=0, ) + # Define a function for plotting the single slices @pn.depends(central_lon=slider_lon) def view(central_lon): From d55d7cf77e83ccdfd0462d89b5b6284a93df696e Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 10:56:39 +0200 Subject: [PATCH 05/51] Adjust thumbnail_number --- examples/tutorials/advanced/panel_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 7da6ca2f613..15f216ad327 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -12,7 +12,7 @@ TODO """ -# sphinx_gallery_thumbnail_number = 3 +# sphinx_gallery_thumbnail_number = 2 # Import the requiered packages From dccdf74e6e0c065ddae04081520a1abf2c72d3ed Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 11:25:24 +0200 Subject: [PATCH 06/51] Add 'panel' as a dependency --- environment.yml | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index 3c3abbf1374..ccc05768413 100644 --- a/environment.yml +++ b/environment.yml @@ -15,6 +15,7 @@ dependencies: - contextily - geopandas - ipython + - panel - rioxarray # Development dependencies (general) - build diff --git a/pyproject.toml b/pyproject.toml index 247c2dc9087..ab6e9459b15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ all = [ "contextily", "geopandas", "ipython", + "panel", "rioxarray", ] From fdf180e63380b265d2d31c639e787a8a876e968d Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 19:05:37 +0200 Subject: [PATCH 07/51] Add 'panel' as dependency --- ci/requirements/docs.yml | 1 + doc/conf.py | 1 + doc/install.rst | 1 + 3 files changed, 3 insertions(+) diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index f623b310bc1..361b656544b 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -14,6 +14,7 @@ dependencies: # Optional dependencies - contextily - geopandas + - panel - rioxarray # Development dependencies (general) - build diff --git a/doc/conf.py b/doc/conf.py index 6c356c0fe2e..245342c1bff 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -59,6 +59,7 @@ "numpy": ("https://numpy.org/doc/stable/", None), "python": ("https://docs.python.org/3/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), + "panel": ("https://panel.holoviz.org/index.html", None) "rasterio": ("https://rasterio.readthedocs.io/en/stable/", None), "rioxarray": ("https://corteva.github.io/rioxarray/stable/", None), "xarray": ("https://docs.xarray.dev/en/stable/", None), diff --git a/doc/install.rst b/doc/install.rst index 3746969cd3b..771ab751403 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -108,6 +108,7 @@ The following are optional dependencies: * `IPython `__: For embedding the figures in Jupyter notebooks (recommended). * `Contextily `__: For retrieving tile maps from the internet. * `GeoPandas `__: For using and plotting GeoDataFrame objects. +* `Panel `__: For creating interactive dashboards. * `RioXarray `__: For saving multi-band rasters to GeoTIFFs. Installing GMT and other dependencies From 8a50bdec0d668172b801275d612d52506ea242fc Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 19:07:23 +0200 Subject: [PATCH 08/51] Fix typos --- examples/tutorials/advanced/panel_extension.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 15f216ad327..d52b42361de 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -1,12 +1,12 @@ r""" Dynamic data visualization using `Panel` ======================================== -*Please run the following code examples in a notebook enviorement, e.g., +*Please run the following code examples in a notebook environment, e.g., Jupyter notebook, otherwise the interactive parts of this tutorial do not work* The library [`Panel`](https://panel.holoviz.org/index.html) can be used to -create interacitve dashboards by connecting user-defined widgets to plots. +create interactive dashboards by connecting user-defined widgets to plots. `Panel` can be used as an extension to Jupyter notebook / lab. TODO From b548efa0b21ac26c6ac3158a931cbd8d98b69845 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 19:09:20 +0200 Subject: [PATCH 09/51] Add missing comma --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 245342c1bff..0914b1b5e1b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -59,7 +59,7 @@ "numpy": ("https://numpy.org/doc/stable/", None), "python": ("https://docs.python.org/3/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), - "panel": ("https://panel.holoviz.org/index.html", None) + "panel": ("https://panel.holoviz.org/index.html", None), "rasterio": ("https://rasterio.readthedocs.io/en/stable/", None), "rioxarray": ("https://corteva.github.io/rioxarray/stable/", None), "xarray": ("https://docs.xarray.dev/en/stable/", None), From c5d3e82ffc7245b24b7baa85c5fbc8b3442e4370 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 19:26:47 +0200 Subject: [PATCH 10/51] Fix highlighting --- examples/tutorials/advanced/panel_extension.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index d52b42361de..c8641e1f87a 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -1,13 +1,13 @@ r""" -Dynamic data visualization using `Panel` -======================================== +Dynamic data visualization using ``Panel`` +========================================== *Please run the following code examples in a notebook environment, e.g., Jupyter notebook, otherwise the interactive parts of this tutorial do not work* -The library [`Panel`](https://panel.holoviz.org/index.html) can be used to +The library [``Panel``](https://panel.holoviz.org/index.html) can be used to create interactive dashboards by connecting user-defined widgets to plots. -`Panel` can be used as an extension to Jupyter notebook / lab. +``Panel`` can be used as an extension to Jupyter notebook / lab. TODO """ From 51496552dd9913ba3a6f7f4aa974cf32f1afbb3a Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 19:30:57 +0200 Subject: [PATCH 11/51] Fix link --- examples/tutorials/advanced/panel_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index c8641e1f87a..f89c1fb7f08 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -5,7 +5,7 @@ Jupyter notebook, otherwise the interactive parts of this tutorial do not work* -The library [``Panel``](https://panel.holoviz.org/index.html) can be used to +The library ``Panel`` (https://panel.holoviz.org/index.html) can be used to create interactive dashboards by connecting user-defined widgets to plots. ``Panel`` can be used as an extension to Jupyter notebook / lab. From 28a72df6b53794bfe9ee3c8cdbce8db7ac80e598 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 20:08:05 +0200 Subject: [PATCH 12/51] Improve docs --- examples/tutorials/advanced/panel_extension.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index f89c1fb7f08..8d2ca37389b 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -1,9 +1,10 @@ r""" Dynamic data visualization using ``Panel`` ========================================== -*Please run the following code examples in a notebook environment, e.g., -Jupyter notebook, otherwise the interactive parts of this tutorial do -not work* +*Please run the following code examples in a notebook environment otherwise +the interactive parts of this tutorial will not work. You can use the button +"Download Jupyter notebook: panel_extension.ipynb" at the bottom of this page +to download this script as a Jupyter notebook.* The library ``Panel`` (https://panel.holoviz.org/index.html) can be used to create interactive dashboards by connecting user-defined widgets to plots. From bde882b4f4d01b61e91c52e10218721a47524447 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 20:13:43 +0200 Subject: [PATCH 13/51] Add more docs --- examples/tutorials/advanced/panel_extension.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 8d2ca37389b..12c80f210c1 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -10,7 +10,10 @@ create interactive dashboards by connecting user-defined widgets to plots. ``Panel`` can be used as an extension to Jupyter notebook / lab. -TODO +This tutorial is split into three parts: +- Make a static map +- Make a dynamic map +- Add a grid for the Earth relief """ # sphinx_gallery_thumbnail_number = 2 From 3919f03bc8a1614abd270c03ff54768e756717a2 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 20:17:04 +0200 Subject: [PATCH 14/51] Adjust thubnail_number --- examples/tutorials/advanced/panel_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 12c80f210c1..14f9450c893 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -16,7 +16,7 @@ - Add a grid for the Earth relief """ -# sphinx_gallery_thumbnail_number = 2 +# sphinx_gallery_thumbnail_number = 1 # Import the requiered packages From b046aac448381cee403b7d2ac50cbaf64eaab810 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 20:35:07 +0200 Subject: [PATCH 15/51] Add code for third part (add grid) --- .../tutorials/advanced/panel_extension.py | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 14f9450c893..9bd5c69d048 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -13,7 +13,7 @@ This tutorial is split into three parts: - Make a static map - Make a dynamic map -- Add a grid for the Earth relief +- Add a grid for Earth relief """ # sphinx_gallery_thumbnail_number = 1 @@ -77,3 +77,46 @@ def view(central_lon): # Make an interactive dashboard pn.Column(slider_lon, view) + + +############################################################################### +# Add a grid for Earth relief +# --------------------------- + +# Download a grid for Earth relief +grd_relief = pygmt.datasets.load_earth_relief(resolution="10m") + +# Create a slider +slider_lon = pn.widgets.DiscreteSlider( + name="Central longitude", + options=list(np.arange(0, 361, 10)), + value=0, +) + + +# Define a function for plotting the single slices +@pn.depends(central_lon=slider_lon) +def view(central_lon): + # Create figure instance + fig = pygmt.Figure() + # Set up a colormap for the elevation + pygmt.makecpt( + cmap="oleron", + series=[int(np.min(grd_relief)), int(np.max(grd_relief))+1, 100], + ) + # Plot the grid for the elevation + fig.grdimage( + projection="G" + str(central_lon) + "/15/12c", + region="g", + grid=grd_relief, # Use gird downloaded above + cmap=True, # Use colormap defined above + frame="g30", # Add gridlines in steps of 30 degrees on top + ) + # Add a colorbar for the elevation + fig.colorbar(frame=["a2000f1000", "x+lElevation", "y+lm"]) + return fig + + +# Make an interactive dashboard +pn.Column(slider_lon, view) + From c9b213ec77d4303c88a6d3790ffc033fdeaaec1b Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 20:38:54 +0200 Subject: [PATCH 16/51] Fix coding style --- examples/tutorials/advanced/panel_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 9bd5c69d048..ead81e81918 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -102,7 +102,7 @@ def view(central_lon): # Set up a colormap for the elevation pygmt.makecpt( cmap="oleron", - series=[int(np.min(grd_relief)), int(np.max(grd_relief))+1, 100], + series=[int(np.min(grd_relief)), int(np.max(grd_relief)) + 1, 100], ) # Plot the grid for the elevation fig.grdimage( From a4c7c2a431347e7e898b02d2fda3a82055609c97 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 16 Apr 2023 20:41:43 +0200 Subject: [PATCH 17/51] Remove blank line --- examples/tutorials/advanced/panel_extension.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index ead81e81918..cdd402be2e7 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -119,4 +119,3 @@ def view(central_lon): # Make an interactive dashboard pn.Column(slider_lon, view) - From 1cec47eff97202da125afbd316bc522cd7b9aa87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 17 Apr 2023 09:18:59 +0200 Subject: [PATCH 18/51] Do not include 'panel' as an optional dependency in 'pyproject.py' Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ab6e9459b15..247c2dc9087 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,6 @@ all = [ "contextily", "geopandas", "ipython", - "panel", "rioxarray", ] From 55b720307a8fb731069c53545dd5f8f2e63ea5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 17 Apr 2023 09:19:41 +0200 Subject: [PATCH 19/51] Do not include 'panel' as an optional dependency in 'install.rst' Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- doc/install.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/install.rst b/doc/install.rst index 771ab751403..3746969cd3b 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -108,7 +108,6 @@ The following are optional dependencies: * `IPython `__: For embedding the figures in Jupyter notebooks (recommended). * `Contextily `__: For retrieving tile maps from the internet. * `GeoPandas `__: For using and plotting GeoDataFrame objects. -* `Panel `__: For creating interactive dashboards. * `RioXarray `__: For saving multi-band rasters to GeoTIFFs. Installing GMT and other dependencies From 0f2550858d90326eb6805d965fe27c3151fd2671 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 17 Apr 2023 09:23:35 +0200 Subject: [PATCH 20/51] Improve link to 'panel' --- examples/tutorials/advanced/panel_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index cdd402be2e7..0a2559b627e 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -6,7 +6,7 @@ "Download Jupyter notebook: panel_extension.ipynb" at the bottom of this page to download this script as a Jupyter notebook.* -The library ``Panel`` (https://panel.holoviz.org/index.html) can be used to +The library `Panel `__ can be used to create interactive dashboards by connecting user-defined widgets to plots. ``Panel`` can be used as an extension to Jupyter notebook / lab. From 66b0087a806c8e0b7bff005af0004d1bd74c061f Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 17 Apr 2023 09:26:40 +0200 Subject: [PATCH 21/51] Move 'panel' to 'Dev dependencies (building documentation)' --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index ccc05768413..2fbac919bc2 100644 --- a/environment.yml +++ b/environment.yml @@ -15,7 +15,6 @@ dependencies: - contextily - geopandas - ipython - - panel - rioxarray # Development dependencies (general) - build @@ -37,6 +36,7 @@ dependencies: - pytest>=6.0 # Dev dependencies (building documentation) - myst-parser + - panel - sphinx - sphinx-copybutton - sphinx-design From d004415219a49a4b45a555c222c846480d264d46 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 17 Apr 2023 10:00:11 +0200 Subject: [PATCH 22/51] Fix list - add blank line --- examples/tutorials/advanced/panel_extension.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 0a2559b627e..9813e6fc39d 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -11,6 +11,7 @@ ``Panel`` can be used as an extension to Jupyter notebook / lab. This tutorial is split into three parts: + - Make a static map - Make a dynamic map - Add a grid for Earth relief From cea4021e071f86f28b37e9294f47e0da06852137 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 17 Apr 2023 10:06:48 +0200 Subject: [PATCH 23/51] Move 'panel' to 'Dev dependencies (building documentation)' --- ci/requirements/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index 361b656544b..391d0592912 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -14,7 +14,6 @@ dependencies: # Optional dependencies - contextily - geopandas - - panel - rioxarray # Development dependencies (general) - build @@ -22,6 +21,7 @@ dependencies: - make # Dev dependencies (building documentation) - myst-parser + - panel - sphinx - sphinx-copybutton - sphinx-design From 84541a485c85f7b26805f2a1da24ca594aef475f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:09:28 +0200 Subject: [PATCH 24/51] Remove 'panel' from 'conf.py' Co-authored-by: Dongdong Tian --- doc/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 0914b1b5e1b..6c356c0fe2e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -59,7 +59,6 @@ "numpy": ("https://numpy.org/doc/stable/", None), "python": ("https://docs.python.org/3/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), - "panel": ("https://panel.holoviz.org/index.html", None), "rasterio": ("https://rasterio.readthedocs.io/en/stable/", None), "rioxarray": ("https://corteva.github.io/rioxarray/stable/", None), "xarray": ("https://docs.xarray.dev/en/stable/", None), From 8a5c31a1d1b10cf7f5694ffa42b83048dd867d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:01:59 +0200 Subject: [PATCH 25/51] Fix typo (code review) Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- examples/tutorials/advanced/panel_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/panel_extension.py index 9813e6fc39d..74ff1be3952 100644 --- a/examples/tutorials/advanced/panel_extension.py +++ b/examples/tutorials/advanced/panel_extension.py @@ -109,7 +109,7 @@ def view(central_lon): fig.grdimage( projection="G" + str(central_lon) + "/15/12c", region="g", - grid=grd_relief, # Use gird downloaded above + grid=grd_relief, # Use grid downloaded above cmap=True, # Use colormap defined above frame="g30", # Add gridlines in steps of 30 degrees on top ) From 8f939320b243634d5ec792f267c96fe86f03d7f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Tue, 18 Apr 2023 10:53:19 +0200 Subject: [PATCH 26/51] Rename 'panel_extension.py' -> 'working_with_panel.py' --- .../advanced/{panel_extension.py => working_with_panel.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/tutorials/advanced/{panel_extension.py => working_with_panel.py} (100%) diff --git a/examples/tutorials/advanced/panel_extension.py b/examples/tutorials/advanced/working_with_panel.py similarity index 100% rename from examples/tutorials/advanced/panel_extension.py rename to examples/tutorials/advanced/working_with_panel.py From 7a8a5aa0437ae91d37fc6fab500894f711461009 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 08:58:57 +0200 Subject: [PATCH 27/51] Improve and add documentation --- .../tutorials/advanced/working_with_panel.py | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 74ff1be3952..8695f3bd216 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -20,7 +20,7 @@ # sphinx_gallery_thumbnail_number = 1 -# Import the requiered packages +# Import the required packages import numpy as np import panel as pn import pygmt @@ -32,14 +32,17 @@ # Make a static map # ----------------- -# Create figure instance +# Create a new instance or object of the pygmt.Figure() class fig = pygmt.Figure() fig.coast( - projection="G30/15/10c", # Orthographic projection + # Orthographic projection with projection center at 30° East and 15° North + # and a width of 12 centimeters + projection="G30/15/12c", region="g", # global - frame="g30", # Add gridlines in steps of 30 degrees on top - land="gray", - water="lightblue", + frame="g30", # Add frame and gridlines in steps of 30 degrees on top + land="gray", # Color land masses in "gray" + water="lightblue", # Color water masses in "lightblue" + # Add coastlines with a 0.25 points thick pen in "gray50" shorelines="1/0.25p,gray50", ) fig.show() @@ -48,27 +51,29 @@ ############################################################################### # Make a dynamic map # ------------------ -# Vary the central longitude used for the Orthographic projection to create -# a rotation of the Earth around the vertical axis. +# To generate a rotation of the Earth around the vertical axis, the central +# longitude of the Orthographic projection is varied iteratively. +# Here, we use the library ``Panel`` to create an interactive dashboard with +# a slider. # Create a slider slider_lon = pn.widgets.DiscreteSlider( - name="Central longitude", - options=list(np.arange(0, 361, 10)), - value=0, + name="Central longitude", # Give name for quantity shown at the slider + options=list(np.arange(0, 361, 10)), # Range corresponding to longitude + value=0, # Set start value ) # Define a function for plotting the single slices @pn.depends(central_lon=slider_lon) def view(central_lon): - # Create figure instance + # Create a new instance or object of the pygmt.Figure() class fig = pygmt.Figure() fig.coast( # Vary the central longitude used for the Orthographic projection projection="G" + str(central_lon) + "/15/12c", region="g", - frame="g30", # Add gridlines in steps of 30 degrees on top + frame="g30", land="gray", water="lightblue", shorelines="1/0.25p,gray50", @@ -84,7 +89,7 @@ def view(central_lon): # Add a grid for Earth relief # --------------------------- -# Download a grid for Earth relief +# Download a grid for Earth relief with a resolution of 10 arc-minutes grd_relief = pygmt.datasets.load_earth_relief(resolution="10m") # Create a slider @@ -98,11 +103,12 @@ def view(central_lon): # Define a function for plotting the single slices @pn.depends(central_lon=slider_lon) def view(central_lon): - # Create figure instance + # Create a new instance or object of the pygmt.Figure() class fig = pygmt.Figure() - # Set up a colormap for the elevation + # Set up a colormap for the elevation in meters pygmt.makecpt( cmap="oleron", + # minimum, maximum, step series=[int(np.min(grd_relief)), int(np.max(grd_relief)) + 1, 100], ) # Plot the grid for the elevation @@ -111,9 +117,11 @@ def view(central_lon): region="g", grid=grd_relief, # Use grid downloaded above cmap=True, # Use colormap defined above - frame="g30", # Add gridlines in steps of 30 degrees on top + frame="g30", ) - # Add a colorbar for the elevation + # Add a horizontal colorbar for the elevation + # with annotations (a) in steps of 2000 and ticks (f) in steps of 1000 + # and labels (+l) at the x-axis "Elevation" and y-axis "m" (meters) fig.colorbar(frame=["a2000f1000", "x+lElevation", "y+lm"]) return fig From 99a1fec1948b3e4eef15a572a4fcd46d82e2c871 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 09:31:45 +0200 Subject: [PATCH 28/51] Adjust G projection for static map --- examples/tutorials/advanced/working_with_panel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 8695f3bd216..764ec0f0d98 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -35,9 +35,9 @@ # Create a new instance or object of the pygmt.Figure() class fig = pygmt.Figure() fig.coast( - # Orthographic projection with projection center at 30° East and 15° North - # and a width of 12 centimeters - projection="G30/15/12c", + # Orthographic projection with projection center at 0° East and 15° North + # and a width of 10 centimeters + projection="G0/15/10c", region="g", # global frame="g30", # Add frame and gridlines in steps of 30 degrees on top land="gray", # Color land masses in "gray" From afbf83f26f464d40d2d93d13b87abbb87b91d6b5 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 19:10:52 +0200 Subject: [PATCH 29/51] Add docs for grid section --- examples/tutorials/advanced/working_with_panel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 764ec0f0d98..5335f49df06 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -88,6 +88,8 @@ def view(central_lon): ############################################################################### # Add a grid for Earth relief # --------------------------- +# Instead of using colors as fill for the land and water masses a grid can be +# displayed. Here, the Earth relief is shown by color-coding the elevation. # Download a grid for Earth relief with a resolution of 10 arc-minutes grd_relief = pygmt.datasets.load_earth_relief(resolution="10m") From b862ba6afa4cf798fe1e1915bb0151e41e6667fb Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 19:11:17 +0200 Subject: [PATCH 30/51] Improve docs for dynamic section --- examples/tutorials/advanced/working_with_panel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 5335f49df06..2c0eb4e4d02 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -52,9 +52,9 @@ # Make a dynamic map # ------------------ # To generate a rotation of the Earth around the vertical axis, the central -# longitude of the Orthographic projection is varied iteratively. -# Here, we use the library ``Panel`` to create an interactive dashboard with -# a slider. +# longitude of the Orthographic projection is varied iteratively in steps of +# 10 degrees. The library ``Panel`` is used to create an interactive dashboard +# with a slider (works only in a notebook environment, e.g. Jupyter notebook). # Create a slider slider_lon = pn.widgets.DiscreteSlider( From 36d693157835a6831c3c885b5b5440b634c9e82f Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 19:12:16 +0200 Subject: [PATCH 31/51] Use alwaysthe same size --- examples/tutorials/advanced/working_with_panel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 2c0eb4e4d02..d2469e2d9b4 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -36,8 +36,8 @@ fig = pygmt.Figure() fig.coast( # Orthographic projection with projection center at 0° East and 15° North - # and a width of 10 centimeters - projection="G0/15/10c", + # and a width of 12 centimeters + projection="G0/15/12c", region="g", # global frame="g30", # Add frame and gridlines in steps of 30 degrees on top land="gray", # Color land masses in "gray" From 3a050bcdbb4de799c7df6a321e61865e1bc0f630 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 19:25:39 +0200 Subject: [PATCH 32/51] Add docs for static section --- examples/tutorials/advanced/working_with_panel.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index d2469e2d9b4..070a21de511 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -31,6 +31,12 @@ ############################################################################### # Make a static map # ----------------- +# The `Orthographic projection +# `__ +# (**G**) can be used to show the Earth as a globe. Land and water masses are +# filled with colors via the ``land`` and ``water`` parameters of +# :meth:`pygmt.Figure.coast`, respectively. Coastlines are added using the +# ``shorelines`` parameter. # Create a new instance or object of the pygmt.Figure() class fig = pygmt.Figure() From def14dd666c07522d61fb5b1e234c79b00672d1f Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 19:27:42 +0200 Subject: [PATCH 33/51] Improve docs for introduction --- examples/tutorials/advanced/working_with_panel.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 070a21de511..4284bcef741 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -10,11 +10,8 @@ create interactive dashboards by connecting user-defined widgets to plots. ``Panel`` can be used as an extension to Jupyter notebook / lab. -This tutorial is split into three parts: - -- Make a static map -- Make a dynamic map -- Add a grid for Earth relief +This tutorial is split into three parts: (1) Make a static map, (2) Make a +dynamic map, and (3) Add a grid for Earth relief. """ # sphinx_gallery_thumbnail_number = 1 From e314ea621b7438129a15825a16d412ed5e57813f Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 22 Apr 2023 19:42:37 +0200 Subject: [PATCH 34/51] Improve docs --- examples/tutorials/advanced/working_with_panel.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 4284bcef741..7cfe5786bd5 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -10,8 +10,11 @@ create interactive dashboards by connecting user-defined widgets to plots. ``Panel`` can be used as an extension to Jupyter notebook / lab. -This tutorial is split into three parts: (1) Make a static map, (2) Make a -dynamic map, and (3) Add a grid for Earth relief. +This tutorial is split into three parts: + +- Make a static map +- Make a dynamic map +- Add a grid for Earth relief """ # sphinx_gallery_thumbnail_number = 1 @@ -30,7 +33,7 @@ # ----------------- # The `Orthographic projection # `__ -# (**G**) can be used to show the Earth as a globe. Land and water masses are +# can be used to show the Earth as a globe. Land and water masses are # filled with colors via the ``land`` and ``water`` parameters of # :meth:`pygmt.Figure.coast`, respectively. Coastlines are added using the # ``shorelines`` parameter. @@ -38,8 +41,8 @@ # Create a new instance or object of the pygmt.Figure() class fig = pygmt.Figure() fig.coast( - # Orthographic projection with projection center at 0° East and 15° North - # and a width of 12 centimeters + # Orthographic projection (G) with projection center at 0° East and + # 15° North and a width of 12 centimeters projection="G0/15/12c", region="g", # global frame="g30", # Add frame and gridlines in steps of 30 degrees on top From be31019a7fd6c5c8271373364466a2993677db5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sun, 23 Apr 2023 09:28:03 +0200 Subject: [PATCH 35/51] Use 'note' highlighting (code review) Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 7cfe5786bd5..b292a45ce5f 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -1,10 +1,13 @@ r""" Dynamic data visualization using ``Panel`` ========================================== -*Please run the following code examples in a notebook environment otherwise -the interactive parts of this tutorial will not work. You can use the button -"Download Jupyter notebook: panel_extension.ipynb" at the bottom of this page -to download this script as a Jupyter notebook.* + +.. note:: + + Please run the following code examples in a notebook environment otherwise + the interactive parts of this tutorial will not work. You can use the button + "Download Jupyter notebook: panel_extension.ipynb" at the bottom of this page + to download this script as a Jupyter notebook.* The library `Panel `__ can be used to create interactive dashboards by connecting user-defined widgets to plots. From 15dbff74a17133308636d0d7859914c6e06d9be5 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 23 Apr 2023 09:30:42 +0200 Subject: [PATCH 36/51] Fix line length --- examples/tutorials/advanced/working_with_panel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index b292a45ce5f..f3c4f4ae148 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -4,10 +4,10 @@ .. note:: - Please run the following code examples in a notebook environment otherwise - the interactive parts of this tutorial will not work. You can use the button - "Download Jupyter notebook: panel_extension.ipynb" at the bottom of this page - to download this script as a Jupyter notebook.* + Please run the following code examples in a notebook environment + otherwise the interactive parts of this tutorial will not work. You can + use the button "Download Jupyter notebook: panel_extension.ipynb" at + the bottom of this page to download this script as a Jupyter notebook. The library `Panel `__ can be used to create interactive dashboards by connecting user-defined widgets to plots. From 009228aad4f7cf87de45908a3212478518d0be27 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 23 Apr 2023 09:41:29 +0200 Subject: [PATCH 37/51] Add 'panel' as a dependency in 'ci_docs.yml' --- .github/workflows/ci_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index d4fe48ef35d..1386e73c422 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -84,7 +84,7 @@ jobs: - name: Install dependencies run: | mamba install gmt=6.4.0 numpy pandas xarray netCDF4 packaging \ - build ipython make myst-parser contextily geopandas rioxarray \ + build ipython make myst-parser contextily geopandas rioxarray panel \ sphinx sphinx-copybutton sphinx-design sphinx-gallery sphinx_rtd_theme # Show installed pkg information for postmortem diagnostic From ed45c1e264e7034ed31e96174ee4f51f7661fa3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:53:15 +0200 Subject: [PATCH 38/51] Change 'dynamic' -> 'interactive' Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index f3c4f4ae148..1241cc885cd 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -1,5 +1,5 @@ r""" -Dynamic data visualization using ``Panel`` +Interactive data visualization using ``Panel`` ========================================== .. note:: From 656b0f566de40b15b441ba9142d50bf21f1dd9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:53:44 +0200 Subject: [PATCH 39/51] Change 'dynamic' -> 'interactive' Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 1241cc885cd..2167c003d70 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -16,7 +16,7 @@ This tutorial is split into three parts: - Make a static map -- Make a dynamic map +- Make an interactive map - Add a grid for Earth relief """ From 5b7eff934a87b2970d19ff8c37c33fb87839af70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:54:10 +0200 Subject: [PATCH 40/51] Change 'dynamic' -> 'interactive' Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 2167c003d70..50a174b9bab 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -58,8 +58,8 @@ ############################################################################### -# Make a dynamic map -# ------------------ +# Make an interactive map +# ----------------------- # To generate a rotation of the Earth around the vertical axis, the central # longitude of the Orthographic projection is varied iteratively in steps of # 10 degrees. The library ``Panel`` is used to create an interactive dashboard From d830c28853f2248dea99194562b333edf367eb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:55:36 +0200 Subject: [PATCH 41/51] Calculate min and max without numpy Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 50a174b9bab..fe9f330424e 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -120,7 +120,7 @@ def view(central_lon): pygmt.makecpt( cmap="oleron", # minimum, maximum, step - series=[int(np.min(grd_relief)), int(np.max(grd_relief)) + 1, 100], + series=[int(grd_relief.data.min()), int(grd_relief.data.max()) + 1, 100], ) # Plot the grid for the elevation fig.grdimage( From f3431e00201b5aa31b6ffce170faeb4b9c9c4b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:56:29 +0200 Subject: [PATCH 42/51] Adjust building string for projection argument Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index fe9f330424e..eb0bc4e45b9 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -80,7 +80,7 @@ def view(central_lon): fig = pygmt.Figure() fig.coast( # Vary the central longitude used for the Orthographic projection - projection="G" + str(central_lon) + "/15/12c", + projection=f"G{central_lon}/15/12c", region="g", frame="g30", land="gray", From 40589ecbd8ead972afb76f8ec07c99bc78c9f457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:57:09 +0200 Subject: [PATCH 43/51] Adjust building string for projection argument Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index eb0bc4e45b9..ebe1a7edc25 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -124,7 +124,7 @@ def view(central_lon): ) # Plot the grid for the elevation fig.grdimage( - projection="G" + str(central_lon) + "/15/12c", + projection=f"G{central_lon}/15/12c", region="g", grid=grd_relief, # Use grid downloaded above cmap=True, # Use colormap defined above From 3e3ea369bba55ef655aaab95efd38e5dd2c831b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 09:00:37 +0200 Subject: [PATCH 44/51] Remove white spaces around "/" Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index ebe1a7edc25..97ab7ad93bc 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -11,7 +11,7 @@ The library `Panel `__ can be used to create interactive dashboards by connecting user-defined widgets to plots. -``Panel`` can be used as an extension to Jupyter notebook / lab. +``Panel`` can be used as an extension to Jupyter notebook/lab. This tutorial is split into three parts: From ea81b1d73208c3b1d2112d694672a139ade26bcb Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 25 Apr 2023 09:56:26 +0200 Subject: [PATCH 45/51] Update file name in introduction --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 97ab7ad93bc..e9add7b1491 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -6,7 +6,7 @@ Please run the following code examples in a notebook environment otherwise the interactive parts of this tutorial will not work. You can - use the button "Download Jupyter notebook: panel_extension.ipynb" at + use the button "Download Jupyter notebook: working_with_panel.ipynb" at the bottom of this page to download this script as a Jupyter notebook. The library `Panel `__ can be used to From c3fd8e76e0e393506b964ab7e1eaa9c2247feef7 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 25 Apr 2023 09:58:23 +0200 Subject: [PATCH 46/51] Fix length of underline of title --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index e9add7b1491..abb1ef09e42 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -1,6 +1,6 @@ r""" Interactive data visualization using ``Panel`` -========================================== +============================================== .. note:: From fe456aa12403f9c476a0e1ed682206faccca01f3 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 25 Apr 2023 10:40:17 +0200 Subject: [PATCH 47/51] Adjust 'series' parameter of 'makecpt' --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index abb1ef09e42..573bac0ed4a 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -120,7 +120,7 @@ def view(central_lon): pygmt.makecpt( cmap="oleron", # minimum, maximum, step - series=[int(grd_relief.data.min()), int(grd_relief.data.max()) + 1, 100], + series=[int(grd_relief.data.min()) - 1, int(grd_relief.data.max()) + 1, 100], ) # Plot the grid for the elevation fig.grdimage( From 49c0eb28dd4e4193fcdb20979d2d55cfa93b8bbb Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 25 Apr 2023 10:43:20 +0200 Subject: [PATCH 48/51] Fix line length --- examples/tutorials/advanced/working_with_panel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 573bac0ed4a..098829c800f 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -120,7 +120,11 @@ def view(central_lon): pygmt.makecpt( cmap="oleron", # minimum, maximum, step - series=[int(grd_relief.data.min()) - 1, int(grd_relief.data.max()) + 1, 100], + series=[ + int(grd_relief.data.min()) - 1, + int(grd_relief.data.max()) + 1, + 100 + ], ) # Plot the grid for the elevation fig.grdimage( From 0e6ef65495600a29a4058c23d8d154928e3751a8 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 25 Apr 2023 10:45:51 +0200 Subject: [PATCH 49/51] Remove file name in introduction --- examples/tutorials/advanced/working_with_panel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 098829c800f..5b27429db89 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -6,8 +6,8 @@ Please run the following code examples in a notebook environment otherwise the interactive parts of this tutorial will not work. You can - use the button "Download Jupyter notebook: working_with_panel.ipynb" at - the bottom of this page to download this script as a Jupyter notebook. + use the button "Download Jupyter notebook" at the bottom of this page + to download this script as a Jupyter notebook. The library `Panel `__ can be used to create interactive dashboards by connecting user-defined widgets to plots. From 68ba2e5a8906fae56c521c3fac5745212a9ee6d3 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 25 Apr 2023 10:51:09 +0200 Subject: [PATCH 50/51] Fix coding style - 'series' argument seems to fit in one line --- examples/tutorials/advanced/working_with_panel.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 5b27429db89..2d9bc392988 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -120,11 +120,7 @@ def view(central_lon): pygmt.makecpt( cmap="oleron", # minimum, maximum, step - series=[ - int(grd_relief.data.min()) - 1, - int(grd_relief.data.max()) + 1, - 100 - ], + series=[int(grd_relief.data.min()) - 1, int(grd_relief.data.max()) + 1, 100], ) # Plot the grid for the elevation fig.grdimage( From 71ddb125f31695c4e0abdd71b21d34f583a43e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:05:29 +0200 Subject: [PATCH 51/51] Remove 'r' at the beginning of the docstrings (code review) Co-authored-by: Dongdong Tian --- examples/tutorials/advanced/working_with_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/working_with_panel.py b/examples/tutorials/advanced/working_with_panel.py index 2d9bc392988..e655517604b 100644 --- a/examples/tutorials/advanced/working_with_panel.py +++ b/examples/tutorials/advanced/working_with_panel.py @@ -1,4 +1,4 @@ -r""" +""" Interactive data visualization using ``Panel`` ==============================================