Skip to content

Commit 9adfb1e

Browse files
committed
v3.15.3 documentation
1 parent 912dc6f commit 9adfb1e

File tree

3,814 files changed

+7116
-7087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,814 files changed

+7116
-7087
lines changed

docs/2_to_3_changes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545

4646

47-
<h1 class="logo"><a href="index.html">cf 3.15.2</a></h1>
47+
<h1 class="logo"><a href="index.html">cf 3.15.3</a></h1>
4848

4949

5050

docs/Changelog.html

Lines changed: 228 additions & 219 deletions
Large diffs are not rendered by default.

docs/_downloads/plot_12_recipe.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"cell_type": "markdown",
167167
"metadata": {},
168168
"source": [
169-
"9. Now plot both the AOD from `high-quality` retrieval and all other retrievals \nusing [cfplot.con](http://ajheaps.github.io/cf-plot/con.html). Here:\n\n- [cfplot.gopen](http://ajheaps.github.io/cf-plot/gopen.html) is used to \n define the parts of the plot area, specifying that the figure should have \n 1 row and 2 columns, which is closed by \n [cfplot.gclose](http://ajheaps.github.io/cf-plot/gclose.html);\n- [plt.suptitle](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.suptitle.html)\n is used to add a title for the whole figure;\n- the subplots for plotting are selected using \n [cfplot.gpos](https://ajheaps.github.io/cf-plot/gpos.html) after which \n [cfplot.mapset](https://ajheaps.github.io/cf-plot/mapset.html) is used to \n set the map limits and resolution for the subplots; \n- and as cf-plot stores the plot in a plot object with the name \n ``cfp.plotvars.plot``, country borders are added using normal \n [Cartopy operations](https://scitools.org.uk/cartopy/docs/latest/reference/index.html) \n on the ``cfp.plotvars.mymap`` object:\n\n"
169+
"9. Now plot both the AOD from `high-quality` retrieval and all other retrievals\nusing [cfplot.con](http://ajheaps.github.io/cf-plot/con.html). Here:\n\n- [cfplot.gopen](http://ajheaps.github.io/cf-plot/gopen.html) is used to\n define the parts of the plot area, specifying that the figure should have\n 1 row and 2 columns, which is closed by\n [cfplot.gclose](http://ajheaps.github.io/cf-plot/gclose.html);\n- [plt.suptitle](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.suptitle.html)\n is used to add a title for the whole figure;\n- the subplots for plotting are selected using\n [cfplot.gpos](https://ajheaps.github.io/cf-plot/gpos.html) after which\n [cfplot.mapset](https://ajheaps.github.io/cf-plot/mapset.html) is used to\n set the map limits and resolution for the subplots;\n- and as cf-plot stores the plot in a plot object with the name\n ``cfp.plotvars.plot``, country borders are added using normal\n [Cartopy operations](https://scitools.org.uk/cartopy/docs/latest/reference/index.html)\n on the ``cfp.plotvars.mymap`` object:\n\n"
170170
]
171171
},
172172
{

docs/_downloads/plot_12_recipe.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@
6767
high = aod.where(mask, cf.masked)
6868

6969
# %%
70-
# 9. Now plot both the AOD from `high-quality` retrieval and all other retrievals
70+
# 9. Now plot both the AOD from `high-quality` retrieval and all other retrievals
7171
# using `cfplot.con <http://ajheaps.github.io/cf-plot/con.html>`_. Here:
7272
#
73-
# - `cfplot.gopen <http://ajheaps.github.io/cf-plot/gopen.html>`_ is used to
74-
# define the parts of the plot area, specifying that the figure should have
75-
# 1 row and 2 columns, which is closed by
73+
# - `cfplot.gopen <http://ajheaps.github.io/cf-plot/gopen.html>`_ is used to
74+
# define the parts of the plot area, specifying that the figure should have
75+
# 1 row and 2 columns, which is closed by
7676
# `cfplot.gclose <http://ajheaps.github.io/cf-plot/gclose.html>`_;
7777
# - `plt.suptitle <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.suptitle.html>`_
7878
# is used to add a title for the whole figure;
79-
# - the subplots for plotting are selected using
80-
# `cfplot.gpos <https://ajheaps.github.io/cf-plot/gpos.html>`_ after which
81-
# `cfplot.mapset <https://ajheaps.github.io/cf-plot/mapset.html>`_ is used to
82-
# set the map limits and resolution for the subplots;
83-
# - and as cf-plot stores the plot in a plot object with the name
84-
# ``cfp.plotvars.plot``, country borders are added using normal
85-
# `Cartopy operations <https://scitools.org.uk/cartopy/docs/latest/reference/index.html>`_
79+
# - the subplots for plotting are selected using
80+
# `cfplot.gpos <https://ajheaps.github.io/cf-plot/gpos.html>`_ after which
81+
# `cfplot.mapset <https://ajheaps.github.io/cf-plot/mapset.html>`_ is used to
82+
# set the map limits and resolution for the subplots;
83+
# - and as cf-plot stores the plot in a plot object with the name
84+
# ``cfp.plotvars.plot``, country borders are added using normal
85+
# `Cartopy operations <https://scitools.org.uk/cartopy/docs/latest/reference/index.html>`_
8686
# on the ``cfp.plotvars.mymap`` object:
8787
import cartopy.feature as cfeature
8888

docs/_downloads/plot_13_recipe.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"cell_type": "markdown",
149149
"metadata": {},
150150
"source": [
151-
"8. The line for variable ``nino34_anomaly`` calculates the standardized\nanomaly for each time step in the ``nino34_index`` data. It subtracts the\n``climatology`` from the ``nino34_index`` and then divides by the ``std_dev``.\nThe resulting ``nino34_anomaly`` data represents how much the SST in the Ni\u00f1o \n3.4 region deviates from the 1961-1990 average, in units of standard \ndeviations. This is a common way to quantify climate anomalies like El Ni\u00f1o \nand La Ni\u00f1a events:\n\n"
151+
"8. The line for variable ``nino34_anomaly`` calculates the standardized\nanomaly for each time step in the ``nino34_index`` data. It subtracts the\n``climatology`` from the ``nino34_index`` and then divides by the ``std_dev``.\nThe resulting ``nino34_anomaly`` data represents how much the SST in the Ni\u00f1o\n3.4 region deviates from the 1961-1990 average, in units of standard\ndeviations. This is a common way to quantify climate anomalies like El Ni\u00f1o\nand La Ni\u00f1a events:\n\n"
152152
]
153153
},
154154
{
@@ -195,7 +195,7 @@
195195
},
196196
"outputs": [],
197197
"source": [
198-
"elnino = nino34_rolling >= 0.4\nlanina = nino34_rolling <= -0.4\n\ncfp.gset(xmin='1940-1-1', xmax='2022-12-31', ymin=-3, ymax=3)\n\ncfp.gopen(figsize=(10, 6))\ncfp.lineplot(\n nino34_rolling,\n color=\"black\",\n title=\"SST Anomaly in Ni\u00f1o 3.4 Region (5N-5S, 120-170W)\",\n ylabel=\"Temperature anomaly ($\\degree C$)\",\n xlabel=\"Year\",\n)\ncfp.plotvars.plot.axhline(\n 0.4, color=\"red\", linestyle=\"--\", label=\"El Ni\u00f1o Threshold\"\n)\ncfp.plotvars.plot.axhline(\n -0.4, color=\"blue\", linestyle=\"--\", label=\"La Ni\u00f1a Threshold\"\n)\ncfp.plotvars.plot.axhline(0, color=\"black\", linestyle=\"-\", linewidth=1)\ncfp.plotvars.plot.fill_between(\n nino34_rolling.coordinate(\"T\").array,\n 0.4,\n nino34_rolling.array.squeeze(),\n where=elnino.squeeze(),\n color=\"red\",\n alpha=0.3,\n)\ncfp.plotvars.plot.fill_between(\n nino34_rolling.coordinate(\"T\").array,\n -0.4,\n nino34_rolling.array.squeeze(),\n where=lanina.squeeze(),\n color=\"blue\",\n alpha=0.3,\n)\ncfp.plotvars.plot.legend(frameon=False, loc=\"lower center\", ncol=2)\ncfp.gclose()"
198+
"elnino = nino34_rolling >= 0.4\nlanina = nino34_rolling <= -0.4\n\ncfp.gset(xmin=\"1940-1-1\", xmax=\"2022-12-31\", ymin=-3, ymax=3)\n\ncfp.gopen(figsize=(10, 6))\ncfp.lineplot(\n nino34_rolling,\n color=\"black\",\n title=\"SST Anomaly in Ni\u00f1o 3.4 Region (5N-5S, 120-170W)\",\n ylabel=\"Temperature anomaly ($\\degree C$)\",\n xlabel=\"Year\",\n)\ncfp.plotvars.plot.axhline(\n 0.4, color=\"red\", linestyle=\"--\", label=\"El Ni\u00f1o Threshold\"\n)\ncfp.plotvars.plot.axhline(\n -0.4, color=\"blue\", linestyle=\"--\", label=\"La Ni\u00f1a Threshold\"\n)\ncfp.plotvars.plot.axhline(0, color=\"black\", linestyle=\"-\", linewidth=1)\ncfp.plotvars.plot.fill_between(\n nino34_rolling.coordinate(\"T\").array,\n 0.4,\n nino34_rolling.array.squeeze(),\n where=elnino.squeeze(),\n color=\"red\",\n alpha=0.3,\n)\ncfp.plotvars.plot.fill_between(\n nino34_rolling.coordinate(\"T\").array,\n -0.4,\n nino34_rolling.array.squeeze(),\n where=lanina.squeeze(),\n color=\"blue\",\n alpha=0.3,\n)\ncfp.plotvars.plot.legend(frameon=False, loc=\"lower center\", ncol=2)\ncfp.gclose()"
199199
]
200200
}
201201
],

