Skip to content

Commit

Permalink
Merge pull request #63 from sadielbartholomew/docs-new-theming
Browse files Browse the repository at this point in the history
Doc: configure to use PyData theme with announcement
  • Loading branch information
sadielbartholomew authored Jul 30, 2024
2 parents 397845c + 418a3d3 commit c17277b
Show file tree
Hide file tree
Showing 142 changed files with 37,113 additions and 7,643 deletions.
2 changes: 1 addition & 1 deletion docs/build/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: b20cddc9ac81d3adb3cbbbe7bfbc4417
config: b2bd04cad44aa68354896a81dc9679e8
tags: 645f666f9bcd5a90fca523b33c5a78b7
37 changes: 17 additions & 20 deletions docs/build/_sources/advanced.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To see all the methods for the plot object type
In this example we make a blank map plot, change the longitude labels and add a box and some text. For map plots we operate on the cfp.plotvars.mymap object and need to specify transform=ccrs.PlateCarree() to make sure that the plotting is made in regular longitude and latitude coordinates. If the plot is not a map plot then the transform=ccrs.PlateCarree() isn't needed.

.. image:: images/advanced1.png
:scale: 52%
:scale: 52%


::
Expand All @@ -45,7 +45,7 @@ In this example we make a blank map plot, change the longitude labels and add a
yticks=[-30.0, 70.0]
yticklabels=['ylabel1', 'ylabel2']

# Specify some contour levels outside the range of the data
# Specify some contour levels outside the range of the data
# and make a blank contour plot
cfp.levs(-1000, -900, 100)
cfp.con(f.subspace(time=15), fill=False, colorbar=None,
Expand All @@ -54,7 +54,7 @@ In this example we make a blank map plot, change the longitude labels and add a

# A box
cfp.plotvars.mymap.plot([-150, -150, -90, -90, -150],
[-5, 5, 5, -5, -5], linewidth=3.0,
[-5, 5, 5, -5, -5], linewidth=3.0,
color='blue', transform=ccrs.PlateCarree())

# A symbol
Expand All @@ -78,7 +78,7 @@ In this example we make a blank map plot, change the longitude labels and add a

Adding country borders etc can be done using the normal Cartopy operations on the cfp.plotvars.mymap object. Look on the Cartopy web page for examples of these.



Plotting shape files
--------------------
Expand All @@ -87,7 +87,7 @@ In this example we make a blank map plot and plot the UK rivers from a shapefile


.. image:: images/advanced_shapefile.png
:scale: 52%
:scale: 52%



Expand Down Expand Up @@ -116,7 +116,7 @@ In this example we make a blank map plot and plot the UK rivers from a shapefile
for ip in range(len(points)):
lons[ip] = points[ip][0]
lats[ip] = points[ip][1]

cfp.plotvars.mymap.plot(lons, lats , linewidth=1.0,
color='blue', transform=ccrs.PlateCarree())

Expand All @@ -130,12 +130,12 @@ In this example we make a blank map plot and plot the UK rivers from a shapefile
Making a transect plot
----------------------

In this example we make a contour plot and plot a transect. We use the cfp.regrid bilinear interpolation
routine to interpolate the data. Interpolation points for this routine must be **within** the data limits
In this example we make a contour plot and plot a transect. We use the cfp.regrid bilinear interpolation
routine to interpolate the data. Interpolation points for this routine must be **within** the data limits
of the original data. Care is needed to ensure that the field coordinates go from a low value to a high value. This is usually not an issue with longitude but occasionally with latitude (as in this case) the coordinate goes from the north pole to the south pole. A simple flip of the latitude and data is need here.

.. image:: images/advanced_transect.png
:scale: 52%
:scale: 52%


::
Expand Down Expand Up @@ -220,7 +220,7 @@ For example, to make one of the colours in the viridis colour scale grey use:


.. image:: images/advanced2.png
:scale: 52%
:scale: 52%


Colouring land and lakes
Expand All @@ -238,7 +238,7 @@ This is done by changing the land_color, ocean_color and lake_color variables in


.. image:: images/advanced3.png
:scale: 52%
:scale: 52%



Expand Down Expand Up @@ -269,7 +269,7 @@ Masked data isn't plotted.


.. image:: images/advanced4.png
:scale: 52%
:scale: 52%

Masked data is plotted as blockfill in grey.

Expand All @@ -285,25 +285,25 @@ Masked data is plotted as blockfill in grey.
cfp.con(h, blockfill=True, title='Masked data plotted in grey')


# Call internal block filling routine
# Call internal block filling routine
cfp.bfill(f=np.squeeze(i.array), x=i.coord('X').array, y=i.coord('Y').array,
clevs=[990, 1000], lonlat=True, single_fill_color='#d3d3d3')


cfp.gclose()



.. image:: images/advanced5.png
:scale: 52%
:scale: 52%

Blockfill with individual colours
---------------------------------

| If a plot needs to be built up as a series of blockfill plots then this is
| possible using the cf-plot internal blockfill routine. A colour contour plot is
| made and overlaid with two blockfill regions:
|
|
| -50 to 0 = green
| 20 to 40 = red
Expand Down Expand Up @@ -336,7 +336,4 @@ A final call to **cfp.con** is made to overlay contour lines.


.. image:: images/advanced6.png
:scale: 52%



:scale: 52%
44 changes: 19 additions & 25 deletions docs/build/_sources/colour_scales.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ Colour scales

There are two default colour scales in cf-plot:

1) A continuous scale ('viridis') that goes from blue to green and then yellow and suits data that has no zero in it. For example air temperature in Kelvin or geopotential height - see example 1 in the plot gallery.
1) A continuous scale ('viridis') that goes from blue to green and then yellow and suits data that has no zero in it. For example air temperature in Kelvin or geopotential height - see example 1 in the plot gallery.

