diff --git a/cf/__init__.py b/cf/__init__.py index fe0ed8c07a..a0c4f5d706 100644 --- a/cf/__init__.py +++ b/cf/__init__.py @@ -65,7 +65,7 @@ Powerful, flexible, and very simple to produce visualisations of field constructs uses the `cfplot` package -(http://ajheaps.github.io/cf-plot), that is automatically installed +(https://ncas-cms.github.io/cf-plot/build/), that is automatically installed along with with `cf`. See the :ref:`cf-python home page ` for documentation, diff --git a/docs/source/conf.py b/docs/source/conf.py index ac8ca82105..266a68829e 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -153,7 +153,7 @@ def _get_date(): "cftime": ("https://unidata.github.io/cftime", None), "cfunits": ("https://ncas-cms.github.io/cfunits", None), "cfdm": ("https://ncas-cms.github.io/cfdm", None), - "cfplot": ("https://ajheaps.github.io/cf-plot", None), + "cfplot": ("https://ncas-cms.github.io/cf-plot/build/", None), "dask": ("https://docs.dask.org/en/latest", None), "matplotlib": ("https://matplotlib.org/stable/", None), } diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 5f58dabdd2..3d24331104 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -102,7 +102,7 @@ details. To install cf with all of its :ref:`required ` and :ref:`optional ` dependencies, and the `cf-plot -visualisation package `_, run: +visualisation package `_, run: .. code-block:: console :caption: *Install with conda.* diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index 05e92dab60..67a80401be 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -116,10 +116,12 @@ manipulation and can: Powerful, flexible, and user-friendly visualisations of field constructs are available with the `cf-plot` package that is installed -separately to `cf` (see http://ajheaps.github.io/cf-plot for details). +separately to `cf` (see the +`cf-plot documentation +`_ for details). See the `cf-plot gallery -`_ for the wide range +`_ for the wide range of plotting possibilities with example code. .. figure:: images/cfplot_example.png diff --git a/docs/source/recipes/plot_05_recipe.py b/docs/source/recipes/plot_05_recipe.py index 2f1b4eab0a..e40f1c23ad 100644 --- a/docs/source/recipes/plot_05_recipe.py +++ b/docs/source/recipes/plot_05_recipe.py @@ -44,7 +44,7 @@ print(pre) # %% -# 4. Plot the wind vectors on top of precipitation data for June 1995 by creating a subspace with a date-time object and using `cfplot.con `_. Here `cfplot.gopen `_ is used to define the parts of the plot area, which is closed by `cfplot.gclose `_; `cfplot.cscale `_ is used to choose one of the colour maps amongst many available; `cfplot.levs `_ is used to set the contour levels for precipitation data; and `cfplot.vect `_ is used to plot the wind vectors for June 1995: +# 4. Plot the wind vectors on top of precipitation data for June 1995 by creating a subspace with a date-time object and using `cfplot.con `_. Here `cfplot.gopen `_ is used to define the parts of the plot area, which is closed by `cfplot.gclose `_; `cfplot.cscale `_ is used to choose one of the colour maps amongst many available; `cfplot.levs `_ is used to set the contour levels for precipitation data; and `cfplot.vect `_ is used to plot the wind vectors for June 1995: june_95 = cf.year(1995) & cf.month(6) cfp.gopen() cfp.cscale("precip4_11lev") diff --git a/docs/source/recipes/plot_06_recipe.py b/docs/source/recipes/plot_06_recipe.py index 1a6b862ac3..91ca4ab100 100644 --- a/docs/source/recipes/plot_06_recipe.py +++ b/docs/source/recipes/plot_06_recipe.py @@ -35,12 +35,12 @@ print(test) # %% -# 6. Plot the wind gust by creating a subspace for the specified variable ``test`` using `cfplot.con `_. Here `cfplot.mapset `_ is used to set the mapping parameters like setting the map resolution to 50m: +# 6. Plot the wind gust by creating a subspace for the specified variable ``test`` using `cfplot.con `_. Here `cfplot.mapset `_ is used to set the mapping parameters like setting the map resolution to 50m: cfp.mapset(resolution="50m") cfp.con(gust.subspace(T=test), lines=False) # %% -# 7. To see the rotated pole data on the native grid, the above steps are repeated and projection is set to rotated in `cfplot.mapset `_: +# 7. To see the rotated pole data on the native grid, the above steps are repeated and projection is set to rotated in `cfplot.mapset `_: cfp.mapset(resolution="50m", proj="rotated") cfp.con(gust.subspace(T=test), lines=False) diff --git a/docs/source/recipes/plot_07_recipe.py b/docs/source/recipes/plot_07_recipe.py index 5bb5802190..02908e83ee 100644 --- a/docs/source/recipes/plot_07_recipe.py +++ b/docs/source/recipes/plot_07_recipe.py @@ -38,7 +38,7 @@ print(ensemble.constructs) # %% -# 6. Loop over the realizations in the ensemble using the *range* function and the *domain_axis* to determine the size of the realization dimension. For each realization, extract a subspace of the ensemble using the *subspace* method and the ``'id%realization'`` keyword argument along a specific latitude and longitude and plot the realizations from the 4D field using `cfplot.lineplot `_. +# 6. Loop over the realizations in the ensemble using the *range* function and the *domain_axis* to determine the size of the realization dimension. For each realization, extract a subspace of the ensemble using the *subspace* method and the ``'id%realization'`` keyword argument along a specific latitude and longitude and plot the realizations from the 4D field using `cfplot.lineplot `_. # A moving average of the ensemble along the time axis, with a window size of 90 (i.e. an approximately 3-month moving average) is calculated using the *moving_window* method. The ``mode='nearest'`` parameter is used to specify how to pad the data outside of the time range. The *squeeze* method removes any dimensions of size 1 from the field to produce a 2D field: cfp.gopen() diff --git a/docs/source/recipes/plot_08_recipe.py b/docs/source/recipes/plot_08_recipe.py index 010707e14a..6045f51448 100644 --- a/docs/source/recipes/plot_08_recipe.py +++ b/docs/source/recipes/plot_08_recipe.py @@ -87,15 +87,15 @@ def process_subsets(subset_mask): ) # %% -# 7. Create two plots - one for the 1850-2020 time period and another for the 1980-2020 time period using `cfplot.con `_. +# 7. Create two plots - one for the 1850-2020 time period and another for the 1980-2020 time period using `cfplot.con `_. # The results are multiplied by 10 so that each plot displays the temperature trend in K/decade with stippling to indicate areas where the trend is statistically significant (p-value < 0.05). -# Here `cfplot.gopen `_ is used to define the parts of the plot area with two rows and one column, and setting the bottom margin to 0.2. -# It is closed by `cfplot.gclose `_; -# `cfplot.gpos `_ is used to set the plotting position of both the plots; -# `cfplot.mapset `_ is used to set the map projection to Robinson; -# `cfplot.cscale `_ is used to choose one of the colour maps amongst many available; -# `cfplot.levs `_ is used to set the contour levels; -# and `cfplot.stipple `_ is used to add stippling to show statistically significant areas: +# Here `cfplot.gopen `_ is used to define the parts of the plot area with two rows and one column, and setting the bottom margin to 0.2. +# It is closed by `cfplot.gclose `_; +# `cfplot.gpos `_ is used to set the plotting position of both the plots; +# `cfplot.mapset `_ is used to set the map projection to Robinson; +# `cfplot.cscale `_ is used to choose one of the colour maps amongst many available; +# `cfplot.levs `_ is used to set the contour levels; +# and `cfplot.stipple `_ is used to add stippling to show statistically significant areas: cfp.gopen(rows=2, columns=1, bottom=0.2) diff --git a/docs/source/recipes/plot_10_recipe.py b/docs/source/recipes/plot_10_recipe.py index 5de11f26fd..a68c23b692 100644 --- a/docs/source/recipes/plot_10_recipe.py +++ b/docs/source/recipes/plot_10_recipe.py @@ -40,7 +40,7 @@ # %% # 5. The relative vorticity is calculated using `cf.curl_xy # `_ and -# plotted using `cfplot.con `_. +# plotted using `cfplot.con `_. # The ``with cf.relaxed_identities(True)`` context manager statement prevents # the curl opereration broadcasting across the two ``expver`` dimensions because # it can't be certain that they are the same as they lack the standardised diff --git a/docs/source/recipes/plot_12_recipe.py b/docs/source/recipes/plot_12_recipe.py index 9a0af6fc91..0857eb421f 100644 --- a/docs/source/recipes/plot_12_recipe.py +++ b/docs/source/recipes/plot_12_recipe.py @@ -43,7 +43,7 @@ # %% # 6. Plot the AOD for all the retrievals using -# `cfplot.con `_. Here the argument +# `cfplot.con `_. Here the argument # ``'ptype'`` specifies the type of plot to use (latituide-longitude here) and # the argument ``'lines=False'`` does not draw contour lines: cfp.con(f=aod.array, x=lon.array, y=lat.array, ptype=1, lines=False) @@ -68,17 +68,17 @@ # %% # 9. Now plot both the AOD from `high-quality` retrieval and all other retrievals -# using `cfplot.con `_. Here: +# using `cfplot.con `_. Here: # -# - `cfplot.gopen `_ is used to +# - `cfplot.gopen `_ is used to # define the parts of the plot area, specifying that the figure should have # 1 row and 2 columns, which is closed by -# `cfplot.gclose `_; +# `cfplot.gclose `_; # - `plt.suptitle `_ # is used to add a title for the whole figure; # - the subplots for plotting are selected using -# `cfplot.gpos `_ after which -# `cfplot.mapset `_ is used to +# `cfplot.gpos `_ after which +# `cfplot.mapset `_ is used to # set the map limits and resolution for the subplots; # - and as cf-plot stores the plot in a plot object with the name # ``cfp.plotvars.plot``, country borders are added using normal diff --git a/docs/source/recipes/plot_13_recipe.py b/docs/source/recipes/plot_13_recipe.py index 3fbdf1bf0e..ff09373e3e 100644 --- a/docs/source/recipes/plot_13_recipe.py +++ b/docs/source/recipes/plot_13_recipe.py @@ -38,16 +38,16 @@ # %% # 5. Plot the various Niño regions using cf-plot. Here: # -# - `cfplot.gopen `_ is used to +# - `cfplot.gopen `_ is used to # define the parts of the plot area, which is closed by -# `cfplot.gclose `_; -# - `cfplot.mapset `_ is used to +# `cfplot.gclose `_; +# - `cfplot.mapset `_ is used to # set the map limits and projection; -# - `cfplot.setvars `_ is used to +# - `cfplot.setvars `_ is used to # set various attributes of the plot, like setting the land colour to grey; -# - `cfplot.cscale `_ is used to +# - `cfplot.cscale `_ is used to # choose one of the colour maps amongst many available; -# - `cfplot.con `_ plots contour data +# - `cfplot.con `_ plots contour data # from the ``region`` subspace at a specific time with no contour lines and a # title; # - next, four Niño regions and labels are defined using @@ -206,13 +206,13 @@ # El Niño and La Niña events. Now plot SST anomalies in the Niño 3.4 region over # time using cf-plot. Here: # -# - `cfplot.gset `_ sets the limits +# - `cfplot.gset `_ sets the limits # of the x-axis (years from 1940 to 2022) and y-axis (anomalies from -3 # degrees C to 3 degrees C) for the plot; -# - `cfplot.gopen `_ is used to +# - `cfplot.gopen `_ is used to # define the parts of the plot area, which is closed by -# `cfplot.gclose `_; -# - `cfplot.lineplot `_ plots +# `cfplot.gclose `_; +# - `cfplot.lineplot `_ plots # the rolling Niño 3.4 index over time; # - a zero line and also horizontal dashed lines are drawn for El Niño and # La Niña thresholds using diff --git a/docs/source/recipes/plot_14_recipe.py b/docs/source/recipes/plot_14_recipe.py index c14e1e1d0e..7baf94107d 100644 --- a/docs/source/recipes/plot_14_recipe.py +++ b/docs/source/recipes/plot_14_recipe.py @@ -33,22 +33,22 @@ # %% # 5. Plot contour lines of this geopotential height for July 2018. Here: # -# - `cfplot.gopen `_ is used to +# - `cfplot.gopen `_ is used to # define the parts of the plot area, which is closed by -# `cfplot.gclose `_; -# - `cfplot.mapset `_ is used to +# `cfplot.gclose `_; +# - `cfplot.mapset `_ is used to # set the map projection to North Polar Stereographic; -# - `cfplot.setvars `_ is used to +# - `cfplot.setvars `_ is used to # set various attributes of the plot, like setting the thickness of the lines # that represent continents; -# - `cfplot.con `_ plots the contour +# - `cfplot.con `_ plots the contour # lines representing the 200 hpa geopotential height values without filling # between the contour lines (``fill=False``) and no colour bar # (``colorbar=False``); -# - `cfplot.levs `_ is used to +# - `cfplot.levs `_ is used to # specify two contour levels, 12000 and 12300 m, corresponding to the # approximate polar-front jet and subtropical jet respectively; -# - `cfplot.con `_ is again used to +# - `cfplot.con `_ is again used to # plot the contour lines for polar-front jet and subtropical jet with a # thicker line width; # - `cfp.plotvars.mymap.stock_img() `_ @@ -119,22 +119,22 @@ # provide an insight into the atmospheric conditions, the temperature anomalies # and the geopotential height contours are plotted using cf-plot. Here: # -# - `cfplot.gopen `_ is used to +# - `cfplot.gopen `_ is used to # define the parts of the plot area, which is closed by -# `cfplot.gclose `_; -# - `cfplot.mapset `_ is used to +# `cfplot.gclose `_; +# - `cfplot.mapset `_ is used to # set the map projection to Robinson; -# - `cfplot.setvars `_ is used to +# - `cfplot.setvars `_ is used to # set various attributes of the plot, like setting the thickness of the lines # that represent continents and master title properties; -# - `cfplot.levs `_ is used to +# - `cfplot.levs `_ is used to # specify the contour levels for temperature anomalies, starting from -2 to 2 # with an interval of 0.5; -# - `cfplot.cscale `_ is used to +# - `cfplot.cscale `_ is used to # choose one of the colour maps amongst many available; -# - `cfplot.con `_ plots contour fill +# - `cfplot.con `_ plots contour fill # of temperature anomalies without contour lines (``lines=False``); -# - `cfplot.levs() `_ is used to +# - `cfplot.levs() `_ is used to # reset contour levels to default after which the steps to plot the contour # lines representing the 200 hpa geopotential height values, the approximate # polar-front jet and subtropical jet from Step 5 are repeated: diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 54467d81df..10c4a92cc3 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -532,16 +532,16 @@ files `. Powerful, flexible, and user-friendly visualisations of field constructs are available with the `cf-plot` package (that needs to be -installed separately to cf, see http://ajheaps.github.io/cf-plot for -details). +installed separately to cf, see `cf-plot documentation +`_ for details). .. figure:: images/cfplot_example.png *Example output of cf-plot displaying a cf field construct.* -See the `cfplot gallery -`_ for the wide range -of plotting possibilities, with example code. These include, but are +See the `cf-plot gallery +`_ for the wide +range of plotting possibilities, with example code. These include, but are not limited to: * Cylindrical, polar stereographic and other plane projections diff --git a/setup.py b/setup.py index 326252b4af..81aab7fed1 100755 --- a/setup.py +++ b/setup.py @@ -157,11 +157,11 @@ def compile(): Powerful, flexible, and very simple to produce visualizations of field constructs are available with the -[cfplot](http://ajheaps.github.io/cf-plot) package, that needs to be -installed seprately to the ``cf`` package. +`cf-plot `_ package, that +needs to be installed seprately to the ``cf`` package. See the `cfplot gallery -`_ for the full range +`_ for the full range of plotting possibilities with example code. Functionality