docs/_downloads/plot_13_recipe.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@
182182
# 8. The line for variable ``nino34_anomaly`` calculates the standardized
183183
# anomaly for each time step in the ``nino34_index`` data. It subtracts the
184184
# ``climatology`` from the ``nino34_index`` and then divides by the ``std_dev``.
185-
# The resulting ``nino34_anomaly`` data represents how much the SST in the Niño
186-
# 3.4 region deviates from the 1961-1990 average, in units of standard
187-
# deviations. This is a common way to quantify climate anomalies like El Niño
185+
# The resulting ``nino34_anomaly`` data represents how much the SST in the Niño
186+
# 3.4 region deviates from the 1961-1990 average, in units of standard
187+
# deviations. This is a common way to quantify climate anomalies like El Niño
188188
# and La Niña events:
189189
nino34_anomaly = (nino34_index - climatology) / std_dev
190190

@@ -228,7 +228,7 @@
228228
elnino = nino34_rolling >= 0.4
229229
lanina = nino34_rolling <= -0.4
230230

231-
cfp.gset(xmin='1940-1-1', xmax='2022-12-31', ymin=-3, ymax=3)
231+
cfp.gset(xmin="1940-1-1", xmax="2022-12-31", ymin=-3, ymax=3)
232232

233233
cfp.gopen(figsize=(10, 6))
234234
cfp.lineplot(

docs/_downloads/plot_15_recipe.ipynb

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\n# Resampling Land Use Flags to a Coarser Grid\n\nIn this recipe, we will compare the land use distribution in different countries\nusing a land use data file and visualize the data as a histogram. This will help\nto understand the proportion of different land use categories in each country.\n\nThe land use data is initially available at a high spatial resolution of \napproximately 100 m, with several flags defined with numbers representing the \ntype of land use. Regridding the data to a coarser resolution of approximately \n25 km would incorrectly represent the flags on the new grids.\n\nTo avoid this, we will resample the data to the coarser resolution by \naggregating the data within predefined spatial regions or bins. This approach \nwill give a dataset where each 25 km grid cell contains a histogram of land use \nflags, as determined by the original 100 m resolution data. It retains the \noriginal spatial extent of the data while reducing its spatial complexity. \nRegridding, on the other hand, involves interpolating the data onto a new grid, \nwhich can introduce artifacts and distortions in the data.\n"
18+
"\n# Resampling Land Use Flags to a Coarser Grid\n\nIn this recipe, we will compare the land use distribution in different countries\nusing a land use data file and visualize the data as a histogram. This will help\nto understand the proportion of different land use categories in each country.\n\nThe land use data is initially available at a high spatial resolution of\napproximately 100 m, with several flags defined with numbers representing the\ntype of land use. Regridding the data to a coarser resolution of approximately\n25 km would incorrectly represent the flags on the new grids.\n\nTo avoid this, we will resample the data to the coarser resolution by\naggregating the data within predefined spatial regions or bins. This approach\nwill give a dataset where each 25 km grid cell contains a histogram of land use\nflags, as determined by the original 100 m resolution data. It retains the\noriginal spatial extent of the data while reducing its spatial complexity.\nRegridding, on the other hand, involves interpolating the data onto a new grid,\nwhich can introduce artifacts and distortions in the data.\n"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {
25+
"collapsed": false
26+
},
27+
"outputs": [],
28+
"source": [
29+
"import cartopy.io.shapereader as shpreader\nimport matplotlib.pyplot as plt\nimport numpy as np"
1930
]
2031
},
2132
{
2233
"cell_type": "markdown",
2334
"metadata": {},
2435
"source": [
25-
"1. Import the required libraries. We will use Cartopy's ``shapereader`` to \nwork with shapefiles that define country boundaries:\n\n"
36+
"1. Import the required libraries. We will use Cartopy's ``shapereader`` to\nwork with shapefiles that define country boundaries:\n\n"
2637
]
2738
},
2839
{
@@ -33,7 +44,7 @@
3344
},
3445
"outputs": [],
3546
"source": [
36-
"import cf\nimport cartopy.io.shapereader as shpreader\nimport matplotlib.pyplot as plt\nimport numpy as np"
47+
"import cf"
3748
]
3849
},
3950
{
@@ -76,7 +87,7 @@
7687
"cell_type": "markdown",
7788
"metadata": {},
7889
"source": [
79-
"4. Define a function to plot a histogram of land use distribution for a\nspecific country:\n\n- The [digitize](https://ncas-cms.github.io/cf-python/method/cf.Field.digitize.html)\n function of the ``cf.Field`` object is called to convert the land use data \n into indices of bins. It takes an array of bins (defined by \n the [np.linspace](https://numpy.org/doc/stable/reference/generated/numpy.linspace.html) function)\n and the ``return_bins=True`` parameter, which returns the actual bin values \n along with the digitized data.\n- The [np.linspace](https://numpy.org/doc/stable/reference/generated/numpy.linspace.html)\n function is used to create an array of evenly spaced bin edges from 0 to 50,\n with 51 total values. This creates bins of width 1.\n- The ``digitized`` variable contains the bin indices for each data point, \n while the bins variable contains the actual bin values.\n- The [cf.histogram](https://ncas-cms.github.io/cf-python/function/cf.histogram.html) \n function is called on the digitized data to create a histogram. This \n function returns a field object with the histogram data.\n- The [squeeze](https://ncas-cms.github.io/cf-python/method/cf.Field.squeeze.html)\n function applied to the histogram ``array`` extracts the histogram data as a NumPy\n array and removes any single dimensions.\n- The ``total_valid_sub_cells`` variable calculates the total number of valid \n subcells (non-missing data points) by summing the histogram data.\n- The last element of the bin_counts array is removed with slicing \n (``bin_counts[:-1]``) to match the length of the ``bin_indices`` array.\n- The ``percentages`` variable calculates the percentage of each bin by \n dividing the ``bin_counts`` by the ``total_valid_sub_cells`` and multiplying\n by 100.\n- The ``bin_indices`` variable calculates the center of each bin by averaging \n the bin edges. This is done by adding the ``bins.array[:-1, 0]`` and \n ``bins.array[1:, 0]`` arrays and dividing by 2.\n- The ``ax.bar`` function is called to plot the histogram as a bar chart on \n the provided axis. The x-axis values are given by the ``bin_indices`` array,\n and the y-axis values are given by the ``percentages`` array.\n- The title, x-axis label, y-axis label, and axis limits are set based on the \n input parameters.\n\n"
90+
"4. Define a function to plot a histogram of land use distribution for a\nspecific country:\n\n- The [digitize](https://ncas-cms.github.io/cf-python/method/cf.Field.digitize.html)\n function of the ``cf.Field`` object is called to convert the land use data\n into indices of bins. It takes an array of bins (defined by\n the [np.linspace](https://numpy.org/doc/stable/reference/generated/numpy.linspace.html) function)\n and the ``return_bins=True`` parameter, which returns the actual bin values\n along with the digitized data.\n- The [np.linspace](https://numpy.org/doc/stable/reference/generated/numpy.linspace.html)\n function is used to create an array of evenly spaced bin edges from 0 to 50,\n with 51 total values. This creates bins of width 1.\n- The ``digitized`` variable contains the bin indices for each data point,\n while the bins variable contains the actual bin values.\n- The [cf.histogram](https://ncas-cms.github.io/cf-python/function/cf.histogram.html)\n function is called on the digitized data to create a histogram. This\n function returns a field object with the histogram data.\n- The [squeeze](https://ncas-cms.github.io/cf-python/method/cf.Field.squeeze.html)\n function applied to the histogram ``array`` extracts the histogram data as a NumPy\n array and removes any single dimensions.\n- The ``total_valid_sub_cells`` variable calculates the total number of valid\n subcells (non-missing data points) by summing the histogram data.\n- The last element of the bin_counts array is removed with slicing\n (``bin_counts[:-1]``) to match the length of the ``bin_indices`` array.\n- The ``percentages`` variable calculates the percentage of each bin by\n dividing the ``bin_counts`` by the ``total_valid_sub_cells`` and multiplying\n by 100.\n- The ``bin_indices`` variable calculates the center of each bin by averaging\n the bin edges. This is done by adding the ``bins.array[:-1, 0]`` and\n ``bins.array[1:, 0]`` arrays and dividing by 2.\n- The ``ax.bar`` function is called to plot the histogram as a bar chart on\n the provided axis. The x-axis values are given by the ``bin_indices`` array,\n and the y-axis values are given by the ``percentages`` array.\n- The title, x-axis label, y-axis label, and axis limits are set based on the\n input parameters.\n\n"
8091
]
8192
},
8293
{
@@ -112,7 +123,7 @@
112123
"cell_type": "markdown",
113124
"metadata": {},
114125
"source": [
115-
"6. Set up the figure and axes for plotting the histograms:\n\n- The ``plt.subplots`` function is called to set up a figure with three \n subplots, with a figure size of 8 inches by 10 inches.\n- A loop iterates over each country in the countries list and for each \n country, the ``extract_data`` function is called to extract its land use \n data.\n- The ``plot_histogram`` function is then called to plot the histogram of land\n use distribution on the corresponding subplot.\n- The ``plt.tight_layout`` function is called to ensure that the subplots are \n properly spaced within the figure and finally, the ``plt.show`` function\n displays the figure with the histograms.\n\n"
126+
"6. Set up the figure and axes for plotting the histograms:\n\n- The ``plt.subplots`` function is called to set up a figure with three\n subplots, with a figure size of 8 inches by 10 inches.\n- A loop iterates over each country in the countries list and for each\n country, the ``extract_data`` function is called to extract its land use\n data.\n- The ``plot_histogram`` function is then called to plot the histogram of land\n use distribution on the corresponding subplot.\n- The ``plt.tight_layout`` function is called to ensure that the subplots are\n properly spaced within the figure and finally, the ``plt.show`` function\n displays the figure with the histograms.\n\n"
116127
]
117128
},
118129
{

0 commit comments

Comments
 (0)