2) A diverging scale ('scale1') that goes from blue to red and suits data with a zero in it. For example temperature in Celsius or zonal wind - see example 4 in the plot gallery. The colour scale is automatically adjusted so that blue hues are below zero and red hues above zero.

When no calls have been made to **cfp.cscale** cf-plot selects one of theses scales based on whether there is a zero in the data passed for contouring. If a call is made to **cfp.cscale** with just a colour scale name **cfp.cscale('radar')**, for example, then this colour scale is used for all subsequent plots. The colour scale is adjusted automatically to fit the number of contour levels in the plot.
When no calls have been made to **cfp.cscale** cf-plot selects one of theses scales based on whether there is a zero in the data passed for contouring. If a call is made to **cfp.cscale** with just a colour scale name **cfp.cscale('radar')**, for example, then this colour scale is used for all subsequent plots. The colour scale is adjusted automatically to fit the number of contour levels in the plot.

If a call to **cfp.cscale** specifies additional parameters to the colour scale, then the automatic colour adjustment is turned off giving the user fine tuning of colours as below.


.. image:: images/cs1.png
:scale: 65%
.. image:: images/cs1.png
:scale: 65%

::

Expand All @@ -30,11 +30,11 @@ If a call to **cfp.cscale** specifies additional parameters to the colour scale,



To change the number of colours in a scale use the ncols parameters.
To change the number of colours in a scale use the ncols parameters.


.. image:: images/cs2.png
:scale: 65%
.. image:: images/cs2.png
:scale: 65%

::

Expand All @@ -44,11 +44,11 @@ To change the number of colours in a scale use the ncols parameters.
|
|
To change the number of colours above and below the mid-point of the scale use the above and below parameters. This is useful for fields where you have differing extents of data above and below the zero line.
To change the number of colours above and below the mid-point of the scale use the above and below parameters. This is useful for fields where you have differing extents of data above and below the zero line.


.. image:: images/cs3.png
:scale: 65%
.. image:: images/cs3.png
:scale: 65%


::
Expand All @@ -61,16 +61,16 @@ To change the number of colours above and below the mid-point of the scale use t
For data where you need white to indicate that this data region is insignificant use the white=white parameter. This can take single or multiple values of the index of the colour scale where white is required in the colour scale.

.. image:: images/cs4.png
:scale: 65%
.. image:: images/cs4.png
:scale: 65%

::

cfp.cscale('scale1', ncols=11, white=5)
cfp.levs(manual=[-10,-8, -6, -4, -2, 2, 4, 6, 8, 10])

.. image:: images/cs4.png
:scale: 52%
:scale: 52%


To reverse a colour scale use the **reverse=1** option to **cscale** and specify the number of colours required.
Expand All @@ -81,11 +81,11 @@ To reverse a colour scale use the **reverse=1** option to **cscale** and specify



As a short example to show the flexibilty of the colour scale routines we will make a orography plot using the wiki_2_0.rgb orography/bathymetry colour scale. This has as many colours for bathymetry as for the oroggraphy but in this case we just need a blue ocean as we are really only interested in the orography. So in this case we will define a set of levels using *levs* and then match the colour scale to them. The wiki_2_0.rgb colour scale has as many colours for the ocean as for the land so we can use the above and below options
As a short example to show the flexibilty of the colour scale routines we will make a orography plot using the wiki_2_0.rgb orography/bathymetry colour scale. This has as many colours for bathymetry as for the oroggraphy but in this case we just need a blue ocean as we are really only interested in the orography. So in this case we will define a set of levels using *levs* and then match the colour scale to them. The wiki_2_0.rgb colour scale has as many colours for the ocean as for the land so we can use the above and below options


.. image:: images/orog.png
:scale: 52%
:scale: 52%

::

Expand All @@ -95,13 +95,13 @@ As a short example to show the flexibilty of the colour scale routines we will m
f=cf.read('cfplot_data/12km_orog.nc')[0]
cfp.cscale('wiki_2_0', ncols=16, below=2, above=14)
cfp.levs(manual=np.arange(15)*150)
cfp.con(f, lines=False)
cfp.con(f, lines=False)



User defined colour scales
--------------------------
Store these as rgb values in a file with one rgb value per line. i.e.
Store these as rgb values in a file with one rgb value per line. i.e.

::

Expand Down Expand Up @@ -129,8 +129,8 @@ cfp.lineplot(g.subspace(pressure=925), color='plum')
2) Use the hexadecimal code for the colour.

cfp.lineplot(g.subspace(pressure=925), color = '#eeefff')


3) Shades of grey can be selected with cmap(shade), where shade go from 0 to 1.

cfp.lineplot(g.subspace(pressure=925), color=cmap(0.8))
Expand Down Expand Up @@ -384,9 +384,3 @@ scale42 .. image:: images/colour_scales/scale42.png
scale43 .. image:: images/colour_scales/scale43.png
scale44 .. image:: images/colour_scales/scale44.png
======= =====






18 changes: 7 additions & 11 deletions docs/build/_sources/cylindrical.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Example 1 - basic cylindrical projection
----------------------------------------

.. image:: images/fig1.png
:scale: 52%
:scale: 52%

::

Expand All @@ -19,15 +19,15 @@ Example 1 - basic cylindrical projection
cfp.con(f.subspace(time=15))


|
|
|
|

Example 2 - cylindrical projection with blockfill
-------------------------------------------------

.. image:: images/fig2.png
:scale: 52%
:scale: 52%

::

Expand All @@ -38,16 +38,16 @@ Example 2 - cylindrical projection with blockfill



|
|
|
|


Example 3 - altering the map limits and contour levels
------------------------------------------------------

.. image:: images/fig3.png
:scale: 52%
:scale: 52%


::
Expand All @@ -58,7 +58,3 @@ Example 3 - altering the map limits and contour levels
cfp.mapset(lonmin=-15, lonmax=3, latmin=48, latmax=60)
cfp.levs(min=265, max=285, step=1)
cfp.con(f.subspace(time=15))




10 changes: 4 additions & 6 deletions docs/build/_sources/download.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ The second line is optional and installs esmpy, together with the netcdf-fortran

Windows
#######
We have a small development team and Linux is our main working environment. Windows isn't an option for us at present given our target user base.
We have a small development team and Linux is our main working environment. Windows isn't an option for us at present given our target user base.

If you have a Windows operating system there are a couple of options for running Linux:

1) Install the Microsoft Windows Subsystem for Linux (WSL). Once this is working install cf-python and cf-plot as per the Linux instructions above.

2) Installing a Linux Virtual Machine is simple and works well. Installation instructions and a Mint Linux Virtual Machine are available at http://gws-access.ceda.ac.uk/public/ncas_climate/ajh/data_analysis_tools/VM.
2) Installing a Linux Virtual Machine is simple and works well. Installation instructions and a Mint Linux Virtual Machine are available at http://gws-access.ceda.ac.uk/public/ncas_climate/ajh/data_analysis_tools/VM.



Expand Down Expand Up @@ -101,14 +101,12 @@ These are available in the cfplot_data directory which can be linked using:
If you are on a different server then download the `sample netCDF datasets <http://gws-access.ceda.ac.uk/public/ncas_climate/ajh/data_analysis_tools/cfplot_data.tar>`_




|
|
|
|
|
|
|
|
|

Loading

0 comments on commit c17277b

Please sign in to comment.