diff --git a/.gitignore b/.gitignore index 48cddc53be..d589c306fe 100644 --- a/.gitignore +++ b/.gitignore @@ -55,11 +55,8 @@ lib/iris/tests/results/imagerepo.lock *.cover # Auto generated documentation files -docs/iris/src/_static/random_image.js -docs/iris/src/_templates/gallery.html -docs/iris/src/examples/ -docs/iris/src/iris/ -docs/iris/src/matplotlibrc +docs/iris/src/_build/* +docs/iris/src/generated # Example test results docs/iris/iris_image_test_output/ diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..1306c3fc2c --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,19 @@ +version: 2 + +build: + image: latest + +conda: + environment: ci/requirements/readthedocs.yml + +sphinx: + configuration: docs/iris/src/conf.py + fail_on_warning: false + +python: + install: + - method: setuptools + path: . + +formats: + - htmlzip diff --git a/.travis.yml b/.travis.yml index ca47a73388..262e8d7791 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,12 +15,12 @@ env: matrix: - PYTHON_VERSION=3.6 TEST_TARGET=default TEST_MINIMAL=true - PYTHON_VERSION=3.6 TEST_TARGET=default TEST_BLACK=true - - PYTHON_VERSION=3.6 TEST_TARGET=example - + - PYTHON_VERSION=3.6 TEST_TARGET=gallery - PYTHON_VERSION=3.7 TEST_TARGET=default TEST_MINIMAL=true - PYTHON_VERSION=3.7 TEST_TARGET=default TEST_BLACK=true - - PYTHON_VERSION=3.7 TEST_TARGET=example + - PYTHON_VERSION=3.7 TEST_TARGET=gallery - PYTHON_VERSION=3.7 TEST_TARGET=doctest PUSH_BUILT_DOCS=true + - PYTHON_VERSION=3.7 TEST_TARGET=linkcheck git: # We need a deep clone so that we can compute the age of the files using their git history. @@ -61,8 +61,8 @@ install: if [[ "${TEST_MINIMAL}" != true ]]; then CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} all"; fi; - if [[ "${TEST_TARGET}" == 'doctest' ]]; then - CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} docs"; + if [[ "${TEST_TARGET}" == 'doctest' || "${TEST_TARGET}" == 'linkcheck' ]]; then + CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} docs"; fi; CONDA_REQS_FILE="conda-requirements.txt"; python requirements/gen_conda_requirements.py --groups ${CONDA_REQS_GROUPS} > ${CONDA_REQS_FILE}; @@ -118,8 +118,8 @@ script: python -m iris.tests.runner --default-tests --system-tests; fi - - if [[ "${TEST_TARGET}" == 'example' ]]; then - python -m iris.tests.runner --example-tests; + - if [[ "${TEST_TARGET}" == 'gallery' ]]; then + python -m iris.tests.runner --gallery-tests; fi # A call to check "whatsnew" contributions are valid, because the Iris test @@ -152,6 +152,17 @@ script: make clean html && make doctest; fi + # check the links in the docs + - > + if [[ "${TEST_TARGET}" == 'linkcheck' ]]; then + MPL_RC_DIR="${HOME}/.config/matplotlib"; + mkdir -p ${MPL_RC_DIR}; + echo 'backend : agg' > ${MPL_RC_DIR}/matplotlibrc; + echo 'image.cmap : viridis' >> ${MPL_RC_DIR}/matplotlibrc; + cd ${INSTALL_DIR}/docs/iris; + make clean && make linkcheck; + fi + # Split the organisation out of the slug. See https://stackoverflow.com/a/5257398/741316 for description. # NOTE: a *separate* "export" command appears to be necessary here : A command of the # form "export ORG=.." failed to define ORG for the following command (?!) diff --git a/INSTALL b/INSTALL index 9296f97a29..cf4c4d1bae 100644 --- a/INSTALL +++ b/INSTALL @@ -1,9 +1,11 @@ You can either install Iris using the conda package manager or from source. + Installing using conda ---------------------- Iris is available using conda for the following platforms: + * Linux 64-bit, * Mac OSX 64-bit, and * Windows 32-bit and 64-bit. @@ -16,8 +18,7 @@ the following command:: conda install -c conda-forge iris -If you wish to run any of the code examples -(see http://scitools.org.uk/iris/docs/latest/examples/index.html) you will also +If you wish to run any of the code in the gallery you will also need the Iris sample data. This can also be installed using conda:: conda install -c conda-forge iris-sample-data @@ -77,7 +78,7 @@ Hence the commands change to:: conda activate my_iris_env # or whatever other name you gave it pip install -e . -The tests can then be run with +The tests can then be run with:: python setup.py test diff --git a/README.md b/README.md index ee7a170822..126869b267 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@

- - Iris
+ + Iris

+

Iris is a powerful, format-agnostic, community-driven Python library for analysing and visualising Earth science data diff --git a/ci/requirements/readthedocs.yml b/ci/requirements/readthedocs.yml new file mode 100644 index 0000000000..611c69307d --- /dev/null +++ b/ci/requirements/readthedocs.yml @@ -0,0 +1,60 @@ +name: iris-docs + +channels: + - conda-forge + +dependencies: +# Dependencies necessary to run setup.py of iris +# ---------------------------------------------- + - setuptools + - pyke + +# Absolute minimal dependencies for iris +# -------------------------------------- + +# Without these, iris won't even import. + + - cartopy>=0.12 + - proj4<6 + - cf-units>=2 + - cftime==1.1.3 + - dask>=2 + - matplotlib + - netcdf4 + - numpy>=1.14 + - scipy + +# Dependencies needed to run the iris tests +#------------------------------------------ + + - black=19.10b0 + - filelock + - pillow<7 + - imagehash>=4.0 + - nose + - pre-commit + - requests + - asv + +# Dependencies for a feature complete installation +# ------------------------------------------------ + +# esmpy regridding not available through pip. + - esmpy>=7.0 +#gdal : under review -- not tested at present + - mo_pack + - nc-time-axis + - pandas + - python-stratify + - pyugrid + + - graphviz + +# Iris sample data is not available through pip. It can be installed from +# https://github.com/SciTools/iris-sample-data/archive/master.zip + - iris-sample-data + - sphinx + - sphinx_rtd_theme + - sphinx-copybutton + - sphinx-gallery + diff --git a/docs/iris/Makefile b/docs/iris/Makefile index 1a66b03805..a220502028 100644 --- a/docs/iris/Makefile +++ b/docs/iris/Makefile @@ -20,28 +20,36 @@ pdf: all: @for i in $(SUBDIRS); do \ - echo "make all in $$i..."; \ - (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) all); done + echo "make all in $$i..."; \ + (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) all); done + install: @for i in $(SUBDIRS); do \ - echo "Installing in $$i..."; \ - (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) install); done + echo "Installing in $$i..."; \ + (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) install); done + build: @for i in $(SUBDIRS); do \ - echo "Clearing in $$i..."; \ - (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) build); done + echo "Clearing in $$i..."; \ + (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) build); done + clean: @for i in $(SUBDIRS); do \ - echo "Clearing in $$i..."; \ - (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) clean); done + echo "Clearing in $$i..."; \ + (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) clean); done doctest: @for i in $(SUBDIRS); do \ echo "Running doctest in $$i..."; \ (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) doctest); done -extest: +linkcheck: + @for i in $(SUBDIRS); do \ + echo "Running linkcheck in $$i..."; \ + (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) linkcheck); done + +gallerytest: @echo - @echo "Running \"example_code/graphics\" tests..." + @echo "Running \"gallery\" tests..." @echo python -m unittest discover -v -t . diff --git a/docs/iris/gallery_code/README.rst b/docs/iris/gallery_code/README.rst new file mode 100644 index 0000000000..7d8fb60e81 --- /dev/null +++ b/docs/iris/gallery_code/README.rst @@ -0,0 +1,26 @@ +Gallery +======= + +The gallery is divided into sections as described below. All entries +show the code used to produce the example plot. Additionally there are links +to download the code directly as source or as part of a +`jupyter notebook `_, +these links are at the bottom of the page. + +In order to successfuly view the jupyter notebook locally so you may +experiment with the code you will need an environment setup with the +appropriate dependencies, see :ref:`installing_iris` for instructions. +Ensure that ``iris-sample-data`` is installed as it is used in the gallery. +Additionally ensure that you install ``jupyter``. The command to install both +is:: + + conda install -c conda-forge iris-sample-data jupyter + +Once you have downloaded the notebooks (bottom of each gallery page), +you may start the jupyter notebook via:: + + jupyter notebook + +If you wish to contribute to the gallery see the +:ref:`contributing.documentation.gallery` section of the +:ref:`contributing.documentation`. diff --git a/docs/iris/gallery_code/general/README.rst b/docs/iris/gallery_code/general/README.rst new file mode 100644 index 0000000000..c846755f1e --- /dev/null +++ b/docs/iris/gallery_code/general/README.rst @@ -0,0 +1,2 @@ +General +------- diff --git a/docs/iris/example_code/General/__init__.py b/docs/iris/gallery_code/general/__init__.py similarity index 100% rename from docs/iris/example_code/General/__init__.py rename to docs/iris/gallery_code/general/__init__.py diff --git a/docs/iris/example_code/General/SOI_filtering.py b/docs/iris/gallery_code/general/plot_SOI_filtering.py similarity index 100% rename from docs/iris/example_code/General/SOI_filtering.py rename to docs/iris/gallery_code/general/plot_SOI_filtering.py diff --git a/docs/iris/example_code/General/anomaly_log_colouring.py b/docs/iris/gallery_code/general/plot_anomaly_log_colouring.py similarity index 97% rename from docs/iris/example_code/General/anomaly_log_colouring.py rename to docs/iris/gallery_code/general/plot_anomaly_log_colouring.py index 95af1e1f61..28f7ce323b 100644 --- a/docs/iris/example_code/General/anomaly_log_colouring.py +++ b/docs/iris/gallery_code/general/plot_anomaly_log_colouring.py @@ -13,7 +13,7 @@ To do this, we create a custom value mapping function (normalization) using the matplotlib Norm class `matplotlib.colours.SymLogNorm -`_. +`_. We use this to make a cell-filled pseudocolour plot with a colorbar. NOTE: By "pseudocolour", we mean that each data point is drawn as a "cell" diff --git a/docs/iris/example_code/General/coriolis_plot.py b/docs/iris/gallery_code/general/plot_coriolis.py similarity index 100% rename from docs/iris/example_code/General/coriolis_plot.py rename to docs/iris/gallery_code/general/plot_coriolis.py diff --git a/docs/iris/example_code/General/cross_section.py b/docs/iris/gallery_code/general/plot_cross_section.py similarity index 100% rename from docs/iris/example_code/General/cross_section.py rename to docs/iris/gallery_code/general/plot_cross_section.py diff --git a/docs/iris/example_code/General/custom_aggregation.py b/docs/iris/gallery_code/general/plot_custom_aggregation.py similarity index 100% rename from docs/iris/example_code/General/custom_aggregation.py rename to docs/iris/gallery_code/general/plot_custom_aggregation.py diff --git a/docs/iris/example_code/General/custom_file_loading.py b/docs/iris/gallery_code/general/plot_custom_file_loading.py similarity index 100% rename from docs/iris/example_code/General/custom_file_loading.py rename to docs/iris/gallery_code/general/plot_custom_file_loading.py diff --git a/docs/iris/example_code/General/global_map.py b/docs/iris/gallery_code/general/plot_global_map.py similarity index 100% rename from docs/iris/example_code/General/global_map.py rename to docs/iris/gallery_code/general/plot_global_map.py diff --git a/docs/iris/example_code/General/inset_plot.py b/docs/iris/gallery_code/general/plot_inset.py similarity index 100% rename from docs/iris/example_code/General/inset_plot.py rename to docs/iris/gallery_code/general/plot_inset.py diff --git a/docs/iris/example_code/General/lineplot_with_legend.py b/docs/iris/gallery_code/general/plot_lineplot_with_legend.py similarity index 100% rename from docs/iris/example_code/General/lineplot_with_legend.py rename to docs/iris/gallery_code/general/plot_lineplot_with_legend.py diff --git a/docs/iris/example_code/General/orca_projection.py b/docs/iris/gallery_code/general/plot_orca_projection.py similarity index 100% rename from docs/iris/example_code/General/orca_projection.py rename to docs/iris/gallery_code/general/plot_orca_projection.py diff --git a/docs/iris/example_code/General/polar_stereo.py b/docs/iris/gallery_code/general/plot_polar_stereo.py similarity index 100% rename from docs/iris/example_code/General/polar_stereo.py rename to docs/iris/gallery_code/general/plot_polar_stereo.py diff --git a/docs/iris/example_code/General/polynomial_fit.py b/docs/iris/gallery_code/general/plot_polynomial_fit.py similarity index 100% rename from docs/iris/example_code/General/polynomial_fit.py rename to docs/iris/gallery_code/general/plot_polynomial_fit.py diff --git a/docs/iris/example_code/General/projections_and_annotations.py b/docs/iris/gallery_code/general/plot_projections_and_annotations.py similarity index 100% rename from docs/iris/example_code/General/projections_and_annotations.py rename to docs/iris/gallery_code/general/plot_projections_and_annotations.py diff --git a/docs/iris/example_code/General/rotated_pole_mapping.py b/docs/iris/gallery_code/general/plot_rotated_pole_mapping.py similarity index 100% rename from docs/iris/example_code/General/rotated_pole_mapping.py rename to docs/iris/gallery_code/general/plot_rotated_pole_mapping.py diff --git a/docs/iris/gallery_code/meteorology/README.rst b/docs/iris/gallery_code/meteorology/README.rst new file mode 100644 index 0000000000..e8e902b498 --- /dev/null +++ b/docs/iris/gallery_code/meteorology/README.rst @@ -0,0 +1,3 @@ +Meteorology +----------- + diff --git a/docs/iris/example_code/Meteorology/__init__.py b/docs/iris/gallery_code/meteorology/__init__.py similarity index 100% rename from docs/iris/example_code/Meteorology/__init__.py rename to docs/iris/gallery_code/meteorology/__init__.py diff --git a/docs/iris/example_code/Meteorology/COP_1d_plot.py b/docs/iris/gallery_code/meteorology/plot_COP_1d.py similarity index 100% rename from docs/iris/example_code/Meteorology/COP_1d_plot.py rename to docs/iris/gallery_code/meteorology/plot_COP_1d.py diff --git a/docs/iris/example_code/Meteorology/COP_maps.py b/docs/iris/gallery_code/meteorology/plot_COP_maps.py similarity index 100% rename from docs/iris/example_code/Meteorology/COP_maps.py rename to docs/iris/gallery_code/meteorology/plot_COP_maps.py diff --git a/docs/iris/example_code/Meteorology/TEC.py b/docs/iris/gallery_code/meteorology/plot_TEC.py similarity index 100% rename from docs/iris/example_code/Meteorology/TEC.py rename to docs/iris/gallery_code/meteorology/plot_TEC.py diff --git a/docs/iris/example_code/Meteorology/deriving_phenomena.py b/docs/iris/gallery_code/meteorology/plot_deriving_phenomena.py similarity index 100% rename from docs/iris/example_code/Meteorology/deriving_phenomena.py rename to docs/iris/gallery_code/meteorology/plot_deriving_phenomena.py diff --git a/docs/iris/example_code/Meteorology/hovmoller.py b/docs/iris/gallery_code/meteorology/plot_hovmoller.py similarity index 100% rename from docs/iris/example_code/Meteorology/hovmoller.py rename to docs/iris/gallery_code/meteorology/plot_hovmoller.py diff --git a/docs/iris/example_code/Meteorology/lagged_ensemble.py b/docs/iris/gallery_code/meteorology/plot_lagged_ensemble.py similarity index 100% rename from docs/iris/example_code/Meteorology/lagged_ensemble.py rename to docs/iris/gallery_code/meteorology/plot_lagged_ensemble.py diff --git a/docs/iris/example_code/Meteorology/wind_speed.py b/docs/iris/gallery_code/meteorology/plot_wind_speed.py similarity index 100% rename from docs/iris/example_code/Meteorology/wind_speed.py rename to docs/iris/gallery_code/meteorology/plot_wind_speed.py diff --git a/docs/iris/gallery_code/oceanography/README.rst b/docs/iris/gallery_code/oceanography/README.rst new file mode 100644 index 0000000000..0f3adf906b --- /dev/null +++ b/docs/iris/gallery_code/oceanography/README.rst @@ -0,0 +1,3 @@ +Oceanography +------------ + diff --git a/docs/iris/example_code/Oceanography/__init__.py b/docs/iris/gallery_code/oceanography/__init__.py similarity index 100% rename from docs/iris/example_code/Oceanography/__init__.py rename to docs/iris/gallery_code/oceanography/__init__.py diff --git a/docs/iris/example_code/Oceanography/atlantic_profiles.py b/docs/iris/gallery_code/oceanography/plot_atlantic_profiles.py similarity index 100% rename from docs/iris/example_code/Oceanography/atlantic_profiles.py rename to docs/iris/gallery_code/oceanography/plot_atlantic_profiles.py diff --git a/docs/iris/example_code/Oceanography/load_nemo.py b/docs/iris/gallery_code/oceanography/plot_load_nemo.py similarity index 100% rename from docs/iris/example_code/Oceanography/load_nemo.py rename to docs/iris/gallery_code/oceanography/plot_load_nemo.py diff --git a/docs/iris/example_tests/__init__.py b/docs/iris/gallery_tests/__init__.py similarity index 100% rename from docs/iris/example_tests/__init__.py rename to docs/iris/gallery_tests/__init__.py diff --git a/docs/iris/example_tests/extest_util.py b/docs/iris/gallery_tests/gallerytest_util.py similarity index 84% rename from docs/iris/example_tests/extest_util.py rename to docs/iris/gallery_tests/gallerytest_util.py index c96f47ae50..38678fdb18 100644 --- a/docs/iris/example_tests/extest_util.py +++ b/docs/iris/gallery_tests/gallerytest_util.py @@ -6,7 +6,7 @@ """ Provides context managers which are fundamental to the ability -to run the example tests. +to run the gallery tests. """ @@ -23,26 +23,26 @@ import iris.quickplot as qplt -EXAMPLE_DIRECTORY = os.path.join( - os.path.dirname(os.path.dirname(__file__)), "example_code" +GALLERY_DIRECTORY = os.path.join( + os.path.dirname(os.path.dirname(__file__)), "gallery_code" ) -EXAMPLE_DIRECTORIES = [ - os.path.join(EXAMPLE_DIRECTORY, the_dir) - for the_dir in os.listdir(EXAMPLE_DIRECTORY) +GALLERY_DIRECTORIES = [ + os.path.join(GALLERY_DIRECTORY, the_dir) + for the_dir in os.listdir(GALLERY_DIRECTORY) ] @contextlib.contextmanager -def add_examples_to_path(): +def add_gallery_to_path(): """ - Creates a context manager which can be used to add the iris examples - to the PYTHONPATH. The examples are only importable throughout the lifetime + Creates a context manager which can be used to add the iris gallery + to the PYTHONPATH. The gallery entries are only importable throughout the lifetime of this context manager. """ orig_sys_path = sys.path sys.path = sys.path[:] - sys.path += EXAMPLE_DIRECTORIES + sys.path += GALLERY_DIRECTORIES yield sys.path = orig_sys_path diff --git a/docs/iris/example_tests/test_COP_1d_plot.py b/docs/iris/gallery_tests/test_plot_COP_1d.py similarity index 70% rename from docs/iris/example_tests/test_COP_1d_plot.py rename to docs/iris/gallery_tests/test_plot_COP_1d.py index d0e989a3f2..7ad59ba10b 100644 --- a/docs/iris/example_tests/test_COP_1d_plot.py +++ b/docs/iris/gallery_tests/test_plot_COP_1d.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestCOP1DPlot(tests.GraphicsTest): - """Test the COP_1d_plot example code.""" + """Test the COP_1d_plot gallery code.""" - def test_COP_1d_plot(self): + def test_plot_COP_1d(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import COP_1d_plot + with add_gallery_to_path(): + import plot_COP_1d with show_replaced_by_check_graphic(self): - COP_1d_plot.main() + plot_COP_1d.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_COP_maps.py b/docs/iris/gallery_tests/test_plot_COP_maps.py similarity index 70% rename from docs/iris/example_tests/test_COP_maps.py rename to docs/iris/gallery_tests/test_plot_COP_maps.py index 9db5060c89..5252ddfe6f 100644 --- a/docs/iris/example_tests/test_COP_maps.py +++ b/docs/iris/gallery_tests/test_plot_COP_maps.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestCOPMaps(tests.GraphicsTest): - """Test the COP_maps example code.""" + """Test the COP_maps gallery code.""" - def test_cop_maps(self): + def test_plot_cop_maps(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import COP_maps + with add_gallery_to_path(): + import plot_COP_maps with show_replaced_by_check_graphic(self): - COP_maps.main() + plot_COP_maps.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_SOI_filtering.py b/docs/iris/gallery_tests/test_plot_SOI_filtering.py similarity index 68% rename from docs/iris/example_tests/test_SOI_filtering.py rename to docs/iris/gallery_tests/test_plot_SOI_filtering.py index 2d791567b0..384a44ebd8 100644 --- a/docs/iris/example_tests/test_SOI_filtering.py +++ b/docs/iris/gallery_tests/test_plot_SOI_filtering.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestSOIFiltering(tests.GraphicsTest): - """Test the SOI_filtering example code.""" + """Test the SOI_filtering gallery code.""" - def test_soi_filtering(self): + def test_plot_soi_filtering(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import SOI_filtering + with add_gallery_to_path(): + import plot_SOI_filtering with show_replaced_by_check_graphic(self): - SOI_filtering.main() + plot_SOI_filtering.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_TEC.py b/docs/iris/gallery_tests/test_plot_TEC.py similarity index 71% rename from docs/iris/example_tests/test_TEC.py rename to docs/iris/gallery_tests/test_plot_TEC.py index 4bcd70f9f5..2852ab06b9 100644 --- a/docs/iris/example_tests/test_TEC.py +++ b/docs/iris/gallery_tests/test_plot_TEC.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestTEC(tests.GraphicsTest): - """Test the TEC example code.""" + """Test the TEC gallery code.""" - def test_TEC(self): + def test_plot_TEC(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import TEC + with add_gallery_to_path(): + import plot_TEC with show_replaced_by_check_graphic(self): - TEC.main() + plot_TEC.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_anomaly_log_colouring.py b/docs/iris/gallery_tests/test_plot_anomaly_log_colouring.py similarity index 66% rename from docs/iris/example_tests/test_anomaly_log_colouring.py rename to docs/iris/gallery_tests/test_plot_anomaly_log_colouring.py index d0f07b02c4..eaae11f6b5 100644 --- a/docs/iris/example_tests/test_anomaly_log_colouring.py +++ b/docs/iris/gallery_tests/test_plot_anomaly_log_colouring.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestAnomalyLogColouring(tests.GraphicsTest): - """Test the anomaly colouring example code.""" + """Test the anomaly colouring gallery code.""" - def test_anomaly_log_colouring(self): + def test_plot_anomaly_log_colouring(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import anomaly_log_colouring + with add_gallery_to_path(): + import plot_anomaly_log_colouring with show_replaced_by_check_graphic(self): - anomaly_log_colouring.main() + plot_anomaly_log_colouring.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_atlantic_profiles.py b/docs/iris/gallery_tests/test_plot_atlantic_profiles.py similarity index 67% rename from docs/iris/example_tests/test_atlantic_profiles.py rename to docs/iris/gallery_tests/test_plot_atlantic_profiles.py index d85dc72c2c..b69408337b 100644 --- a/docs/iris/example_tests/test_atlantic_profiles.py +++ b/docs/iris/gallery_tests/test_plot_atlantic_profiles.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestAtlanticProfiles(tests.GraphicsTest): - """Test the atlantic_profiles example code.""" + """Test the atlantic_profiles gallery code.""" - def test_atlantic_profiles(self): + def test_plot_atlantic_profiles(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import atlantic_profiles + with add_gallery_to_path(): + import plot_atlantic_profiles with show_replaced_by_check_graphic(self): - atlantic_profiles.main() + plot_atlantic_profiles.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_coriolis_plot.py b/docs/iris/gallery_tests/test_plot_coriolis.py similarity index 59% rename from docs/iris/example_tests/test_coriolis_plot.py rename to docs/iris/gallery_tests/test_plot_coriolis.py index e61fdce81d..2e4cea8a74 100644 --- a/docs/iris/example_tests/test_coriolis_plot.py +++ b/docs/iris/gallery_tests/test_plot_coriolis.py @@ -9,18 +9,18 @@ import iris.tests as tests -from . import extest_util +from . import gallerytest_util -with extest_util.add_examples_to_path(): - import coriolis_plot +with gallerytest_util.add_gallery_to_path(): + import plot_coriolis class TestCoriolisPlot(tests.GraphicsTest): - """Test the Coriolis Plot example code.""" + """Test the Coriolis Plot gallery code.""" - def test_coriolis_plot(self): - with extest_util.show_replaced_by_check_graphic(self): - coriolis_plot.main() + def test_plot_coriolis(self): + with gallerytest_util.show_replaced_by_check_graphic(self): + plot_coriolis.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_cross_section.py b/docs/iris/gallery_tests/test_plot_cross_section.py similarity index 68% rename from docs/iris/example_tests/test_cross_section.py rename to docs/iris/gallery_tests/test_plot_cross_section.py index 7fe13d825f..4b92f5f5fe 100644 --- a/docs/iris/example_tests/test_cross_section.py +++ b/docs/iris/gallery_tests/test_plot_cross_section.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestCrossSection(tests.GraphicsTest): - """Test the cross_section example code.""" + """Test the cross_section gallery code.""" - def test_cross_section(self): + def test_plot_cross_section(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import cross_section + with add_gallery_to_path(): + import plot_cross_section with show_replaced_by_check_graphic(self): - cross_section.main() + plot_cross_section.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_custom_aggregation.py b/docs/iris/gallery_tests/test_plot_custom_aggregation.py similarity index 67% rename from docs/iris/example_tests/test_custom_aggregation.py rename to docs/iris/gallery_tests/test_plot_custom_aggregation.py index 130f46d847..b674f401b4 100644 --- a/docs/iris/example_tests/test_custom_aggregation.py +++ b/docs/iris/gallery_tests/test_plot_custom_aggregation.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestCustomAggregation(tests.GraphicsTest): - """Test the custom aggregation example code.""" + """Test the custom aggregation gallery code.""" - def test_custom_aggregation(self): + def test_plot_custom_aggregation(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import custom_aggregation + with add_gallery_to_path(): + import plot_custom_aggregation with show_replaced_by_check_graphic(self): - custom_aggregation.main() + plot_custom_aggregation.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_custom_file_loading.py b/docs/iris/gallery_tests/test_plot_custom_file_loading.py similarity index 67% rename from docs/iris/example_tests/test_custom_file_loading.py rename to docs/iris/gallery_tests/test_plot_custom_file_loading.py index 9c466c53d6..d580ac9d01 100644 --- a/docs/iris/example_tests/test_custom_file_loading.py +++ b/docs/iris/gallery_tests/test_plot_custom_file_loading.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestCustomFileLoading(tests.GraphicsTest): - """Test the custom_file_loading example code.""" + """Test the custom_file_loading gallery code.""" - def test_custom_file_loading(self): + def test_plot_custom_file_loading(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import custom_file_loading + with add_gallery_to_path(): + import plot_custom_file_loading with show_replaced_by_check_graphic(self): - custom_file_loading.main() + plot_custom_file_loading.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_deriving_phenomena.py b/docs/iris/gallery_tests/test_plot_deriving_phenomena.py similarity index 67% rename from docs/iris/example_tests/test_deriving_phenomena.py rename to docs/iris/gallery_tests/test_plot_deriving_phenomena.py index 63cbf40ec0..b7378da9df 100644 --- a/docs/iris/example_tests/test_deriving_phenomena.py +++ b/docs/iris/gallery_tests/test_plot_deriving_phenomena.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestDerivingPhenomena(tests.GraphicsTest): - """Test the deriving_phenomena example code.""" + """Test the deriving_phenomena gallery code.""" - def test_deriving_phenomena(self): + def test_plot_deriving_phenomena(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import deriving_phenomena + with add_gallery_to_path(): + import plot_deriving_phenomena with show_replaced_by_check_graphic(self): - deriving_phenomena.main() + plot_deriving_phenomena.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_hovmoller.py b/docs/iris/gallery_tests/test_plot_global_map.py similarity index 69% rename from docs/iris/example_tests/test_hovmoller.py rename to docs/iris/gallery_tests/test_plot_global_map.py index b492baebbc..ece1c3a361 100644 --- a/docs/iris/example_tests/test_hovmoller.py +++ b/docs/iris/gallery_tests/test_plot_global_map.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestGlobalMap(tests.GraphicsTest): - """Test the hovmoller example code.""" + """Test the global_map gallery code.""" - def test_hovmoller(self): + def test_plot_global_map(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import hovmoller + with add_gallery_to_path(): + import plot_global_map with show_replaced_by_check_graphic(self): - hovmoller.main() + plot_global_map.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_global_map.py b/docs/iris/gallery_tests/test_plot_hovmoller.py similarity index 69% rename from docs/iris/example_tests/test_global_map.py rename to docs/iris/gallery_tests/test_plot_hovmoller.py index 1ec2a47ef6..23fb741e44 100644 --- a/docs/iris/example_tests/test_global_map.py +++ b/docs/iris/gallery_tests/test_plot_hovmoller.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestGlobalMap(tests.GraphicsTest): - """Test the global_map example code.""" + """Test the hovmoller gallery code.""" - def test_global_map(self): + def test_plot_hovmoller(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import global_map + with add_gallery_to_path(): + import plot_hovmoller with show_replaced_by_check_graphic(self): - global_map.main() + plot_hovmoller.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_inset_plot.py b/docs/iris/gallery_tests/test_plot_inset.py similarity index 70% rename from docs/iris/example_tests/test_inset_plot.py rename to docs/iris/gallery_tests/test_plot_inset.py index 58ef63bcac..e77b629c44 100644 --- a/docs/iris/example_tests/test_inset_plot.py +++ b/docs/iris/gallery_tests/test_plot_inset.py @@ -9,22 +9,22 @@ import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestInsetPlot(tests.GraphicsTest): - """Test the inset plot example code.""" + """Test the inset plot gallery code.""" - def test_inset_plot(self): + def test_plot_inset(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import inset_plot + with add_gallery_to_path(): + import plot_inset with show_replaced_by_check_graphic(self): - inset_plot.main() + plot_inset.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_lagged_ensemble.py b/docs/iris/gallery_tests/test_plot_lagged_ensemble.py similarity index 68% rename from docs/iris/example_tests/test_lagged_ensemble.py rename to docs/iris/gallery_tests/test_plot_lagged_ensemble.py index ecce499dc7..386ad7353c 100644 --- a/docs/iris/example_tests/test_lagged_ensemble.py +++ b/docs/iris/gallery_tests/test_plot_lagged_ensemble.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestLaggedEnsemble(tests.GraphicsTest): - """Test the lagged ensemble example code.""" + """Test the lagged ensemble gallery code.""" - def test_lagged_ensemble(self): + def test_plot_lagged_ensemble(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import lagged_ensemble + with add_gallery_to_path(): + import plot_lagged_ensemble with show_replaced_by_check_graphic(self): - lagged_ensemble.main() + plot_lagged_ensemble.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_lineplot_with_legend.py b/docs/iris/gallery_tests/test_plot_lineplot_with_legend.py similarity index 66% rename from docs/iris/example_tests/test_lineplot_with_legend.py rename to docs/iris/gallery_tests/test_plot_lineplot_with_legend.py index ca246b178a..edb4d7d305 100644 --- a/docs/iris/example_tests/test_lineplot_with_legend.py +++ b/docs/iris/gallery_tests/test_plot_lineplot_with_legend.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestLineplotWithLegend(tests.GraphicsTest): - """Test the lineplot_with_legend example code.""" + """Test the lineplot_with_legend gallery code.""" - def test_lineplot_with_legend(self): + def test_plot_lineplot_with_legend(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import lineplot_with_legend + with add_gallery_to_path(): + import plot_lineplot_with_legend with show_replaced_by_check_graphic(self): - lineplot_with_legend.main() + plot_lineplot_with_legend.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_load_nemo.py b/docs/iris/gallery_tests/test_plot_load_nemo.py similarity index 69% rename from docs/iris/example_tests/test_load_nemo.py rename to docs/iris/gallery_tests/test_plot_load_nemo.py index 3d9b5bba23..58a5bbf72a 100644 --- a/docs/iris/example_tests/test_load_nemo.py +++ b/docs/iris/gallery_tests/test_plot_load_nemo.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestLoadNemo(tests.GraphicsTest): - """Test the load_nemo example code.""" + """Test the load_nemo gallery code.""" - def test_load_nemo(self): + def test_plot_load_nemo(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import load_nemo + with add_gallery_to_path(): + import plot_load_nemo with show_replaced_by_check_graphic(self): - load_nemo.main() + plot_load_nemo.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_orca_projection.py b/docs/iris/gallery_tests/test_plot_orca_projection.py similarity index 68% rename from docs/iris/example_tests/test_orca_projection.py rename to docs/iris/gallery_tests/test_plot_orca_projection.py index 1854f68aa6..2b6fae4b1b 100644 --- a/docs/iris/example_tests/test_orca_projection.py +++ b/docs/iris/gallery_tests/test_plot_orca_projection.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestOrcaProjection(tests.GraphicsTest): - """Test the orca projection example code.""" + """Test the orca projection gallery code.""" - def test_orca_projection(self): + def test_plot_orca_projection(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import orca_projection + with add_gallery_to_path(): + import plot_orca_projection with show_replaced_by_check_graphic(self): - orca_projection.main() + plot_orca_projection.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_polar_stereo.py b/docs/iris/gallery_tests/test_plot_polar_stereo.py similarity index 69% rename from docs/iris/example_tests/test_polar_stereo.py rename to docs/iris/gallery_tests/test_plot_polar_stereo.py index 963d5729fe..3cd7dfa482 100644 --- a/docs/iris/example_tests/test_polar_stereo.py +++ b/docs/iris/gallery_tests/test_plot_polar_stereo.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestPolarStereo(tests.GraphicsTest): - """Test the polar_stereo example code.""" + """Test the polar_stereo gallery code.""" - def test_polar_stereo(self): + def test_plot_polar_stereo(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import polar_stereo + with add_gallery_to_path(): + import plot_polar_stereo with show_replaced_by_check_graphic(self): - polar_stereo.main() + plot_polar_stereo.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_polynomial_fit.py b/docs/iris/gallery_tests/test_plot_polynomial_fit.py similarity index 68% rename from docs/iris/example_tests/test_polynomial_fit.py rename to docs/iris/gallery_tests/test_plot_polynomial_fit.py index 6e1b148e19..5b47b46688 100644 --- a/docs/iris/example_tests/test_polynomial_fit.py +++ b/docs/iris/gallery_tests/test_plot_polynomial_fit.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestPolynomialFit(tests.GraphicsTest): - """Test the polynomial_fit example code.""" + """Test the polynomial_fit gallery code.""" - def test_polynomial_fit(self): + def test_plot_polynomial_fit(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import polynomial_fit + with add_gallery_to_path(): + import plot_polynomial_fit with show_replaced_by_check_graphic(self): - polynomial_fit.main() + plot_polynomial_fit.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_projections_and_annotations.py b/docs/iris/gallery_tests/test_plot_projections_and_annotations.py similarity index 65% rename from docs/iris/example_tests/test_projections_and_annotations.py rename to docs/iris/gallery_tests/test_plot_projections_and_annotations.py index f273e040e4..7052414011 100644 --- a/docs/iris/example_tests/test_projections_and_annotations.py +++ b/docs/iris/gallery_tests/test_plot_projections_and_annotations.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestProjectionsAndAnnotations(tests.GraphicsTest): - """Test the atlantic_profiles example code.""" + """Test the atlantic_profiles gallery code.""" - def test_projections_and_annotations(self): + def test_plot_projections_and_annotations(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import projections_and_annotations + with add_gallery_to_path(): + import plot_projections_and_annotations with show_replaced_by_check_graphic(self): - projections_and_annotations.main() + plot_projections_and_annotations.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_rotated_pole_mapping.py b/docs/iris/gallery_tests/test_plot_rotated_pole_mapping.py similarity index 66% rename from docs/iris/example_tests/test_rotated_pole_mapping.py rename to docs/iris/gallery_tests/test_plot_rotated_pole_mapping.py index 4395b0519a..fa11a60a9c 100644 --- a/docs/iris/example_tests/test_rotated_pole_mapping.py +++ b/docs/iris/gallery_tests/test_plot_rotated_pole_mapping.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestRotatedPoleMapping(tests.GraphicsTest): - """Test the rotated_pole_mapping example code.""" + """Test the rotated_pole_mapping gallery code.""" - def test_rotated_pole_mapping(self): + def test_plot_rotated_pole_mapping(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import rotated_pole_mapping + with add_gallery_to_path(): + import plot_rotated_pole_mapping with show_replaced_by_check_graphic(self): - rotated_pole_mapping.main() + plot_rotated_pole_mapping.main() if __name__ == "__main__": diff --git a/docs/iris/example_tests/test_wind_speed.py b/docs/iris/gallery_tests/test_plot_wind_speed.py similarity index 69% rename from docs/iris/example_tests/test_wind_speed.py rename to docs/iris/gallery_tests/test_plot_wind_speed.py index 1cd4402fdb..7a0be601a5 100644 --- a/docs/iris/example_tests/test_wind_speed.py +++ b/docs/iris/gallery_tests/test_plot_wind_speed.py @@ -8,22 +8,22 @@ # importing anything else. import iris.tests as tests -from .extest_util import ( - add_examples_to_path, +from .gallerytest_util import ( + add_gallery_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestWindSpeed(tests.GraphicsTest): - """Test the wind_speed example code.""" + """Test the wind_speed gallery code.""" - def test_wind_speed(self): + def test_plot_wind_speed(self): with fail_any_deprecation_warnings(): - with add_examples_to_path(): - import wind_speed + with add_gallery_to_path(): + import plot_wind_speed with show_replaced_by_check_graphic(self): - wind_speed.main() + plot_wind_speed.main() if __name__ == "__main__": diff --git a/docs/iris/src/Makefile b/docs/iris/src/Makefile index 53d224874d..5589cce730 100644 --- a/docs/iris/src/Makefile +++ b/docs/iris/src/Makefile @@ -2,18 +2,18 @@ # # You can set these variables from the command line. -SPHINXOPTS = +SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = -BUILDDIR = ../build -SRCDIR = ./ +BUILDDIR = _build +SRCDIR = . # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest +.PHONY: help clean html html-noplot dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @@ -35,34 +35,38 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: - -rm -rf $(BUILDDIR)/* - -rm -rf $(SRCDIR)/iris - -rm -rf $(SRCDIR)/examples $(SRCDIR)/_templates/gallery.html $(SRCDIR)/_static/random_image.js $(SRCDIR)/_static/random.js + -rm -rf $(BUILDDIR) + -rm -rf $(SRCDIR)/generated html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html" + +html-noplot: + $(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML (no gallery) pages are in $(BUILDDIR)/html" dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml" singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml" pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo - @echo "Build finished; now you can process the pickle files." + @echo "Build finished; now you can process the pickle files" json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo - @echo "Build finished; now you can process the JSON files." + @echo "Build finished; now you can process the JSON files" htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @@ -91,7 +95,7 @@ devhelp: epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + @echo "Build finished. The epub file is in $(BUILDDIR)/epub" latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @@ -104,7 +108,7 @@ latexpdf: latex $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex" text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @@ -114,7 +118,7 @@ text: man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + @echo "Build finished. The manual pages are in $(BUILDDIR)/man" changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes diff --git a/docs/iris/src/_static/copybutton.js b/docs/iris/src/_static/copybutton.js deleted file mode 100644 index 6800c3cb93..0000000000 --- a/docs/iris/src/_static/copybutton.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2013 PSF. Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 -// File originates from the cpython source found in Doc/tools/sphinxext/static/copybutton.js - -$(document).ready(function() { - /* Add a [>>>] button on the top-right corner of code samples to hide - * the >>> and ... prompts and the output and thus make the code - * copyable. */ - var div = $('.highlight-python .highlight,' + - '.highlight-python3 .highlight') - var pre = div.find('pre'); - - // get the styles from the current theme - pre.parent().parent().css('position', 'relative'); - var hide_text = 'Hide the prompts and output'; - var show_text = 'Show the prompts and output'; - var border_width = pre.css('border-top-width'); - var border_style = pre.css('border-top-style'); - var border_color = pre.css('border-top-color'); - var button_styles = { - 'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0', - 'border-color': border_color, 'border-style': border_style, - 'border-width': border_width, 'color': border_color, 'text-size': '75%', - 'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em' - } - - // create and add the button to all the code blocks that contain >>> - div.each(function(index) { - var jthis = $(this); - if (jthis.find('.gp').length > 0) { - var button = $('>>>'); - button.css(button_styles) - button.attr('title', hide_text); - jthis.prepend(button); - } - // tracebacks (.gt) contain bare text elements that need to be - // wrapped in a span to work with .nextUntil() (see later) - jthis.find('pre:has(.gt)').contents().filter(function() { - return ((this.nodeType == 3) && (this.data.trim().length > 0)); - }).wrap(''); - }); - - // define the behavior of the button when it's clicked - $('.copybutton').toggle( - function() { - var button = $(this); - button.parent().find('.go, .gp, .gt').hide(); - button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden'); - button.css('text-decoration', 'line-through'); - button.attr('title', show_text); - }, - function() { - var button = $(this); - button.parent().find('.go, .gp, .gt').show(); - button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible'); - button.css('text-decoration', 'none'); - button.attr('title', hide_text); - }); -}); - diff --git a/docs/iris/src/_static/favicon-16x16.png b/docs/iris/src/_static/favicon-16x16.png deleted file mode 100644 index e2ea456770..0000000000 Binary files a/docs/iris/src/_static/favicon-16x16.png and /dev/null differ diff --git a/docs/iris/src/_static/favicon-32x32.png b/docs/iris/src/_static/favicon-32x32.png deleted file mode 100644 index 2f90c60eb5..0000000000 Binary files a/docs/iris/src/_static/favicon-32x32.png and /dev/null differ diff --git a/docs/iris/src/_static/favicon.ico b/docs/iris/src/_static/favicon.ico new file mode 100644 index 0000000000..0e5f0492b4 Binary files /dev/null and b/docs/iris/src/_static/favicon.ico differ diff --git a/docs/iris/src/_static/iris-logo-title.png b/docs/iris/src/_static/iris-logo-title.png new file mode 100644 index 0000000000..e517aa7784 Binary files /dev/null and b/docs/iris/src/_static/iris-logo-title.png differ diff --git a/docs/iris/src/_static/iris-logo-title.svg b/docs/iris/src/_static/iris-logo-title.svg new file mode 100644 index 0000000000..60ba0a1118 --- /dev/null +++ b/docs/iris/src/_static/iris-logo-title.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Iris + + diff --git a/docs/iris/src/_static/iris_colour_logo_centred.png b/docs/iris/src/_static/iris_colour_logo_centred.png deleted file mode 100755 index 2a1bebc5f3..0000000000 Binary files a/docs/iris/src/_static/iris_colour_logo_centred.png and /dev/null differ diff --git a/docs/iris/src/_static/jquery.cycle.all.latest.js b/docs/iris/src/_static/jquery.cycle.all.latest.js deleted file mode 100644 index 75d7ab98f8..0000000000 --- a/docs/iris/src/_static/jquery.cycle.all.latest.js +++ /dev/null @@ -1,1331 +0,0 @@ -/*! - * jQuery Cycle Plugin (with Transition Definitions) - * Examples and documentation at: http://jquery.malsup.com/cycle/ - * Copyright (c) 2007-2010 M. Alsup - * Version: 2.88 (08-JUN-2010) - * Dual licensed under the MIT and GPL licenses. - * http://jquery.malsup.com/license.html - * Requires: jQuery v1.2.6 or later - */ -;(function($) { - -var ver = '2.88'; - -// if $.support is not defined (pre jQuery 1.3) add what I need -if ($.support == undefined) { - $.support = { - opacity: !($.browser.msie) - }; -} - -function debug(s) { - if ($.fn.cycle.debug) - log(s); -} -function log() { - if (window.console && window.console.log) - window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' ')); -}; - -// the options arg can be... -// a number - indicates an immediate transition should occur to the given slide index -// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc) -// an object - properties to control the slideshow -// -// the arg2 arg can be... -// the name of an fx (only used in conjunction with a numeric value for 'options') -// the value true (only used in first arg == 'resume') and indicates -// that the resume should occur immediately (not wait for next timeout) - -$.fn.cycle = function(options, arg2) { - var o = { s: this.selector, c: this.context }; - - // in 1.3+ we can fix mistakes with the ready state - if (this.length === 0 && options != 'stop') { - if (!$.isReady && o.s) { - log('DOM not ready, queuing slideshow'); - $(function() { - $(o.s,o.c).cycle(options,arg2); - }); - return this; - } - // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() - log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); - return this; - } - - // iterate the matched nodeset - return this.each(function() { - var opts = handleArguments(this, options, arg2); - if (opts === false) - return; - - opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink; - - // stop existing slideshow for this container (if there is one) - if (this.cycleTimeout) - clearTimeout(this.cycleTimeout); - this.cycleTimeout = this.cyclePause = 0; - - var $cont = $(this); - var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children(); - var els = $slides.get(); - if (els.length < 2) { - log('terminating; too few slides: ' + els.length); - return; - } - - var opts2 = buildOptions($cont, $slides, els, opts, o); - if (opts2 === false) - return; - - var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.rev); - - // if it's an auto slideshow, kick it off - if (startTime) { - startTime += (opts2.delay || 0); - if (startTime < 10) - startTime = 10; - debug('first timeout: ' + startTime); - this.cycleTimeout = setTimeout(function(){go(els,opts2,0,(!opts2.rev && !opts.backwards))}, startTime); - } - }); -}; - -// process the args that were passed to the plugin fn -function handleArguments(cont, options, arg2) { - if (cont.cycleStop == undefined) - cont.cycleStop = 0; - if (options === undefined || options === null) - options = {}; - if (options.constructor == String) { - switch(options) { - case 'destroy': - case 'stop': - var opts = $(cont).data('cycle.opts'); - if (!opts) - return false; - cont.cycleStop++; // callbacks look for change - if (cont.cycleTimeout) - clearTimeout(cont.cycleTimeout); - cont.cycleTimeout = 0; - $(cont).removeData('cycle.opts'); - if (options == 'destroy') - destroy(opts); - return false; - case 'toggle': - cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1; - checkInstantResume(cont.cyclePause, arg2, cont); - return false; - case 'pause': - cont.cyclePause = 1; - return false; - case 'resume': - cont.cyclePause = 0; - checkInstantResume(false, arg2, cont); - return false; - case 'prev': - case 'next': - var opts = $(cont).data('cycle.opts'); - if (!opts) { - log('options not found, "prev/next" ignored'); - return false; - } - $.fn.cycle[options](opts); - return false; - default: - options = { fx: options }; - }; - return options; - } - else if (options.constructor == Number) { - // go to the requested slide - var num = options; - options = $(cont).data('cycle.opts'); - if (!options) { - log('options not found, can not advance slide'); - return false; - } - if (num < 0 || num >= options.elements.length) { - log('invalid slide index: ' + num); - return false; - } - options.nextSlide = num; - if (cont.cycleTimeout) { - clearTimeout(cont.cycleTimeout); - cont.cycleTimeout = 0; - } - if (typeof arg2 == 'string') - options.oneTimeFx = arg2; - go(options.elements, options, 1, num >= options.currSlide); - return false; - } - return options; - - function checkInstantResume(isPaused, arg2, cont) { - if (!isPaused && arg2 === true) { // resume now! - var options = $(cont).data('cycle.opts'); - if (!options) { - log('options not found, can not resume'); - return false; - } - if (cont.cycleTimeout) { - clearTimeout(cont.cycleTimeout); - cont.cycleTimeout = 0; - } - go(options.elements, options, 1, (!opts.rev && !opts.backwards)); - } - } -}; - -function removeFilter(el, opts) { - if (!$.support.opacity && opts.cleartype && el.style.filter) { - try { el.style.removeAttribute('filter'); } - catch(smother) {} // handle old opera versions - } -}; - -// unbind event handlers -function destroy(opts) { - if (opts.next) - $(opts.next).unbind(opts.prevNextEvent); - if (opts.prev) - $(opts.prev).unbind(opts.prevNextEvent); - - if (opts.pager || opts.pagerAnchorBuilder) - $.each(opts.pagerAnchors || [], function() { - this.unbind().remove(); - }); - opts.pagerAnchors = null; - if (opts.destroy) // callback - opts.destroy(opts); -}; - -// one-time initialization -function buildOptions($cont, $slides, els, options, o) { - // support metadata plugin (v1.0 and v2.0) - var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); - if (opts.autostop) - opts.countdown = opts.autostopCount || els.length; - - var cont = $cont[0]; - $cont.data('cycle.opts', opts); - opts.$cont = $cont; - opts.stopCount = cont.cycleStop; - opts.elements = els; - opts.before = opts.before ? [opts.before] : []; - opts.after = opts.after ? [opts.after] : []; - opts.after.unshift(function(){ opts.busy=0; }); - - // push some after callbacks - if (!$.support.opacity && opts.cleartype) - opts.after.push(function() { removeFilter(this, opts); }); - if (opts.continuous) - opts.after.push(function() { go(els,opts,0,(!opts.rev && !opts.backwards)); }); - - saveOriginalOpts(opts); - - // clearType corrections - if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) - clearTypeFix($slides); - - // container requires non-static position so that slides can be position within - if ($cont.css('position') == 'static') - $cont.css('position', 'relative'); - if (opts.width) - $cont.width(opts.width); - if (opts.height && opts.height != 'auto') - $cont.height(opts.height); - - if (opts.startingSlide) - opts.startingSlide = parseInt(opts.startingSlide); - else if (opts.backwards) - opts.startingSlide = els.length - 1; - - // if random, mix up the slide array - if (opts.random) { - opts.randomMap = []; - for (var i = 0; i < els.length; i++) - opts.randomMap.push(i); - opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); - opts.randomIndex = 1; - opts.startingSlide = opts.randomMap[1]; - } - else if (opts.startingSlide >= els.length) - opts.startingSlide = 0; // catch bogus input - opts.currSlide = opts.startingSlide || 0; - var first = opts.startingSlide; - - // set position and zIndex on all the slides - $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) { - var z; - if (opts.backwards) - z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i; - else - z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i; - $(this).css('z-index', z) - }); - - // make sure first slide is visible - $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case - removeFilter(els[first], opts); - - // stretch slides - if (opts.fit && opts.width) - $slides.width(opts.width); - if (opts.fit && opts.height && opts.height != 'auto') - $slides.height(opts.height); - - // stretch container - var reshape = opts.containerResize && !$cont.innerHeight(); - if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9 - var maxw = 0, maxh = 0; - for(var j=0; j < els.length; j++) { - var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight(); - if (!w) w = e.offsetWidth || e.width || $e.attr('width') - if (!h) h = e.offsetHeight || e.height || $e.attr('height'); - maxw = w > maxw ? w : maxw; - maxh = h > maxh ? h : maxh; - } - if (maxw > 0 && maxh > 0) - $cont.css({width:maxw+'px',height:maxh+'px'}); - } - - if (opts.pause) - $cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;}); - - if (supportMultiTransitions(opts) === false) - return false; - - // apparently a lot of people use image slideshows without height/width attributes on the images. - // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that. - var requeue = false; - options.requeueAttempts = options.requeueAttempts || 0; - $slides.each(function() { - // try to get height/width of each slide - var $el = $(this); - this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0); - this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0); - - if ( $el.is('img') ) { - // sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when - // an image is being downloaded and the markup did not include sizing info (height/width attributes); - // there seems to be some "default" sizes used in this situation - var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete); - var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete); - var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete); - var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete); - // don't requeue for images that are still loading but have a valid size - if (loadingIE || loadingFF || loadingOp || loadingOther) { - if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever - log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH); - setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout); - requeue = true; - return false; // break each loop - } - else { - log('could not determine size of image: '+this.src, this.cycleW, this.cycleH); - } - } - } - return true; - }); - - if (requeue) - return false; - - opts.cssBefore = opts.cssBefore || {}; - opts.animIn = opts.animIn || {}; - opts.animOut = opts.animOut || {}; - - $slides.not(':eq('+first+')').css(opts.cssBefore); - if (opts.cssFirst) - $($slides[first]).css(opts.cssFirst); - - if (opts.timeout) { - opts.timeout = parseInt(opts.timeout); - // ensure that timeout and speed settings are sane - if (opts.speed.constructor == String) - opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed); - if (!opts.sync) - opts.speed = opts.speed / 2; - - var buffer = opts.fx == 'shuffle' ? 500 : 250; - while((opts.timeout - opts.speed) < buffer) // sanitize timeout - opts.timeout += opts.speed; - } - if (opts.easing) - opts.easeIn = opts.easeOut = opts.easing; - if (!opts.speedIn) - opts.speedIn = opts.speed; - if (!opts.speedOut) - opts.speedOut = opts.speed; - - opts.slideCount = els.length; - opts.currSlide = opts.lastSlide = first; - if (opts.random) { - if (++opts.randomIndex == els.length) - opts.randomIndex = 0; - opts.nextSlide = opts.randomMap[opts.randomIndex]; - } - else if (opts.backwards) - opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1; - else - opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1; - - // run transition init fn - if (!opts.multiFx) { - var init = $.fn.cycle.transitions[opts.fx]; - if ($.isFunction(init)) - init($cont, $slides, opts); - else if (opts.fx != 'custom' && !opts.multiFx) { - log('unknown transition: ' + opts.fx,'; slideshow terminating'); - return false; - } - } - - // fire artificial events - var e0 = $slides[first]; - if (opts.before.length) - opts.before[0].apply(e0, [e0, e0, opts, true]); - if (opts.after.length > 1) - opts.after[1].apply(e0, [e0, e0, opts, true]); - - if (opts.next) - $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1)}); - if (opts.prev) - $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1)}); - if (opts.pager || opts.pagerAnchorBuilder) - buildPager(els,opts); - - exposeAddSlide(opts, els); - - return opts; -}; - -// save off original opts so we can restore after clearing state -function saveOriginalOpts(opts) { - opts.original = { before: [], after: [] }; - opts.original.cssBefore = $.extend({}, opts.cssBefore); - opts.original.cssAfter = $.extend({}, opts.cssAfter); - opts.original.animIn = $.extend({}, opts.animIn); - opts.original.animOut = $.extend({}, opts.animOut); - $.each(opts.before, function() { opts.original.before.push(this); }); - $.each(opts.after, function() { opts.original.after.push(this); }); -}; - -function supportMultiTransitions(opts) { - var i, tx, txs = $.fn.cycle.transitions; - // look for multiple effects - if (opts.fx.indexOf(',') > 0) { - opts.multiFx = true; - opts.fxs = opts.fx.replace(/\s*/g,'').split(','); - // discard any bogus effect names - for (i=0; i < opts.fxs.length; i++) { - var fx = opts.fxs[i]; - tx = txs[fx]; - if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { - log('discarding unknown transition: ',fx); - opts.fxs.splice(i,1); - i--; - } - } - // if we have an empty list then we threw everything away! - if (!opts.fxs.length) { - log('No valid transitions named; slideshow terminating.'); - return false; - } - } - else if (opts.fx == 'all') { // auto-gen the list of transitions - opts.multiFx = true; - opts.fxs = []; - for (p in txs) { - tx = txs[p]; - if (txs.hasOwnProperty(p) && $.isFunction(tx)) - opts.fxs.push(p); - } - } - if (opts.multiFx && opts.randomizeEffects) { - // munge the fxs array to make effect selection random - var r1 = Math.floor(Math.random() * 20) + 30; - for (i = 0; i < r1; i++) { - var r2 = Math.floor(Math.random() * opts.fxs.length); - opts.fxs.push(opts.fxs.splice(r2,1)[0]); - } - debug('randomized fx sequence: ',opts.fxs); - } - return true; -}; - -// provide a mechanism for adding slides after the slideshow has started -function exposeAddSlide(opts, els) { - opts.addSlide = function(newSlide, prepend) { - var $s = $(newSlide), s = $s[0]; - if (!opts.autostopCount) - opts.countdown++; - els[prepend?'unshift':'push'](s); - if (opts.els) - opts.els[prepend?'unshift':'push'](s); // shuffle needs this - opts.slideCount = els.length; - - $s.css('position','absolute'); - $s[prepend?'prependTo':'appendTo'](opts.$cont); - - if (prepend) { - opts.currSlide++; - opts.nextSlide++; - } - - if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) - clearTypeFix($s); - - if (opts.fit && opts.width) - $s.width(opts.width); - if (opts.fit && opts.height && opts.height != 'auto') - $slides.height(opts.height); - s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); - s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); - - $s.css(opts.cssBefore); - - if (opts.pager || opts.pagerAnchorBuilder) - $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts); - - if ($.isFunction(opts.onAddSlide)) - opts.onAddSlide($s); - else - $s.hide(); // default behavior - }; -} - -// reset internal state; we do this on every pass in order to support multiple effects -$.fn.cycle.resetState = function(opts, fx) { - fx = fx || opts.fx; - opts.before = []; opts.after = []; - opts.cssBefore = $.extend({}, opts.original.cssBefore); - opts.cssAfter = $.extend({}, opts.original.cssAfter); - opts.animIn = $.extend({}, opts.original.animIn); - opts.animOut = $.extend({}, opts.original.animOut); - opts.fxFn = null; - $.each(opts.original.before, function() { opts.before.push(this); }); - $.each(opts.original.after, function() { opts.after.push(this); }); - - // re-init - var init = $.fn.cycle.transitions[fx]; - if ($.isFunction(init)) - init(opts.$cont, $(opts.elements), opts); -}; - -// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt -function go(els, opts, manual, fwd) { - // opts.busy is true if we're in the middle of an animation - if (manual && opts.busy && opts.manualTrump) { - // let manual transitions requests trump active ones - debug('manualTrump in go(), stopping active transition'); - $(els).stop(true,true); - opts.busy = false; - } - // don't begin another timeout-based transition if there is one active - if (opts.busy) { - debug('transition active, ignoring new tx request'); - return; - } - - var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; - - // stop cycling if we have an outstanding stop request - if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) - return; - - // check to see if we should stop cycling based on autostop options - if (!manual && !p.cyclePause && !opts.bounce && - ((opts.autostop && (--opts.countdown <= 0)) || - (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { - if (opts.end) - opts.end(opts); - return; - } - - // if slideshow is paused, only transition on a manual trigger - var changed = false; - if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) { - changed = true; - var fx = opts.fx; - // keep trying to get the slide size if we don't have it yet - curr.cycleH = curr.cycleH || $(curr).height(); - curr.cycleW = curr.cycleW || $(curr).width(); - next.cycleH = next.cycleH || $(next).height(); - next.cycleW = next.cycleW || $(next).width(); - - // support multiple transition types - if (opts.multiFx) { - if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length) - opts.lastFx = 0; - fx = opts.fxs[opts.lastFx]; - opts.currFx = fx; - } - - // one-time fx overrides apply to: $('div').cycle(3,'zoom'); - if (opts.oneTimeFx) { - fx = opts.oneTimeFx; - opts.oneTimeFx = null; - } - - $.fn.cycle.resetState(opts, fx); - - // run the before callbacks - if (opts.before.length) - $.each(opts.before, function(i,o) { - if (p.cycleStop != opts.stopCount) return; - o.apply(next, [curr, next, opts, fwd]); - }); - - // stage the after callacks - var after = function() { - $.each(opts.after, function(i,o) { - if (p.cycleStop != opts.stopCount) return; - o.apply(next, [curr, next, opts, fwd]); - }); - }; - - debug('tx firing; currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide); - - // get ready to perform the transition - opts.busy = 1; - if (opts.fxFn) // fx function provided? - opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent); - else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ? - $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent); - else - $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent); - } - - if (changed || opts.nextSlide == opts.currSlide) { - // calculate the next slide - opts.lastSlide = opts.currSlide; - if (opts.random) { - opts.currSlide = opts.nextSlide; - if (++opts.randomIndex == els.length) - opts.randomIndex = 0; - opts.nextSlide = opts.randomMap[opts.randomIndex]; - if (opts.nextSlide == opts.currSlide) - opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1; - } - else if (opts.backwards) { - var roll = (opts.nextSlide - 1) < 0; - if (roll && opts.bounce) { - opts.backwards = !opts.backwards; - opts.nextSlide = 1; - opts.currSlide = 0; - } - else { - opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1; - opts.currSlide = roll ? 0 : opts.nextSlide+1; - } - } - else { // sequence - var roll = (opts.nextSlide + 1) == els.length; - if (roll && opts.bounce) { - opts.backwards = !opts.backwards; - opts.nextSlide = els.length-2; - opts.currSlide = els.length-1; - } - else { - opts.nextSlide = roll ? 0 : opts.nextSlide+1; - opts.currSlide = roll ? els.length-1 : opts.nextSlide-1; - } - } - } - if (changed && opts.pager) - opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass); - - // stage the next transition - var ms = 0; - if (opts.timeout && !opts.continuous) - ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd); - else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic - ms = 10; - if (ms > 0) - p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, (!opts.rev && !opts.backwards)) }, ms); -}; - -// invoked after transition -$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) { - $(pager).each(function() { - $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName); - }); -}; - -// calculate timeout value for current transition -function getTimeout(curr, next, opts, fwd) { - if (opts.timeoutFn) { - // call user provided calc fn - var t = opts.timeoutFn.call(curr,curr,next,opts,fwd); - while ((t - opts.speed) < 250) // sanitize timeout - t += opts.speed; - debug('calculated timeout: ' + t + '; speed: ' + opts.speed); - if (t !== false) - return t; - } - return opts.timeout; -}; - -// expose next/prev function, caller must pass in state -$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); }; -$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);}; - -// advance slide forward or back -function advance(opts, val) { - var els = opts.elements; - var p = opts.$cont[0], timeout = p.cycleTimeout; - if (timeout) { - clearTimeout(timeout); - p.cycleTimeout = 0; - } - if (opts.random && val < 0) { - // move back to the previously display slide - opts.randomIndex--; - if (--opts.randomIndex == -2) - opts.randomIndex = els.length-2; - else if (opts.randomIndex == -1) - opts.randomIndex = els.length-1; - opts.nextSlide = opts.randomMap[opts.randomIndex]; - } - else if (opts.random) { - opts.nextSlide = opts.randomMap[opts.randomIndex]; - } - else { - opts.nextSlide = opts.currSlide + val; - if (opts.nextSlide < 0) { - if (opts.nowrap) return false; - opts.nextSlide = els.length - 1; - } - else if (opts.nextSlide >= els.length) { - if (opts.nowrap) return false; - opts.nextSlide = 0; - } - } - - var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated - if ($.isFunction(cb)) - cb(val > 0, opts.nextSlide, els[opts.nextSlide]); - go(els, opts, 1, val>=0); - return false; -}; - -function buildPager(els, opts) { - var $p = $(opts.pager); - $.each(els, function(i,o) { - $.fn.cycle.createPagerAnchor(i,o,$p,els,opts); - }); - opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass); -}; - -$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) { - var a; - if ($.isFunction(opts.pagerAnchorBuilder)) { - a = opts.pagerAnchorBuilder(i,el); - debug('pagerAnchorBuilder('+i+', el) returned: ' + a); - } - else - a = ''+(i+1)+''; - - if (!a) - return; - var $a = $(a); - // don't reparent if anchor is in the dom - if ($a.parents('body').length === 0) { - var arr = []; - if ($p.length > 1) { - $p.each(function() { - var $clone = $a.clone(true); - $(this).append($clone); - arr.push($clone[0]); - }); - $a = $(arr); - } - else { - $a.appendTo($p); - } - } - - opts.pagerAnchors = opts.pagerAnchors || []; - opts.pagerAnchors.push($a); - $a.bind(opts.pagerEvent, function(e) { - e.preventDefault(); - opts.nextSlide = i; - var p = opts.$cont[0], timeout = p.cycleTimeout; - if (timeout) { - clearTimeout(timeout); - p.cycleTimeout = 0; - } - var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated - if ($.isFunction(cb)) - cb(opts.nextSlide, els[opts.nextSlide]); - go(els,opts,1,opts.currSlide < i); // trigger the trans -// return false; // <== allow bubble - }); - - if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble) - $a.bind('click.cycle', function(){return false;}); // suppress click - - if (opts.pauseOnPagerHover) - $a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } ); -}; - -// helper fn to calculate the number of slides between the current and the next -$.fn.cycle.hopsFromLast = function(opts, fwd) { - var hops, l = opts.lastSlide, c = opts.currSlide; - if (fwd) - hops = c > l ? c - l : opts.slideCount - l; - else - hops = c < l ? l - c : l + opts.slideCount - c; - return hops; -}; - -// fix clearType problems in ie6 by setting an explicit bg color -// (otherwise text slides look horrible during a fade transition) -function clearTypeFix($slides) { - debug('applying clearType background-color hack'); - function hex(s) { - s = parseInt(s).toString(16); - return s.length < 2 ? '0'+s : s; - }; - function getBg(e) { - for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) { - var v = $.css(e,'background-color'); - if (v.indexOf('rgb') >= 0 ) { - var rgb = v.match(/\d+/g); - return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); - } - if (v && v != 'transparent') - return v; - } - return '#ffffff'; - }; - $slides.each(function() { $(this).css('background-color', getBg(this)); }); -}; - -// reset common props before the next transition -$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) { - $(opts.elements).not(curr).hide(); - opts.cssBefore.opacity = 1; - opts.cssBefore.display = 'block'; - if (w !== false && next.cycleW > 0) - opts.cssBefore.width = next.cycleW; - if (h !== false && next.cycleH > 0) - opts.cssBefore.height = next.cycleH; - opts.cssAfter = opts.cssAfter || {}; - opts.cssAfter.display = 'none'; - $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0)); - $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1)); -}; - -// the actual fn for effecting a transition -$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) { - var $l = $(curr), $n = $(next); - var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut; - $n.css(opts.cssBefore); - if (speedOverride) { - if (typeof speedOverride == 'number') - speedIn = speedOut = speedOverride; - else - speedIn = speedOut = 1; - easeIn = easeOut = null; - } - var fn = function() {$n.animate(opts.animIn, speedIn, easeIn, cb)}; - $l.animate(opts.animOut, speedOut, easeOut, function() { - if (opts.cssAfter) $l.css(opts.cssAfter); - if (!opts.sync) fn(); - }); - if (opts.sync) fn(); -}; - -// transition definitions - only fade is defined here, transition pack defines the rest -$.fn.cycle.transitions = { - fade: function($cont, $slides, opts) { - $slides.not(':eq('+opts.currSlide+')').css('opacity',0); - opts.before.push(function(curr,next,opts) { - $.fn.cycle.commonReset(curr,next,opts); - opts.cssBefore.opacity = 0; - }); - opts.animIn = { opacity: 1 }; - opts.animOut = { opacity: 0 }; - opts.cssBefore = { top: 0, left: 0 }; - } -}; - -$.fn.cycle.ver = function() { return ver; }; - -// override these globally if you like (they are all optional) -$.fn.cycle.defaults = { - fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle') - timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance) - timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag) - continuous: 0, // true to start next transition immediately after current one completes - speed: 1000, // speed of the transition (any valid fx speed value) - speedIn: null, // speed of the 'in' transition - speedOut: null, // speed of the 'out' transition - next: null, // selector for element to use as event trigger for next slide - prev: null, // selector for element to use as event trigger for previous slide -// prevNextClick: null, // @deprecated; please use onPrevNextEvent instead - onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement) - prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide - pager: null, // selector for element to use as pager container - //pagerClick null, // @deprecated; please use onPagerEvent instead - onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement) - pagerEvent: 'click.cycle', // name of event which drives the pager navigation - allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling - pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement) - before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag) - after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag) - end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) - easing: null, // easing method for both in and out transitions - easeIn: null, // easing for "in" transition - easeOut: null, // easing for "out" transition - shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 } - animIn: null, // properties that define how the slide animates in - animOut: null, // properties that define how the slide animates out - cssBefore: null, // properties that define the initial state of the slide before transitioning in - cssAfter: null, // properties that defined the state of the slide after transitioning out - fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) - height: 'auto', // container height - startingSlide: 0, // zero-based index of the first slide to be displayed - sync: 1, // true if in/out transitions should occur simultaneously - random: 0, // true for random, false for sequence (not applicable to shuffle fx) - fit: 0, // force slides to fit container - containerResize: 1, // resize container to fit largest slide - pause: 0, // true to enable "pause on hover" - pauseOnPagerHover: 0, // true to pause when hovering over pager link - autostop: 0, // true to end slideshow after X transitions (where X == slide count) - autostopCount: 0, // number of transitions (optionally used with autostop to define X) - delay: 0, // additional delay (in ms) for first transition (hint: can be negative) - slideExpr: null, // expression for selecting slides (if something other than all children is required) - cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE) - cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides) - nowrap: 0, // true to prevent slideshow from wrapping - fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms - randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random - rev: 0, // causes animations to transition in reverse - manualTrump: true, // causes manual transition to stop an active transition instead of being ignored - requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded - requeueTimeout: 250, // ms delay for requeue - activePagerClass: 'activeSlide', // class name used for the active pager link - updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style) - backwards: false // true to start slideshow at last slide and move backwards through the stack -}; - -})(jQuery); - - -/*! - * jQuery Cycle Plugin Transition Definitions - * This script is a plugin for the jQuery Cycle Plugin - * Examples and documentation at: http://malsup.com/jquery/cycle/ - * Copyright (c) 2007-2010 M. Alsup - * Version: 2.72 - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ -(function($) { - -// -// These functions define one-time slide initialization for the named -// transitions. To save file size feel free to remove any of these that you -// don't need. -// -$.fn.cycle.transitions.none = function($cont, $slides, opts) { - opts.fxFn = function(curr,next,opts,after){ - $(next).show(); - $(curr).hide(); - after(); - }; -} - -// scrollUp/Down/Left/Right -$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) { - $cont.css('overflow','hidden'); - opts.before.push($.fn.cycle.commonReset); - var h = $cont.height(); - opts.cssBefore ={ top: h, left: 0 }; - opts.cssFirst = { top: 0 }; - opts.animIn = { top: 0 }; - opts.animOut = { top: -h }; -}; -$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) { - $cont.css('overflow','hidden'); - opts.before.push($.fn.cycle.commonReset); - var h = $cont.height(); - opts.cssFirst = { top: 0 }; - opts.cssBefore= { top: -h, left: 0 }; - opts.animIn = { top: 0 }; - opts.animOut = { top: h }; -}; -$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) { - $cont.css('overflow','hidden'); - opts.before.push($.fn.cycle.commonReset); - var w = $cont.width(); - opts.cssFirst = { left: 0 }; - opts.cssBefore= { left: w, top: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { left: 0-w }; -}; -$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) { - $cont.css('overflow','hidden'); - opts.before.push($.fn.cycle.commonReset); - var w = $cont.width(); - opts.cssFirst = { left: 0 }; - opts.cssBefore= { left: -w, top: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { left: w }; -}; -$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) { - $cont.css('overflow','hidden').width(); - opts.before.push(function(curr, next, opts, fwd) { - $.fn.cycle.commonReset(curr,next,opts); - opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW); - opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; - }); - opts.cssFirst = { left: 0 }; - opts.cssBefore= { top: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { top: 0 }; -}; -$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) { - $cont.css('overflow','hidden'); - opts.before.push(function(curr, next, opts, fwd) { - $.fn.cycle.commonReset(curr,next,opts); - opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1); - opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH; - }); - opts.cssFirst = { top: 0 }; - opts.cssBefore= { left: 0 }; - opts.animIn = { top: 0 }; - opts.animOut = { left: 0 }; -}; - -// slideX/slideY -$.fn.cycle.transitions.slideX = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $(opts.elements).not(curr).hide(); - $.fn.cycle.commonReset(curr,next,opts,false,true); - opts.animIn.width = next.cycleW; - }); - opts.cssBefore = { left: 0, top: 0, width: 0 }; - opts.animIn = { width: 'show' }; - opts.animOut = { width: 0 }; -}; -$.fn.cycle.transitions.slideY = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $(opts.elements).not(curr).hide(); - $.fn.cycle.commonReset(curr,next,opts,true,false); - opts.animIn.height = next.cycleH; - }); - opts.cssBefore = { left: 0, top: 0, height: 0 }; - opts.animIn = { height: 'show' }; - opts.animOut = { height: 0 }; -}; - -// shuffle -$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) { - var i, w = $cont.css('overflow', 'visible').width(); - $slides.css({left: 0, top: 0}); - opts.before.push(function(curr,next,opts) { - $.fn.cycle.commonReset(curr,next,opts,true,true,true); - }); - // only adjust speed once! - if (!opts.speedAdjusted) { - opts.speed = opts.speed / 2; // shuffle has 2 transitions - opts.speedAdjusted = true; - } - opts.random = 0; - opts.shuffle = opts.shuffle || {left:-w, top:15}; - opts.els = []; - for (i=0; i < $slides.length; i++) - opts.els.push($slides[i]); - - for (i=0; i < opts.currSlide; i++) - opts.els.push(opts.els.shift()); - - // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!) - opts.fxFn = function(curr, next, opts, cb, fwd) { - var $el = fwd ? $(curr) : $(next); - $(next).css(opts.cssBefore); - var count = opts.slideCount; - $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() { - var hops = $.fn.cycle.hopsFromLast(opts, fwd); - for (var k=0; k < hops; k++) - fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop()); - if (fwd) { - for (var i=0, len=opts.els.length; i < len; i++) - $(opts.els[i]).css('z-index', len-i+count); - } - else { - var z = $(curr).css('z-index'); - $el.css('z-index', parseInt(z)+1+count); - } - $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() { - $(fwd ? this : curr).hide(); - if (cb) cb(); - }); - }); - }; - opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 }; -}; - -// turnUp/Down/Left/Right -$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,true,false); - opts.cssBefore.top = next.cycleH; - opts.animIn.height = next.cycleH; - }); - opts.cssFirst = { top: 0 }; - opts.cssBefore = { left: 0, height: 0 }; - opts.animIn = { top: 0 }; - opts.animOut = { height: 0 }; -}; -$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,true,false); - opts.animIn.height = next.cycleH; - opts.animOut.top = curr.cycleH; - }); - opts.cssFirst = { top: 0 }; - opts.cssBefore = { left: 0, top: 0, height: 0 }; - opts.animOut = { height: 0 }; -}; -$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,false,true); - opts.cssBefore.left = next.cycleW; - opts.animIn.width = next.cycleW; - }); - opts.cssBefore = { top: 0, width: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { width: 0 }; -}; -$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,false,true); - opts.animIn.width = next.cycleW; - opts.animOut.left = curr.cycleW; - }); - opts.cssBefore = { top: 0, left: 0, width: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { width: 0 }; -}; - -// zoom -$.fn.cycle.transitions.zoom = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,false,false,true); - opts.cssBefore.top = next.cycleH/2; - opts.cssBefore.left = next.cycleW/2; - opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH }; - opts.animOut = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 }; - }); - opts.cssFirst = { top:0, left: 0 }; - opts.cssBefore = { width: 0, height: 0 }; -}; - -// fadeZoom -$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,false,false); - opts.cssBefore.left = next.cycleW/2; - opts.cssBefore.top = next.cycleH/2; - opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH }; - }); - opts.cssBefore = { width: 0, height: 0 }; - opts.animOut = { opacity: 0 }; -}; - -// blindX -$.fn.cycle.transitions.blindX = function($cont, $slides, opts) { - var w = $cont.css('overflow','hidden').width(); - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts); - opts.animIn.width = next.cycleW; - opts.animOut.left = curr.cycleW; - }); - opts.cssBefore = { left: w, top: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { left: w }; -}; -// blindY -$.fn.cycle.transitions.blindY = function($cont, $slides, opts) { - var h = $cont.css('overflow','hidden').height(); - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts); - opts.animIn.height = next.cycleH; - opts.animOut.top = curr.cycleH; - }); - opts.cssBefore = { top: h, left: 0 }; - opts.animIn = { top: 0 }; - opts.animOut = { top: h }; -}; -// blindZ -$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) { - var h = $cont.css('overflow','hidden').height(); - var w = $cont.width(); - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts); - opts.animIn.height = next.cycleH; - opts.animOut.top = curr.cycleH; - }); - opts.cssBefore = { top: h, left: w }; - opts.animIn = { top: 0, left: 0 }; - opts.animOut = { top: h, left: w }; -}; - -// growX - grow horizontally from centered 0 width -$.fn.cycle.transitions.growX = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,false,true); - opts.cssBefore.left = this.cycleW/2; - opts.animIn = { left: 0, width: this.cycleW }; - opts.animOut = { left: 0 }; - }); - opts.cssBefore = { width: 0, top: 0 }; -}; -// growY - grow vertically from centered 0 height -$.fn.cycle.transitions.growY = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,true,false); - opts.cssBefore.top = this.cycleH/2; - opts.animIn = { top: 0, height: this.cycleH }; - opts.animOut = { top: 0 }; - }); - opts.cssBefore = { height: 0, left: 0 }; -}; - -// curtainX - squeeze in both edges horizontally -$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,false,true,true); - opts.cssBefore.left = next.cycleW/2; - opts.animIn = { left: 0, width: this.cycleW }; - opts.animOut = { left: curr.cycleW/2, width: 0 }; - }); - opts.cssBefore = { top: 0, width: 0 }; -}; -// curtainY - squeeze in both edges vertically -$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) { - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,true,false,true); - opts.cssBefore.top = next.cycleH/2; - opts.animIn = { top: 0, height: next.cycleH }; - opts.animOut = { top: curr.cycleH/2, height: 0 }; - }); - opts.cssBefore = { left: 0, height: 0 }; -}; - -// cover - curr slide covered by next slide -$.fn.cycle.transitions.cover = function($cont, $slides, opts) { - var d = opts.direction || 'left'; - var w = $cont.css('overflow','hidden').width(); - var h = $cont.height(); - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts); - if (d == 'right') - opts.cssBefore.left = -w; - else if (d == 'up') - opts.cssBefore.top = h; - else if (d == 'down') - opts.cssBefore.top = -h; - else - opts.cssBefore.left = w; - }); - opts.animIn = { left: 0, top: 0}; - opts.animOut = { opacity: 1 }; - opts.cssBefore = { top: 0, left: 0 }; -}; - -// uncover - curr slide moves off next slide -$.fn.cycle.transitions.uncover = function($cont, $slides, opts) { - var d = opts.direction || 'left'; - var w = $cont.css('overflow','hidden').width(); - var h = $cont.height(); - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,true,true,true); - if (d == 'right') - opts.animOut.left = w; - else if (d == 'up') - opts.animOut.top = -h; - else if (d == 'down') - opts.animOut.top = h; - else - opts.animOut.left = -w; - }); - opts.animIn = { left: 0, top: 0 }; - opts.animOut = { opacity: 1 }; - opts.cssBefore = { top: 0, left: 0 }; -}; - -// toss - move top slide and fade away -$.fn.cycle.transitions.toss = function($cont, $slides, opts) { - var w = $cont.css('overflow','visible').width(); - var h = $cont.height(); - opts.before.push(function(curr, next, opts) { - $.fn.cycle.commonReset(curr,next,opts,true,true,true); - // provide default toss settings if animOut not provided - if (!opts.animOut.left && !opts.animOut.top) - opts.animOut = { left: w*2, top: -h/2, opacity: 0 }; - else - opts.animOut.opacity = 0; - }); - opts.cssBefore = { left: 0, top: 0 }; - opts.animIn = { left: 0 }; -}; - -// wipe - clip animation -$.fn.cycle.transitions.wipe = function($cont, $slides, opts) { - var w = $cont.css('overflow','hidden').width(); - var h = $cont.height(); - opts.cssBefore = opts.cssBefore || {}; - var clip; - if (opts.clip) { - if (/l2r/.test(opts.clip)) - clip = 'rect(0px 0px '+h+'px 0px)'; - else if (/r2l/.test(opts.clip)) - clip = 'rect(0px '+w+'px '+h+'px '+w+'px)'; - else if (/t2b/.test(opts.clip)) - clip = 'rect(0px '+w+'px 0px 0px)'; - else if (/b2t/.test(opts.clip)) - clip = 'rect('+h+'px '+w+'px '+h+'px 0px)'; - else if (/zoom/.test(opts.clip)) { - var top = parseInt(h/2); - var left = parseInt(w/2); - clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)'; - } - } - - opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)'; - - var d = opts.cssBefore.clip.match(/(\d+)/g); - var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]); - - opts.before.push(function(curr, next, opts) { - if (curr == next) return; - var $curr = $(curr), $next = $(next); - $.fn.cycle.commonReset(curr,next,opts,true,true,false); - opts.cssAfter.display = 'block'; - - var step = 1, count = parseInt((opts.speedIn / 13)) - 1; - (function f() { - var tt = t ? t - parseInt(step * (t/count)) : 0; - var ll = l ? l - parseInt(step * (l/count)) : 0; - var bb = b < h ? b + parseInt(step * ((h-b)/count || 1)) : h; - var rr = r < w ? r + parseInt(step * ((w-r)/count || 1)) : w; - $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' }); - (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none'); - })(); - }); - opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 }; - opts.animIn = { left: 0 }; - opts.animOut = { left: 0 }; -}; - -})(jQuery); diff --git a/docs/iris/src/_static/logo_banner.png b/docs/iris/src/_static/logo_banner.png deleted file mode 100644 index 14fb3497e9..0000000000 Binary files a/docs/iris/src/_static/logo_banner.png and /dev/null differ diff --git a/docs/iris/src/_static/style.css b/docs/iris/src/_static/style.css deleted file mode 100644 index 69fa84394e..0000000000 --- a/docs/iris/src/_static/style.css +++ /dev/null @@ -1,99 +0,0 @@ -body { - font-family: 'Noto Sans', sans-serif; -} - -.sidebar { z-index: 10; } - -.highlight { background: none; } - -p.hr_p { - overflow: hidden; - text-align: center; -} -p.hr_p a { - font-size: small; - color: #1C86EE; -} -p.hr_p:before, -p.hr_p:after { - background-color: #abc; - border: 1px solid #abc; - content: ""; - display: inline-block; - height: 1px; - position: relative; - vertical-align: middle; - width: 50%; -} -p.hr_p:before { - right: 0.5em; - margin-left: -50%; -} -p.hr_p:after { - left: 0.5em; - margin-right: -50%; -} - -.header-content { - background-color: white; - text-align: left; - padding: 0px; - height: 149px; -} - -.header-content img { - height: 100px; - vertical-align: middle; - float: left; - margin: 20px 2em 0.8em 4%; - padding: 0px; -} - -.header-content .strapline { - display: inline-block; - width: calc(100% - 110px - 2em - 4%); -} - -.strapline p { - font-size: medium; - font-family: 'Alike', serif; - font-weight: bold; - color: #444444; - max-width: 52ch; - margin-top: 0.25em; -} - -.header-content h1 { - font-size: 3.5rem; - font-family: 'Alike', serif; - margin-top: 40px; - padding: 0px; - color: #323232; - padding-bottom: 0.2em; -} - -.header-content h1 span.version { - font-size: 1.5rem; -} - -.github-forkme { - position: absolute; - top: 0; - right: 80px; - border: 0; -} - -/* Take into account the resizing effect of the page (which has a minimum */ -/* width of 740px + 80px margins). */ -@media screen and (max-width: calc(740px + 80px + 80px)) { - .github-forkme { - right: calc(100% - 740px - 80px); - } -} - -@media screen and (max-width: calc(740px + 80px)) { - .github-forkme { - left: calc(740px + 80px - 149px); - right: 0px; - } -} diff --git a/docs/iris/src/_static/theme_override.css b/docs/iris/src/_static/theme_override.css new file mode 100644 index 0000000000..5edc286630 --- /dev/null +++ b/docs/iris/src/_static/theme_override.css @@ -0,0 +1,28 @@ +/* import the standard theme css */ +@import url("css/theme.css"); + +/* now we can add custom any css */ + +/* set the width of the logo */ +.wy-side-nav-search>a img.logo, +.wy-side-nav-search .wy-dropdown>a img.logo { + width: 12rem +} + +/* color of the logo background in the top left corner */ +.wy-side-nav-search { + background-color: lightgray; +} + +/* color of the font for the version in the top left corner */ +.wy-side-nav-search>div.version { + color: black; + font-weight: bold; +} + +/* Ensures tables do now have width scroll bars */ +table.docutils td { + white-space: unset; + word-wrap: break-word; +} + diff --git a/docs/iris/src/_templates/index.html b/docs/iris/src/_templates/index.html deleted file mode 100644 index c18f0268fa..0000000000 --- a/docs/iris/src/_templates/index.html +++ /dev/null @@ -1,146 +0,0 @@ -{% extends "layout.html" %} -{% set title = 'Iris documentation homepage' %} -{% block extrahead %} -{{ super() }} - - - - - - - - -{% endblock %} - - - -{% block body %} - - - - -

- Iris implements a data model based on the CF conventions - giving you a powerful, format-agnostic interface for working with your data. - It excels when working with multi-dimensional Earth Science data, where tabular - representations become unwieldy and inefficient. -

-

- CF Standard names, - units, and coordinate metadata - are built into Iris, giving you a rich and expressive interface for maintaining - an accurate representation of your data. Its treatment of data and - associated metadata as first-class objects includes: -

-
    -
  • a visualisation interface based on matplotlib and - cartopy,
  • -
  • unit conversion,
  • -
  • subsetting and extraction,
  • -
  • merge and concatenate,
  • -
  • aggregations and reductions (including min, max, mean and weighted averages),
  • -
  • interpolation and regridding (including nearest-neighbor, linear and area-weighted), and
  • -
  • operator overloads (+, -, *, /, etc.).
  • -
-

- A number of file formats are recognised by Iris, including CF-compliant NetCDF, GRIB, - and PP, and it has a plugin architecture to allow other formats to be added seamlessly. -

-

- Building upon NumPy and - dask, - Iris scales from efficient single-machine workflows right through to multi-core - clusters and HPC. - Interoperability with packages from the wider scientific Python ecosystem comes from Iris' - use of standard NumPy/dask arrays as its underlying data storage. -

- -
-
-
-
- -
- -
- - -
- -{% endblock %} diff --git a/docs/iris/src/_templates/layout.html b/docs/iris/src/_templates/layout.html index f854455f71..9b4983697e 100644 --- a/docs/iris/src/_templates/layout.html +++ b/docs/iris/src/_templates/layout.html @@ -1,71 +1,25 @@ {% extends "!layout.html" %} -{%- block extrahead %} -{{ super() }} - - - - - - - - - - -{% endblock %} - - -{% block rootrellink %} -
  • home
  • -
  • examples
  • -
  • gallery
  • -
  • contents
  • -{% endblock %} - - -{% block relbar1 %} - - - Fork Iris on GitHub - - - -
    - - Iris logo - -
    -

    - Iris v3.0 -

    -

    - A powerful, format-agnostic, community-driven Python library for analysing and - visualising Earth science data. -

    -
    -
    - -{{ super() }} +{% block menu %} + {{ super() }} + + {# menu_links and menu_links_name are set in conf.py (html_context) #} + + {% if menu_links %} +

    + + {% if menu_links_name %} + {{ menu_links_name }} + {% else %} + External links + {% endif %} + +

    +
      + {% for text, link in menu_links %} +
    • {{ text }}
    • + {% endfor %} +
    + {% endif %} {% endblock %} - - -{% block footer %} - - - - - -{% endblock %} diff --git a/docs/iris/src/conf.py b/docs/iris/src/conf.py index 0e4c53bccc..2308c065ba 100644 --- a/docs/iris/src/conf.py +++ b/docs/iris/src/conf.py @@ -17,78 +17,58 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import datetime +# ---------------------------------------------------------------------------- + +import ntpath import os import sys -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.append(os.path.abspath("sphinxext")) -# add some sample files from the developers guide.. -sys.path.append(os.path.abspath(os.path.join("developers_guide"))) +# function to write useful output to stdout, prefixing the source. +def autolog(message): + print("[{}] {}".format(ntpath.basename(__file__), message)) -# -- General configuration ----------------------------------------------------- +# -- Are we running on the readthedocs server, if so do some setup ----------- -# Temporary value for use by LaTeX and 'man' output. -# Deleted at the end of the module. -_authors = "Iris developers" +on_rtd = os.environ.get("READTHEDOCS") == "True" -# If your documentation needs a minimal Sphinx version, state it here. -# needs_sphinx = '1.0' +if on_rtd: + autolog("Build running on READTHEDOCS server") -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.coverage", - "sphinx.ext.doctest", - "sphinx.ext.extlinks", - "sphinx.ext.graphviz", - "sphinx.ext.imgmath", - "sphinx.ext.intersphinx", - "matplotlib.sphinxext.mathmpl", - "matplotlib.sphinxext.plot_directive", - # better class documentation - "custom_class_autodoc", - # Data instance __repr__ filter. - "custom_data_autodoc", - "gen_example_directory", - "generate_package_rst", - "gen_gallery", - # Add labels to figures automatically - "auto_label_figures", -] +# -- Path setup -------------------------------------------------------------- -# list of packages to document -autopackage_name = ["iris"] +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] +import datetime +import warnings -# The suffix of source filenames. -source_suffix = ".rst" +# custom sphinx extensions +sys.path.append(os.path.abspath("sphinxext")) -# The encoding of source files. -# source_encoding = 'utf-8-sig' +# add some sample files from the developers guide.. +sys.path.append(os.path.abspath(os.path.join("developers_guide"))) + +# why isnt the iris path added to it is discoverable too? We dont need to, +# the sphinext to generate the api rst knows where the source is. If it +# is added then the travis build will likely fail. -# The master toctree document. -master_doc = "contents" +# -- Project information ----------------------------------------------------- -# General information about the project. project = "Iris" + # define the copyright information for latex builds. Note, for html builds, # the copyright exists directly inside "_templates/layout.html" upper_copy_year = datetime.datetime.now().year -copyright = "Copyright Iris contributors" +copyright = "Iris contributors" +_authors = "Iris developers" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -# + import iris # The short X.Y version. @@ -100,44 +80,60 @@ # The full version, including alpha/beta/rc tags. release = iris.__version__ -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# language = None +autolog("Iris Version = {}".format(version)) +autolog("Iris Release = {}".format(release)) -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' +# -- General configuration --------------------------------------------------- -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["sphinxext", "build"] +# Create a variable that can be insterted in the rst "|copyright_years|". +# You can add more vairables here if needed +rst_epilog = """ +.. |copyright_years| replace:: {year_range} +""".format( + year_range="2010 - {}".format(upper_copy_year) +) -# The reST default role (used for this markup: `text`) to use for all documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.todo", + "sphinx.ext.duration", + "sphinx.ext.coverage", + "sphinx.ext.viewcode", + "sphinx.ext.autosummary", + "sphinx.ext.doctest", + "sphinx.ext.extlinks", + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx_copybutton", + "sphinx_gallery.gen_gallery", + "matplotlib.sphinxext.mathmpl", + "matplotlib.sphinxext.plot_directive", + # better api documentation (custom) + "custom_class_autodoc", + "custom_data_autodoc", + "generate_package_rst", +] -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True +# sphinx_copybutton config +copybutton_prompt_text = ">>> " -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False +# sphinx.ext.todo configuration +todo_include_todos = True -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# Define the default highlight language. This also allows the >>> removal -# javascript (copybutton.js) to function. -highlight_language = "default" - -# A list of ignored prefixes for module index sorting. +# api generation configuration +autodoc_member_order = "groupwise" +autodoc_default_flags = ["show-inheritance"] +autosummary_generate = True +autosummary_imported_members = True +autopackage_name = ["iris"] +autoclass_content = "init" modindex_common_prefix = ["iris"] +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + intersphinx_mapping = { "cartopy": ("http://scitools.org.uk/cartopy/docs/latest/", None), "matplotlib": ("http://matplotlib.org/", None), @@ -146,6 +142,14 @@ "scipy": ("http://docs.scipy.org/doc/scipy/reference/", None), } +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# plot directive options (extension: matplotlib.sphinxext.plot_directive --- +plot_formats = [ + ("png", 100), +] + # -- Extlinks extension ------------------------------------------------------- extlinks = { @@ -153,103 +157,91 @@ "pull": ("https://github.com/SciTools/iris/pull/%s", "PR #"), } -# -- Doctest ------------------------------------------------------------------ +# -- Doctest ("make doctest")-------------------------------------------------- doctest_global_setup = "import iris" -# -- Autodoc ------------------------------------------------------------------ - -autodoc_member_order = "groupwise" -autodoc_default_flags = ["show-inheritance"] - -# include the __init__ method when documenting classes -# document the init/new method at the top level of the class documentation rather than displaying the class docstring -autoclass_content = "init" - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = "default" -html_theme = "sphinxdoc" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# html_theme_options = {} - -html_context = {"copyright_years": "2010 - {}".format(upper_copy_year)} - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [] +# -- Options for HTML output -------------------------------------------------- -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_logo = "_static/iris-logo-title.png" +html_favicon = "_static/favicon.ico" +html_theme = "sphinx_rtd_theme" + +html_theme_options = { + "display_version": True, + "style_external_links": True, + "logo_only": "True", +} -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None +html_context = { + "copyright_years": "2010 - {}".format(upper_copy_year), + # menu_links and menu_links_name are used in _templates/layout.html + # to include some nice icons. See http://fontawesome.io for a list of + # icons (used in the sphinx_rtd_theme) + "menu_links_name": "Support", + "menu_links": [ + ( + ' Source Code', + "https://github.com/SciTools/iris", + ), + ( + ' Users Google Group', + "https://groups.google.com/forum/#!forum/scitools-iris", + ), + ( + ' Developers Google Group', + "https://groups.google.com/forum/#!forum/scitools-iris-dev", + ), + ( + ' StackOverflow For "How do I?"', + "https://stackoverflow.com/questions/tagged/python-iris", + ), + ( + ' Legacy documentation', + "https://scitools.org.uk/iris/docs/v2.4.0/index.html", + ), + ], +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] +html_style = "theme_override.css" -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -html_additional_pages = {"index": "index.html", "gallery": "gallery.html"} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -html_show_sphinx = False - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' +# url link checker. Some links work but report as broken, lets ignore them. +linkcheck_ignore = [ + "https://github.com/SciTools/iris/commit/69597eb3d8501ff16ee3d56aef1f7b8f1c2bb316#diff-1680206bdc5cfaa83e14428f5ba0f848", + "http://www.wmo.int/pages/prog/www/DPFS/documents/485_Vol_I_en_colour.pdf", + "http://code.google.com/p/msysgit/downloads/list", +] -# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = '' +# list of sources to exclude from the build. +exclude_patterns = [] -# Output file base name for HTML help builder. -htmlhelp_basename = "Irisdoc" +# -- sphinx-gallery config ---------------------------------------------------- -html_use_modindex = False +sphinx_gallery_conf = { + # path to your example scripts + "examples_dirs": ["../gallery_code"], + # path to where to save gallery generated output + "gallery_dirs": ["generated/gallery"], + # filename pattern for the files in the gallery + "filename_pattern": "/plot_", + # filename patternt to ignore in the gallery + "ignore_pattern": r"__init__\.py", +} +# Remove matplotlib agg warnings from generated doc when using plt.show +warnings.filterwarnings( + "ignore", + category=UserWarning, + message="Matplotlib is currently using agg, which is a" + " non-GUI backend, so cannot show the figure.", +) # -- Options for LaTeX output -------------------------------------------------- @@ -261,15 +253,15 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ( - "contents", - "Iris.tex", - "Iris Documentation", - " \\and ".join(_authors), - "manual", - ), -] +# latex_documents = [ +# ( +# "contents", +# "Iris.tex", +# "Iris Documentation", +# " \\and ".join(_authors), +# "manual", +# ), +# ] # The name of an image file (relative to this directory) to place at the top of # the title page. @@ -293,24 +285,11 @@ # If false, no module index is generated. # latex_domain_indices = True -latex_elements = {} -latex_elements["docclass"] = "MO_report" +# latex_elements = {} +# latex_elements["docclass"] = "MO_report" # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [("index", "iris", "Iris Documentation", _authors, 1)] - -########################## -# plot directive options # -########################## - -plot_formats = [ - ("png", 100), - # ('hires.png', 200), ('pdf', 250) -] - - -# Delete the temporary value. -del _authors +# man_pages = [("index", "iris", "Iris Documentation", _authors, 1)] diff --git a/docs/iris/src/contents.rst b/docs/iris/src/contents.rst deleted file mode 100644 index ecaf025a7a..0000000000 --- a/docs/iris/src/contents.rst +++ /dev/null @@ -1,32 +0,0 @@ -===================================== -Iris documentation table of contents -===================================== -.. toctree:: - :maxdepth: 1 - - installing.rst - -.. toctree:: - :maxdepth: 3 - - userguide/index.rst - -.. toctree:: - :maxdepth: 1 - :hidden: - - iris/iris.rst - -.. toctree:: - :maxdepth: 2 - - whatsnew/index.rst - -.. toctree:: - :maxdepth: 1 - - examples/index.rst - developers_guide/index.rst - whitepapers/index.rst - copyright.rst - diff --git a/docs/iris/src/copyright.rst b/docs/iris/src/copyright.rst index 71e860336d..08a40e5a1e 100644 --- a/docs/iris/src/copyright.rst +++ b/docs/iris/src/copyright.rst @@ -1,4 +1,4 @@ -========================================== + Iris copyright, licensing and contributors ========================================== @@ -28,7 +28,7 @@ are licensed under the UK's Open Government Licence: .. admonition:: Documentation, example and data license - (C) British Crown Copyright 2019. + (C) British Crown Copyright |copyright_years| You may use and re-use the information featured on this website (not including logos) free of charge in any format or medium, under the terms of the diff --git a/docs/iris/src/developers_guide/code_format.rst b/docs/iris/src/developers_guide/code_format.rst index 8033babceb..c889146269 100644 --- a/docs/iris/src/developers_guide/code_format.rst +++ b/docs/iris/src/developers_guide/code_format.rst @@ -1,6 +1,6 @@ .. _iris_code_format: -Code Formatting +Code formatting *************** To enforce a consistent code format throughout Iris, we recommend using `pre-commit `_ to run diff --git a/docs/iris/src/developers_guide/contributing_documentation.rst b/docs/iris/src/developers_guide/contributing_documentation.rst new file mode 100644 index 0000000000..f8e01ed927 --- /dev/null +++ b/docs/iris/src/developers_guide/contributing_documentation.rst @@ -0,0 +1,145 @@ + +.. toctree:: + :maxdepth: 2 + +.. _contributing.documentation: + +Contributing to the documentation +================================== + +Documentation is important and we encourage any improvements that can be made. +If you believe the documentation is not clear please contribute a change to +improve the documentation for all users. + +Any change to the Iris project whether it is a bugfix, new feature or +documentation update must use the :ref:`development-workflow`. + +.. contents:: Contents: + :local: + + +Requirements +------------ + +The documentation uses specific packages that need to be present. Please see +:ref:`installing_iris` for instructions. + + +Building +-------- + +The build is run from the documentation directory ``iris/docs/iris/src``. In +this directory run:: + + make html + +The build output for the html is found in the ``_build/html`` sub directory. +When updating the documentation ensure the html build has *no errors* or +*warnings* otherwise it may fail the automated `travis-ci`_ build. + +Once the build is complete, if it is rerun it will only rebuild the impacted +build artefacts so should take less time. + +There is also an option to perform a build but skip the +:ref:`contributing.documentation.gallery` creation completely. This can be +achieved via:: + + make html-noplot + +If you wish to run a clean build you can run:: + + make clean + make html + +This is useful for a final test before commiting your changes. + +.. note:: In addition to the automated `travis-ci`_ build of the documentation, + the https://readthedocs.org/ service is also used. The configuration + of this held in a file in the root of the + `github Iris project `_ named + ``.readthedocs.yml``. + +.. _travis-ci: https://travis-ci.org/github/SciTools/iris + +.. _contributing.documentation.testing: + +Testing +------- + +There are three ways to test various aspects of the documentation. + +Each :ref:`contributing.documentation.gallery` entry has a corresponding test. +The below command must be run in the ``iris/docs/iris`` directory:: + + make gallerytest + +Many documentation pages includes python code itself that can be run to ensure it +is still valid. The below command can be run in the ``iris/docs/iris`` or +``iris/docs/iris/src`` directory:: + + make doctest + +Finally, all the hyperlinks in the documentation can be checked automatically. +If there is a link that is known to work it can be excluded from the checks by +adding it to the ``linkcheck_ignore`` array that is defined in the +`conf.py `_. +The hyperlink check can be run via:: + + make linkcheck + +If this fails check the output for the text **broken** and then correct +or ignore the url. + +.. note:: All of the above tests are automatically run as part of the + `travis-ci`_ automated build. + + +.. _contributing.documentation.api: + +Generating API documentation +---------------------------- + +In order to auto generate the API documentation based upon the docstrings a custom +set of python scripts are used, these are located in the directory +``iris/docs/iris/src/sphinxext``. Once the ``make html`` command has been run, +the output of these scripts can be found in +``iris/docs/iris/src/_build/generated/api``. + +If there is a particularly troublesome module that breaks the ``make html`` you +can exclude the module from the API documentation. Add the entry to the +``exclude_modules`` tuple list in the +``iris/docs/iris/src/sphinxext/generate_package_rst.py`` file. + + +.. _contributing.documentation.gallery: + +Gallery +------- + +The Iris :ref:`sphx_glr_generated_gallery` uses a sphinx extension named +`sphinx-gallery `_ +that auto generates reStructuredText (rst) files based upon a gallery source +directory that abides directory and filename convention. + +The code for the gallery entries are in ``iris/docs/iris/gallery_code``. +Each sub directory in this directory is a sub section of the gallery. The +respective ``README.rst`` in each folder is included in the gallery output. + +For each gallery entry there must be a corresponding test script located in +``iris/docs/iris/gallery_tests``. + +To add an entry to the gallery simple place your python code into the appropriate +sub directory and name it with a prefix of ``plot_``. If your gallery entry does not +fit into any existing sub directories then create a new directoy and place it in +there. + +The reStructuredText (rst) output of the gallery is located in +``iris/docs/iris/src/_build/generated/gallery``. + +For more information on the directory structure and options please see the +`sphinx-gallery getting started `_ +documentation. + + + + diff --git a/docs/iris/src/developers_guide/documenting/docstrings.rst b/docs/iris/src/developers_guide/documenting/docstrings.rst index 4499f3fe34..afc56014ea 100644 --- a/docs/iris/src/developers_guide/documenting/docstrings.rst +++ b/docs/iris/src/developers_guide/documenting/docstrings.rst @@ -1,11 +1,12 @@ -================ +=========== Docstrings -================ +=========== Guiding principle: Every public object in the Iris package should have an appropriate docstring. This document has been influenced by the following PEP's, + * Attribute Docstrings `PEP-224 `_ * Docstring Conventions `PEP-257 `_ @@ -60,7 +61,7 @@ The class constructor should be documented in the docstring for its ``__init__`` If a class subclasses another class and its behavior is mostly inherited from that class, its docstring should mention this and summarise the differences. Use the verb "override" to indicate that a subclass method replaces a superclass method and does not call the superclass method; use the verb "extend" to indicate that a subclass method calls the superclass method (in addition to its own behavior). -Attribute and Property docstrings +Attribute and property docstrings --------------------------------- Here is a simple example of a class containing an attribute docstring and a property docstring: diff --git a/docs/iris/src/developers_guide/documenting/rest_guide.rst b/docs/iris/src/developers_guide/documenting/rest_guide.rst index 8ce97a3c4a..e42e27c18e 100644 --- a/docs/iris/src/developers_guide/documenting/rest_guide.rst +++ b/docs/iris/src/developers_guide/documenting/rest_guide.rst @@ -3,26 +3,36 @@ reST quickstart =============== -reST (http://en.wikipedia.org/wiki/ReStructuredText) is a lightweight markup language intended to be highly readable in source format. This guide will cover some of the more frequently used advanced reST markup syntaxes, for the basics of reST the following links may be useful: +reST (http://en.wikipedia.org/wiki/ReStructuredText) is a lightweight markup +language intended to be highly readable in source format. This guide will +cover some of the more frequently used advanced reST markup syntaxes, for the +basics of reST the following links may be useful: - * http://sphinx.pocoo.org/rest.html - * http://docs.geoserver.org/trunk/en/docguide/sphinx.html + * https://www.sphinx-doc.org/en/master/usage/restructuredtext/ * http://packages.python.org/an_example_pypi_project/sphinx.html Reference documentation for reST can be found at http://docutils.sourceforge.net/rst.html. Creating links -------------- -Basic links can be created with ```Text of the link `_`` which will look like `Text of the link `_ +Basic links can be created with ```Text of the link `_`` +which will look like `Text of the link `_ -Documents in the same project can be cross referenced with the syntax ``:doc:`document_name``` for example, to reference the "docstrings" page ``:doc:`docstrings``` creates the following link :doc:`docstrings` +Documents in the same project can be cross referenced with the syntax +``:doc:`document_name``` for example, to reference the "docstrings" page +``:doc:`docstrings``` creates the following link :doc:`docstrings` -References can be created between sections by first making a "label" where you would like the link to point to ``.. _name_of_reference::`` the appropriate link can now be created with ``:ref:`name_of_reference``` (note the trailing underscore on the label) +References can be created between sections by first making a "label" where +you would like the link to point to ``.. _name_of_reference::`` the +appropriate link can now be created with ``:ref:`name_of_reference``` +(note the trailing underscore on the label) -Cross referencing other reference documentation can be achieved with the syntax ``:py:class:`zipfile.ZipFile``` which will result in links such as :py:class:`zipfile.ZipFile` and :py:class:`numpy.ndarray`. +Cross referencing other reference documentation can be achieved with the +syntax ``:py:class:`zipfile.ZipFile``` which will result in links such as +:py:class:`zipfile.ZipFile` and :py:class:`numpy.ndarray`. diff --git a/docs/iris/src/developers_guide/documenting/whats_new_contributions.rst b/docs/iris/src/developers_guide/documenting/whats_new_contributions.rst index 203a422457..ae4361b2eb 100644 --- a/docs/iris/src/developers_guide/documenting/whats_new_contributions.rst +++ b/docs/iris/src/developers_guide/documenting/whats_new_contributions.rst @@ -18,7 +18,7 @@ When a new release is prepared, the what's new contributions are combined into a draft what's new document for the release. -Writing a Contribution +Writing a contribution ====================== As introduced above, a contribution is the description of a change to Iris @@ -36,7 +36,7 @@ It is not in itself the final documentation content, so it does not have to be perfect or complete in every respect. -Adding Contribution Files +Adding contribution files ========================= Each release must have a directory called ``contributions_``, @@ -91,7 +91,7 @@ For example: * GRIB2_pdt11 -Complete Examples +Complete examples ----------------- Some sample what's new contribution filenames: @@ -106,7 +106,7 @@ Some sample what's new contribution filenames: latest contributions directory conform to this naming scheme. -Compiling a Draft +Compiling a draft ================= Compiling a draft from the supplied contributions should be done when preparing diff --git a/docs/iris/src/developers_guide/gitwash/development_workflow.rst b/docs/iris/src/developers_guide/gitwash/development_workflow.rst index 4da6b700ba..312e114188 100644 --- a/docs/iris/src/developers_guide/gitwash/development_workflow.rst +++ b/docs/iris/src/developers_guide/gitwash/development_workflow.rst @@ -18,7 +18,7 @@ In what follows we'll refer to the upstream iris ``master`` branch, as * When you are starting a new set of changes, fetch any changes from trunk, and start a new *feature branch* from that. * Make a new branch for each separable set of changes |emdash| "one task, one - branch" (`ipython git workflow`_). + branch". * Name your branch for the purpose of the changes - e.g. ``bugfix-for-issue-14`` or ``refactor-database-code``. * If you can possibly avoid it, avoid merging trunk or any other branches into @@ -31,7 +31,7 @@ This way of working helps to keep work well organized, with readable history. This in turn makes it easier for project maintainers (that might be you) to see what you've done, and why you did it. -See `linux git workflow`_ and `ipython git workflow`_ for some explanation. +See `linux git workflow`_ for some explanation. Consider deleting your master branch ==================================== diff --git a/docs/iris/src/developers_guide/gitwash/forking_hell.rst b/docs/iris/src/developers_guide/gitwash/forking_hell.rst index 2b38c02736..4b591d7b0e 100644 --- a/docs/iris/src/developers_guide/gitwash/forking_hell.rst +++ b/docs/iris/src/developers_guide/gitwash/forking_hell.rst @@ -1,7 +1,7 @@ .. _forking: ====================================================== -Making your own copy (fork) of iris +Making your own copy (fork) of Iris ====================================================== You need to do this only once. The instructions here are very similar @@ -17,7 +17,7 @@ If you don't have a github account, go to the github page, and make one. You then need to configure your account to allow write access |emdash| see the ``Generating SSH keys`` help on `github help`_. -Create your own forked copy of `iris`_ +Create your own forked copy of `Iris`_ ====================================================== #. Log into your github account. diff --git a/docs/iris/src/developers_guide/gitwash/git_development.rst b/docs/iris/src/developers_guide/gitwash/git_development.rst index c5b910d863..1b4398e132 100644 --- a/docs/iris/src/developers_guide/gitwash/git_development.rst +++ b/docs/iris/src/developers_guide/gitwash/git_development.rst @@ -4,8 +4,6 @@ Git for development ===================== -Contents: - .. toctree:: :maxdepth: 2 diff --git a/docs/iris/src/developers_guide/gitwash/git_install.rst b/docs/iris/src/developers_guide/gitwash/git_install.rst index 3be5149b90..d63f188b2e 100644 --- a/docs/iris/src/developers_guide/gitwash/git_install.rst +++ b/docs/iris/src/developers_guide/gitwash/git_install.rst @@ -7,12 +7,12 @@ Overview ======== -================ ============= +================ =============================== Debian / Ubuntu ``sudo apt-get install git`` Fedora ``sudo yum install git`` Windows Download and install msysGit_ OS X Use the git-osx-installer_ -================ ============= +================ =============================== In detail ========= @@ -21,6 +21,4 @@ See the git page for the most recent information. Have a look at the github install help pages available from `github help`_ -There are good instructions here: http://book.git-scm.com/2_installing_git.html - .. include:: links.inc diff --git a/docs/iris/src/developers_guide/gitwash/git_links.inc b/docs/iris/src/developers_guide/gitwash/git_links.inc index 8e628ae19e..28cae6a025 100644 --- a/docs/iris/src/developers_guide/gitwash/git_links.inc +++ b/docs/iris/src/developers_guide/gitwash/git_links.inc @@ -15,7 +15,6 @@ .. _msysgit: http://code.google.com/p/msysgit/downloads/list .. _git-osx-installer: http://code.google.com/p/git-osx-installer/downloads/list .. _subversion: http://subversion.tigris.org/ -.. _git cheat sheet: http://github.com/guides/git-cheat-sheet .. _pro git book: http://progit.org/ .. _git svn crash course: http://git-scm.com/course/svn.html .. _learn.github: http://learn.github.com/ diff --git a/docs/iris/src/developers_guide/gitwash/git_resources.rst b/docs/iris/src/developers_guide/gitwash/git_resources.rst index d18b0ef48b..6f05422771 100644 --- a/docs/iris/src/developers_guide/gitwash/git_resources.rst +++ b/docs/iris/src/developers_guide/gitwash/git_resources.rst @@ -1,7 +1,7 @@ .. _git-resources: ============= -git resources +Git resources ============= Tutorials and summaries @@ -9,8 +9,6 @@ Tutorials and summaries * `github help`_ has an excellent series of how-to guides. * `learn.github`_ has an excellent series of tutorials -* The `pro git book`_ is a good in-depth book on git. -* A `git cheat sheet`_ is a page giving summaries of common commands. * The `git user manual`_ * The `git tutorial`_ * The `git community book`_ @@ -22,7 +20,6 @@ Tutorials and summaries * Fernando Perez' git page |emdash| `Fernando's git page`_ |emdash| many links and tips * A good but technical page on `git concepts`_ -* `git svn crash course`_: git for those of us used to subversion_ Advanced git workflow ===================== @@ -30,7 +27,6 @@ Advanced git workflow There are many ways of working with git; here are some posts on the rules of thumb that other projects have come up with: -* Linus Torvalds on `git management`_ * Linus Torvalds on `linux git workflow`_ . Summary; use the git tools to make the history of your edits as clean as possible; merge from upstream edits as little as possible in branches where you are doing diff --git a/docs/iris/src/developers_guide/gitwash/index.rst b/docs/iris/src/developers_guide/gitwash/index.rst index 35eee1944a..a69515548a 100644 --- a/docs/iris/src/developers_guide/gitwash/index.rst +++ b/docs/iris/src/developers_guide/gitwash/index.rst @@ -3,8 +3,6 @@ Working with *iris* source code ================================================ -Contents: - .. toctree:: :maxdepth: 2 diff --git a/docs/iris/src/developers_guide/graphics_tests.rst b/docs/iris/src/developers_guide/graphics_tests.rst index 2782f319ec..e84a59d48d 100644 --- a/docs/iris/src/developers_guide/graphics_tests.rst +++ b/docs/iris/src/developers_guide/graphics_tests.rst @@ -1,26 +1,29 @@ +:orphan: + .. _developer_graphics_tests: Graphics tests ************** The only practical way of testing plotting functionality is to check actual -output plots. -For this, a basic 'graphics test' assertion operation is provided in the method -:meth:`iris.tests.IrisTest.check_graphic` : This tests plotted output for a -match against a stored reference. -A "graphics test" is any test which employs this. - -At present, such tests include the testing for modules `iris.tests.test_plot` -and `iris.tests.test_quickplot`, all output plots from the gallery examples -(contained in `docs/iris/example_tests`), and a few other 'legacy' style tests -(as described in :ref:`developer_tests`). +output plots. For this, a basic 'graphics test' assertion operation is +provided in the method :meth:`iris.tests.IrisTest.check_graphic` : This +tests plotted output for a match against a stored reference. A +"graphics test" is any test which employs this. + +At present, such tests include the testing for modules ``iris.tests.test_plot`` +and ``iris.tests.test_quickplot``, all output plots from the gallery +contained in ``docs/iris/gallery_tests``, and a few other 'legacy' style tests +as described in :ref:`developer_tests` +. It is conceivable that new 'graphics tests' of this sort can still be added. However, as graphics tests are inherently "integration" style rather than true unit tests, results can differ with the installed versions of dependent libraries (see below), so this is not recommended except where no alternative is practical. -Testing actual plot results introduces some significant difficulties : +Testing actual plot results introduces some significant difficulties: + * Graphics tests are inherently 'integration' style tests, so results will often vary with the versions of key dependencies, i.e. the exact versions of third-party modules which are installed : Obviously, results will depend on @@ -36,7 +39,7 @@ Testing actual plot results introduces some significant difficulties : given multiple independent sources of variation. -Graphics Testing Strategy +Graphics testing strategy ========================= In the Iris Travis matrix, and over time, graphics tests must run with @@ -63,8 +66,8 @@ This consists of : existing accepted reference images, for each failing test. -How to Add New 'Acceptable' Result Images to Existing Tests -======================================== +How to add new 'Acceptable' result images to existing tests +=========================================================== When you find that a graphics test in the Iris testing suite has failed, following changes in Iris or the run dependencies, this is the process diff --git a/docs/iris/src/developers_guide/index.rst b/docs/iris/src/developers_guide/index.rst deleted file mode 100644 index a98a9f0f3a..0000000000 --- a/docs/iris/src/developers_guide/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. _userguide-index: - -.. This is the source doc for the user guide - -##################### - Iris developer guide -##################### - - -.. toctree:: - :maxdepth: 3 - - documenting/index.rst - gitwash/index.rst - code_format.rst - pulls.rst - tests.rst - deprecations.rst - release.rst diff --git a/docs/iris/src/developers_guide/pulls.rst b/docs/iris/src/developers_guide/pulls.rst index 6546a15642..62535d27c6 100644 --- a/docs/iris/src/developers_guide/pulls.rst +++ b/docs/iris/src/developers_guide/pulls.rst @@ -1,6 +1,6 @@ .. _pr_check: -Pull Request Check List +Pull request check List *********************** A pull request to a SciTools project master should be ready to merge into the @@ -15,7 +15,7 @@ The check list summarises criteria which will be checked before a pull request is merged. Before submitting a pull request please consider this list. -The Iris Check List +The Iris check list ==================== * Have you provided a helpful description of the Pull Request? @@ -75,7 +75,7 @@ The Iris Check List * Do the documentation and code-example tests pass? - * Run with ``make doctest`` and ``make extest``, from within the subdirectory + * Run with ``make doctest`` and ``make gallerytest``, from within the subdirectory ``./docs/iris``. * note that code examples must *not* raise deprecations. This is now checked and will result in an error. @@ -85,8 +85,8 @@ The Iris Check List * ``./.travis.yml`` is used to manage the continuous integration testing. * the files ``./conda-requirements.yml`` and - ``./minimal-conda-requirements.yml`` are used to define the software - environments used, using the conda_ package manager. + ``./minimal-conda-requirements.yml`` are used to define the software + environments used, using the conda_ package manager. * Have you provided updates to supporting projects for test or example data? @@ -108,7 +108,7 @@ The Iris Check List .. _PEP8: http://www.python.org/dev/peps/pep-0008/ .. _python-pep8: https://pypi.python.org/pypi/pep8 -.. _conda: http://conda.readthedocs.io/en/latest/ +.. _conda: https://docs.conda.io/en/latest/ .. _iris-test-data: https://github.com/SciTools/iris-test-data .. _iris-sample-data: https://github.com/SciTools/iris-sample-data .. _test-images-scitools: https://github.com/SciTools/test-images-scitools diff --git a/docs/iris/src/developers_guide/release.rst b/docs/iris/src/developers_guide/release.rst index 437478a6a0..5d1a683d44 100644 --- a/docs/iris/src/developers_guide/release.rst +++ b/docs/iris/src/developers_guide/release.rst @@ -5,7 +5,7 @@ Releases A release of Iris is a tag on the SciTools/Iris Github repository. -Release Branch +Release branch ============== Once the features intended for the release are on master, a release branch should be created, in the SciTools/Iris repository. This will have the name: @@ -18,7 +18,7 @@ for example: This branch shall be used to finalise the release details in preparation for the release candidate. -Release Candidate +Release candidate ================= Prior to a release, a release candidate tag may be created, marked as a pre-release in github, with a tag ending with :literal:`rc` followed by a number, e.g.: @@ -38,24 +38,24 @@ The documentation should include all of the what's new snippets, which must be c Upon release, the documentation shall be added to the SciTools scitools.org.uk github project's gh-pages branch as the latest documentation. -Testing the Conda Recipe +Testing the conda recipe ======================== Before a release is cut, the SciTools conda-recipes-scitools recipe for Iris shall be tested to build the release branch of Iris; this test recipe shall not be merged onto conda-recipes-scitools. -The Release +The release =========== The final steps are to change the version string in the source of :literal:`Iris.__init__.py` and include the release date in the relevant what's new page within the documentation. Once all checks are complete, the release is cut by the creation of a new tag in the SciTools Iris repository. -Conda Recipe +Conda recipe ============ Once a release is cut, the SciTools conda-recipes-scitools recipe for Iris shall be updated to build the latest release of Iris and push this artefact to anaconda.org. The build and push is all automated as part of the merge process. -Merge Back +Merge back ========== After the release is cut, the changes shall be merged back onto the scitools master. @@ -63,7 +63,7 @@ After the release is cut, the changes shall be merged back onto the scitools mas To achieve this, first cut a local branch from the release branch, :literal:`{release}.x`. Next add a commit changing the release string to match the release string on scitools/master. This branch can now be proposed as a pull request to master. This work flow ensures that the commit identifiers are consistent between the :literal:`.x` branch and :literal:`master`. -Point Releases +Point releases ============== Bug fixes may be implemented and targeted as the :literal:`.x` branch. These should lead to a new point release, another tag. diff --git a/docs/iris/src/developers_guide/tests.rst b/docs/iris/src/developers_guide/tests.rst index 417db96f32..0322abfdba 100644 --- a/docs/iris/src/developers_guide/tests.rst +++ b/docs/iris/src/developers_guide/tests.rst @@ -7,6 +7,7 @@ The Iris tests may be run with ``python setup.py test`` which has a command line utility included. There are three categories of tests within Iris: + - Unit tests - Integration tests - Legacy tests diff --git a/docs/iris/src/index.rst b/docs/iris/src/index.rst new file mode 100644 index 0000000000..035d0c07b5 --- /dev/null +++ b/docs/iris/src/index.rst @@ -0,0 +1,87 @@ +Iris Documentation +================== + +**A powerful, format-agnostic, community-driven Python library for analysing and +visualising Earth science data.** + +Iris implements a data model based on the `CF conventions `_ +giving you a powerful, format-agnostic interface for working with your data. +It excels when working with multi-dimensional Earth Science data, where tabular +representations become unwieldy and inefficient. + +`CF Standard names `_, +`units `_, and coordinate metadata +are built into Iris, giving you a rich and expressive interface for maintaining +an accurate representation of your data. Its treatment of data and +associated metadata as first-class objects includes: + +* visualisation interface based on `matplotlib `_ and + `cartopy `_, +* unit conversion, +* subsetting and extraction, +* merge and concatenate, +* aggregations and reductions (including min, max, mean and weighted averages), +* interpolation and regridding (including nearest-neighbor, linear and area-weighted), and +* operator overloads (``+``, ``-``, ``*``, ``/``, etc.). + +A number of file formats are recognised by Iris, including CF-compliant NetCDF, GRIB, +and PP, and it has a plugin architecture to allow other formats to be added seamlessly. + +Building upon `NumPy `_ and +`dask `_, +Iris scales from efficient single-machine workflows right through to multi-core +clusters and HPC. +Interoperability with packages from the wider scientific Python ecosystem comes from Iris' +use of standard NumPy/dask arrays as its underlying data storage. + + +.. toctree:: + :maxdepth: 1 + :caption: Getting started + + installing + generated/gallery/index + + +.. toctree:: + :maxdepth: 1 + :caption: User Guide + + userguide/index + userguide/iris_cubes + userguide/loading_iris_cubes + userguide/saving_iris_cubes + userguide/navigating_a_cube + userguide/subsetting_a_cube + userguide/real_and_lazy_data + userguide/plotting_a_cube + userguide/interpolation_and_regridding + userguide/merge_and_concat + userguide/cube_statistics + userguide/cube_maths + userguide/citation + userguide/code_maintenance + + +.. toctree:: + :maxdepth: 1 + :caption: Developers Guide + + developers_guide/contributing_documentation + developers_guide/documenting/index + developers_guide/gitwash/index + developers_guide/code_format + developers_guide/pulls + developers_guide/tests + developers_guide/deprecations + developers_guide/release + generated/api/iris + + +.. toctree:: + :maxdepth: 1 + :caption: Reference + + whatsnew/index + techpapers/index + copyright diff --git a/docs/iris/src/installing.rst b/docs/iris/src/installing.rst index 6b6999ab82..faa46afa50 100644 --- a/docs/iris/src/installing.rst +++ b/docs/iris/src/installing.rst @@ -1,7 +1,6 @@ .. _installing_iris: -**************** Installing Iris -**************** +*************** .. include:: ../../../INSTALL diff --git a/docs/iris/src/sphinxext/auto_label_figures.py b/docs/iris/src/sphinxext/auto_label_figures.py deleted file mode 100644 index 6fb72826fe..0000000000 --- a/docs/iris/src/sphinxext/auto_label_figures.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright Iris contributors -# -# This file is part of Iris and is released under the LGPL license. -# See COPYING and COPYING.LESSER in the root of the repository for full -# licensing details. - -import os -from docutils import nodes - - -def auto_label_figures(app, doctree): - """ - Add a label on every figure. - """ - - for fig in doctree.traverse(condition=nodes.figure): - for img in fig.traverse(condition=nodes.image): - fname, ext = os.path.splitext(img['uri']) - if ext == '.png': - fname = os.path.basename(fname).replace('_', '-') - fig['ids'].append(fname) - - -def setup(app): - app.connect('doctree-read', auto_label_figures) diff --git a/docs/iris/src/sphinxext/custom_class_autodoc.py b/docs/iris/src/sphinxext/custom_class_autodoc.py index a558732bd1..cbde413f2d 100644 --- a/docs/iris/src/sphinxext/custom_class_autodoc.py +++ b/docs/iris/src/sphinxext/custom_class_autodoc.py @@ -8,9 +8,12 @@ from sphinx.ext.autodoc import * from sphinx.util import force_decode from sphinx.util.docstrings import prepare_docstring - import inspect +# stop warnings cluttering the make output +import warnings +warnings.filterwarnings("ignore") + class ClassWithConstructorDocumenter(autodoc.ClassDocumenter): priority = 1000000 @@ -80,4 +83,4 @@ def format_args(self): def setup(app): - app.add_autodocumenter(ClassWithConstructorDocumenter) + app.add_autodocumenter(ClassWithConstructorDocumenter, override=True) diff --git a/docs/iris/src/sphinxext/custom_data_autodoc.py b/docs/iris/src/sphinxext/custom_data_autodoc.py index ade07dbc4e..eecd395101 100644 --- a/docs/iris/src/sphinxext/custom_data_autodoc.py +++ b/docs/iris/src/sphinxext/custom_data_autodoc.py @@ -44,5 +44,5 @@ def handler(app, what, name, obj, options, signature, return_annotation): def setup(app): - app.add_autodocumenter(IrisDataDocumenter) + app.add_autodocumenter(IrisDataDocumenter, override=True) app.connect('autodoc-process-signature', handler) diff --git a/docs/iris/src/sphinxext/gen_example_directory.py b/docs/iris/src/sphinxext/gen_example_directory.py deleted file mode 100644 index c5de195670..0000000000 --- a/docs/iris/src/sphinxext/gen_example_directory.py +++ /dev/null @@ -1,168 +0,0 @@ -# Copyright Iris contributors -# -# This file is part of Iris and is released under the LGPL license. -# See COPYING and COPYING.LESSER in the root of the repository for full -# licensing details. - - -''' -Generate the rst files for the examples -''' - -import os -import re -import shutil -import sys - - -def out_of_date(original, derived): - ''' - Returns True if derivative is out-of-date wrt original, - both of which are full file paths. - - TODO: this check isn't adequate in some cases, e.g., if we discover - a bug when building the examples, the original and derived will be - unchanged but we still want to force a rebuild. - ''' - return (not os.path.exists(derived) or - os.stat(derived).st_mtime < os.stat(original).st_mtime) - - -docstring_regex = re.compile(r'[\'\"]{3}(.*?)[\'\"]{3}', re.DOTALL) - - -noplot_regex = re.compile(r'#\s*-\*-\s*noplot\s*-\*-') - - -def generate_example_rst(app): - # Example code can be found at the same level as the documentation - # src folder. - rootdir = os.path.join(os.path.dirname(app.builder.srcdir), 'example_code') - - # Examples are built as a subfolder of the src folder. - exampledir = os.path.join(app.builder.srcdir, 'examples') - - if not os.path.exists(exampledir): - os.makedirs(exampledir) - - datad = {} - for root, subFolders, files in os.walk(rootdir): - for fname in files: - if (fname.startswith('.') or fname.startswith('#') or - fname.startswith('_') or fname.find('.svn') >= 0 or - not fname.endswith('.py')): - continue - - fullpath = os.path.join(root, fname) - with open(fullpath) as fh: - contents = fh.read() - # indent - relpath = os.path.split(root)[-1] - datad.setdefault(relpath, []).append((fullpath, fname, contents)) - - subdirs = sorted(datad.keys()) - - index = [] - index.append('''\ -Iris examples -============= - -.. toctree:: - :maxdepth: 2 - -''') - - for subdir in subdirs: - rstdir = os.path.join(exampledir, subdir) - if not os.path.exists(rstdir): - os.makedirs(rstdir) - - outputdir = os.path.join(app.builder.outdir, 'examples') - if not os.path.exists(outputdir): - os.makedirs(outputdir) - - outputdir = os.path.join(outputdir, subdir) - if not os.path.exists(outputdir): - os.makedirs(outputdir) - - index.append(' {}/index.rst\n'.format(subdir)) - subdir_root_path = os.path.join(rootdir, subdir) - subdirIndex = [] - - # Use the __init__.py file's docstring for the subdir example page (if - # __init__ exists). - if os.path.exists(os.path.join(subdir_root_path, '__init__.py')): - import imp - mod = imp.load_source( - subdir, - os.path.join(subdir_root_path, '__init__.py')) - subdirIndex.append(mod.__doc__) - else: - line = 'Examples in {}\n'.format(subdir) - subdirIndex.extend([line, '=' * len(line)]) - - # Append the code to produce the toctree. - subdirIndex.append(''' -.. toctree:: - :maxdepth: 1 - -''') - - sys.stdout.write(subdir + ', ') - sys.stdout.flush() - - data = sorted(datad[subdir]) - - for fullpath, fname, contents in data: - basename, ext = os.path.splitext(fname) - outputfile = os.path.join(outputdir, fname) - - rstfile = '{}.rst'.format(basename) - outrstfile = os.path.join(rstdir, rstfile) - - subdirIndex.append(' {}\n'.format(rstfile)) - - if not out_of_date(fullpath, outrstfile): - continue - - out = [] - out.append('.. _{}-{}:\n\n'.format(subdir, basename)) - - # Copy the example code to be in the src examples directory. This - # means we can define a simple relative path in the plot directive, - # which can also copy the file into the resulting build directory. - shutil.copy(fullpath, rstdir) - - docstring_results = docstring_regex.search(contents) - if docstring_results is not None: - out.append(docstring_results.group(1)) - else: - title = '{} example code: {}'.format(subdir, fname) - out.append(title + '\n') - out.append('=' * len(title) + '\n\n') - - if not noplot_regex.search(contents): - rel_example = os.path.relpath(outputfile, app.builder.outdir) - out.append('\n\n.. plot:: {}\n'.format(rel_example)) - out.append(' :include-source:\n\n') - else: - out.append('[`source code <{}>`_]\n\n'.format(fname)) - out.append('.. literalinclude:: {}\n\n'.format(fname)) - # Write the .py file contents (we didn't need to do this for - # plots as the plot directive does this for us.) - with open(outputfile, 'w') as fhstatic: - fhstatic.write(contents) - - with open(outrstfile, 'w') as fh: - fh.writelines(out) - - subdirIndexFile = os.path.join(rstdir, 'index.rst') - with open(subdirIndexFile, 'w') as fhsubdirIndex: - fhsubdirIndex.writelines(subdirIndex) - - with open(os.path.join(exampledir, 'index.rst'), 'w') as fhindex: - fhindex.writelines(index) - - -def setup(app): - app.connect('builder-inited', generate_example_rst) diff --git a/docs/iris/src/sphinxext/gen_gallery.py b/docs/iris/src/sphinxext/gen_gallery.py deleted file mode 100644 index b4b88ff3bd..0000000000 --- a/docs/iris/src/sphinxext/gen_gallery.py +++ /dev/null @@ -1,201 +0,0 @@ -# -# (C) Copyright 2012 MATPLOTLIB (vn 1.2.0) -# - -''' -Generate a thumbnail gallery of examples. -''' - -import os -import glob -import re -import warnings - -import matplotlib.image as image -from sphinx.util import status_iterator - -from sphinx.util import status_iterator - -template = '''\ -{{% extends "layout.html" %}} -{{% set title = "Thumbnail gallery" %}} - - -{{% block body %}} - -

    Click on any image to see full size image and source code

    -
    - - - -{} -{{% endblock %}} -''' - -multiimage = re.compile('(.*?)(_\d\d){1,2}') - - -def make_thumbnail(args): - image.thumbnail(args[0], args[1], 0.4) - - -def out_of_date(original, derived): - return (not os.path.exists(derived) or - os.stat(derived).st_mtime < os.stat(original).st_mtime) - - -def gen_gallery(app, doctree): - if app.builder.name != 'html': - return - - outdir = app.builder.outdir - rootdir = 'examples' - - # Images we want to skip for the gallery because they are an unusual - # size that doesn't layout well in a table, or because they may be - # redundant with other images or uninteresting. - skips = set([ - 'mathtext_examples', - 'matshow_02', - 'matshow_03', - 'matplotlib_icon']) - - thumbnails = {} - rows = [] - random_image = [] - toc_rows = [] - - link_template = ('' - '{alternative_text}' - '') - - header_template = ('
    ' - '

    {}' - '' - '

    ') - - toc_template = ('
  • ' - '{}' - '
  • ') - - random_image_content_template = ''' -// This file was automatically generated by gen_gallery.py & should not be -// modified directly. - -images = new Array(); - -{} - -''' - - random_image_template = "['{thumbfile}', '{full_image}', '{link}'];" - random_image_join = 'images[{}] = {}' - - dirs = ('General', 'Meteorology', 'Oceanography') - - for subdir in dirs: - rows.append(header_template.format(subdir, subdir, subdir)) - toc_rows.append(toc_template.format(subdir, subdir)) - - origdir = os.path.join(os.path.dirname(outdir), rootdir, subdir) - if not os.path.exists(origdir): - origdir = os.path.join(os.path.dirname(outdir), 'plot_directive', - rootdir, subdir) - thumbdir = os.path.join(outdir, rootdir, subdir, 'thumbnails') - if not os.path.exists(thumbdir): - os.makedirs(thumbdir) - - data = [] - - for filename in sorted(glob.glob(os.path.join(origdir, '*.png'))): - if filename.endswith('hires.png'): - continue - - path, filename = os.path.split(filename) - basename, ext = os.path.splitext(filename) - if basename in skips: - continue - - # Create thumbnails based on images in tmpdir, and place them - # within the build tree. - orig_path = str(os.path.join(origdir, filename)) - thumb_path = str(os.path.join(thumbdir, filename)) - if out_of_date(orig_path, thumb_path) or True: - thumbnails[orig_path] = thumb_path - - m = multiimage.match(basename) - if m is not None: - basename = m.group(1) - - data.append((subdir, basename, - os.path.join(rootdir, subdir, 'thumbnails', - filename))) - - for (subdir, basename, thumbfile) in data: - if thumbfile is not None: - anchor = os.path.basename(thumbfile) - anchor = os.path.splitext(anchor)[0].replace('_', '-') - link = 'examples/{}/{}.html#{}'.format( - subdir, - basename, - anchor) - rows.append(link_template.format( - href=link, - thumb_file=thumbfile, - alternative_text=basename)) - random_image.append(random_image_template.format( - link=link, - thumbfile=thumbfile, - basename=basename, - full_image='_images/' + os.path.basename(thumbfile))) - - if len(data) == 0: - warnings.warn('No thumbnails were found in {}'.format(subdir)) - - # Close out the
    opened up at the top of this loop. - rows.append('
    ') - - # Generate JS list of images for front page. - random_image_content = '\n'.join([random_image_join.format(i, line) - for i, line in enumerate(random_image)]) - random_image_content = random_image_content_template.format( - random_image_content) - random_image_script_path = os.path.join(app.builder.srcdir, - '_static', - 'random_image.js') - with open(random_image_script_path, 'w') as fh: - fh.write(random_image_content) - - content = template.format('\n'.join(toc_rows), - '\n'.join(rows)) - - # Only write out the file if the contents have actually changed. - # Otherwise, this triggers a full rebuild of the docs. - - gallery_path = os.path.join(app.builder.srcdir, - '_templates', - 'gallery.html') - if os.path.exists(gallery_path): - with open(gallery_path, 'r') as fh: - regenerate = fh.read() != content - else: - regenerate = True - if regenerate: - with open(gallery_path, 'w') as fh: - fh.write(content) - - for key in status_iterator(thumbnails, 'generating thumbnails... ', - length=len(thumbnails)): - image.thumbnail(key, thumbnails[key], 0.3) - - -def setup(app): - app.connect('env-updated', gen_gallery) diff --git a/docs/iris/src/sphinxext/generate_package_rst.py b/docs/iris/src/sphinxext/generate_package_rst.py index 0c6510c170..5ce9f6d014 100644 --- a/docs/iris/src/sphinxext/generate_package_rst.py +++ b/docs/iris/src/sphinxext/generate_package_rst.py @@ -8,11 +8,23 @@ import sys import re import inspect +import ntpath + +# list of tuples for modules to exclude. Useful if the documentation throws +# warnings, especially for experimental modules. +exclude_modules = [ + ("experimental/raster", "iris.experimental.raster") # gdal conflicts +] + + +# print to stdout, including the name of the python file +def autolog(message): + print("[{}] {}".format(ntpath.basename(__file__), message)) document_dict = { # Use autoclass for classes. - 'class': ''' + "class": """ {object_docstring} .. @@ -22,20 +34,21 @@ :undoc-members: :inherited-members: -''', - 'function': ''' +""", + "function": """ .. autofunction:: {object_name} -''', +""", # For everything else, let automodule do some magic... - None: ''' + None: """ .. autodata:: {object_name} -'''} +""", +} -horizontal_sep = ''' +horizontal_sep = """ .. raw:: html

    ↑ top ↑

    @@ -47,21 +60,22 @@ --> -''' +""" def lookup_object_type(obj): if inspect.isclass(obj): - return 'class' + return "class" elif inspect.isfunction(obj): - return 'function' + return "function" else: return None -def auto_doc_module(file_path, import_name, root_package, - package_toc=None, title=None): - doc = r'''.. _{import_name}: +def auto_doc_module( + file_path, import_name, root_package, package_toc=None, title=None +): + doc = r""".. _{import_name}: {title_underline} {title} @@ -77,54 +91,66 @@ def auto_doc_module(file_path, import_name, root_package, {module_elements} +""" -''' if package_toc: - sidebar = ''' -.. sidebar:: Modules in this package - + sidebar = """ {package_toc_tree} - '''.format(package_toc_tree=package_toc) + """.format( + package_toc_tree=package_toc + ) else: - sidebar = '' + sidebar = "" try: mod = __import__(import_name) except ImportError as e: - message = r'''.. error:: + message = r""".. error:: This module could not be imported. Some dependencies are missing:: - ''' + str(e) - return doc.format(title=title or import_name, - title_underline='=' * len(title or import_name), - import_name=import_name, root_package=root_package, - sidebar=sidebar, module_elements=message) + """ + str( + e + ) + return doc.format( + title=title or import_name, + title_underline="=" * len(title or import_name), + import_name=import_name, + root_package=root_package, + sidebar=sidebar, + module_elements=message, + ) mod = sys.modules[import_name] elems = dir(mod) - if '__all__' in elems: - document_these = [(attr_name, getattr(mod, attr_name)) - for attr_name in mod.__all__] + if "__all__" in elems: + document_these = [ + (attr_name, getattr(mod, attr_name)) for attr_name in mod.__all__ + ] else: - document_these = [(attr_name, getattr(mod, attr_name)) - for attr_name in elems - if (not attr_name.startswith('_') and - not inspect.ismodule(getattr(mod, attr_name)))] + document_these = [ + (attr_name, getattr(mod, attr_name)) + for attr_name in elems + if ( + not attr_name.startswith("_") + and not inspect.ismodule(getattr(mod, attr_name)) + ) + ] def is_from_this_module(arg): - name = arg[0] + # name = arg[0] obj = arg[1] - return (hasattr(obj, '__module__') and - obj.__module__ == mod.__name__) + return ( + hasattr(obj, "__module__") and obj.__module__ == mod.__name__ + ) - sort_order = {'class': 2, 'function': 1} + sort_order = {"class": 2, "function": 1} # Sort them according to sort_order dict. def sort_key(arg): - name = arg[0] + # name = arg[0] obj = arg[1] return sort_order.get(lookup_object_type(obj), 0) @@ -133,63 +159,81 @@ def sort_key(arg): lines = [] for element, obj in document_these: - object_name = import_name + '.' + element + object_name = import_name + "." + element obj_content = document_dict[lookup_object_type(obj)].format( object_name=object_name, - object_name_header_line='+' * len(object_name), - object_docstring=inspect.getdoc(obj)) + object_name_header_line="+" * len(object_name), + object_docstring=inspect.getdoc(obj), + ) lines.append(obj_content) lines = horizontal_sep.join(lines) - module_elements = '\n'.join(' * :py:obj:`{}`'.format(element) - for element, obj in document_these) + module_elements = "\n".join( + " * :py:obj:`{}`".format(element) for element, obj in document_these + ) lines = doc + lines - return lines.format(title=title or import_name, - title_underline='=' * len(title or import_name), - import_name=import_name, root_package=root_package, - sidebar=sidebar, module_elements=module_elements) + return lines.format( + title=title or import_name, + title_underline="=" * len(title or import_name), + import_name=import_name, + root_package=root_package, + sidebar=sidebar, + module_elements=module_elements, + ) def auto_doc_package(file_path, import_name, root_package, sub_packages): - max_depth = 1 if import_name == 'iris' else 2 - package_toc = '\n '.join(sub_packages) - package_toc = ''' + max_depth = 1 if import_name == "iris" else 2 + package_toc = "\n ".join(sub_packages) + + package_toc = """ .. toctree:: :maxdepth: {:d} :titlesonly: + :hidden: {} -'''.format(max_depth, package_toc) +""".format( + max_depth, package_toc + ) - if '.' in import_name: + if "." in import_name: title = None else: - title = import_name.capitalize() + ' reference documentation' + title = import_name.capitalize() + " API" - return auto_doc_module(file_path, import_name, root_package, - package_toc=package_toc, title=title) + return auto_doc_module( + file_path, + import_name, + root_package, + package_toc=package_toc, + title=title, + ) def auto_package_build(app): root_package = app.config.autopackage_name if root_package is None: - raise ValueError('set the autopackage_name variable in the ' - 'conf.py file') + raise ValueError( + "set the autopackage_name variable in the " "conf.py file" + ) if not isinstance(root_package, list): - raise ValueError('autopackage was expecting a list of packages to ' - 'document e.g. ["itertools"]') + raise ValueError( + "autopackage was expecting a list of packages to " + 'document e.g. ["itertools"]' + ) for package in root_package: do_package(package) def do_package(package_name): - out_dir = package_name + os.path.sep + out_dir = "generated/api" + os.path.sep # Import the root package. If this fails then an import error will be # raised. @@ -199,38 +243,45 @@ def do_package(package_name): package_folder = [] module_folders = {} + for root, subFolders, files in os.walk(rootdir): for fname in files: name, ext = os.path.splitext(fname) # Skip some non-relevant files. - if (fname.startswith('.') or fname.startswith('#') or - re.search('^_[^_]', fname) or fname.find('.svn') >= 0 or - not (ext in ['.py', '.so'])): + if ( + fname.startswith(".") + or fname.startswith("#") + or re.search("^_[^_]", fname) + or fname.find(".svn") >= 0 + or not (ext in [".py", ".so"]) + ): continue # Handle new shared library naming conventions - if ext == '.so': - name = name.split('.', 1)[0] + if ext == ".so": + name = name.split(".", 1)[0] - rel_path = root_package + \ - os.path.join(root, fname).split(rootdir)[-1] - mod_folder = root_package + \ - os.path.join(root).split(rootdir)[-1].replace('/', '.') + rel_path = ( + root_package + os.path.join(root, fname).split(rootdir)[-1] + ) + mod_folder = root_package + os.path.join(root).split(rootdir)[ + -1 + ].replace("/", ".") # Only add this package to folder list if it contains an __init__ # script. - if name == '__init__': + if name == "__init__": package_folder.append([mod_folder, rel_path]) else: - import_name = mod_folder + '.' + name + import_name = mod_folder + "." + name mf_list = module_folders.setdefault(mod_folder, []) mf_list.append((import_name, rel_path)) if not os.path.exists(out_dir): os.makedirs(out_dir) for package, package_path in package_folder: - if '._' in package or 'test' in package: + if "._" in package or "test" in package: continue paths = [] @@ -242,60 +293,83 @@ def do_package(package_name): continue if not spackage.startswith(package): continue - if spackage.count('.') > package.count('.') + 1: + if spackage.count(".") > package.count(".") + 1: continue - if 'test' in spackage: + if "test" in spackage: continue - split_path = spackage.rsplit('.', 2)[-2:] - if any(part[0] == '_' for part in split_path): + split_path = spackage.rsplit(".", 2)[-2:] + if any(part[0] == "_" for part in split_path): continue - paths.append(os.path.join(*split_path) + '.rst') + paths.append(os.path.join(*split_path) + ".rst") - paths.extend(os.path.join(os.path.basename(os.path.dirname(path)), - os.path.basename(path).split('.', 1)[0]) - for imp_name, path in module_folders.get(package, [])) + paths.extend( + os.path.join( + os.path.basename(os.path.dirname(path)), + os.path.basename(path).split(".", 1)[0], + ) + for imp_name, path in module_folders.get(package, []) + ) paths.sort() + + # check for any modules to exclude + for exclude_module in exclude_modules: + if exclude_module[0] in paths: + autolog( + "Excluding module in package: {}".format(exclude_module[0]) + ) + paths.remove(exclude_module[0]) + doc = auto_doc_package(package_path, package, root_package, paths) - package_dir = out_dir + package.replace('.', os.path.sep) + package_dir = out_dir + package.replace(".", os.path.sep) if not os.path.exists(package_dir): - os.makedirs(out_dir + package.replace('.', os.path.sep)) + os.makedirs(out_dir + package.replace(".", os.path.sep)) - out_path = package_dir + '.rst' + out_path = package_dir + ".rst" if not os.path.exists(out_path): - print('Creating non-existent document {} ...'.format(out_path)) - with open(out_path, 'w') as fh: + autolog("Creating {} ...".format(out_path)) + with open(out_path, "w") as fh: fh.write(doc) else: - with open(out_path, 'r') as fh: - existing_content = ''.join(fh.readlines()) + with open(out_path, "r") as fh: + existing_content = "".join(fh.readlines()) if doc != existing_content: - print('Creating out of date document {} ...'.format( - out_path)) - with open(out_path, 'w') as fh: + autolog("Creating {} ...".format(out_path)) + with open(out_path, "w") as fh: fh.write(doc) for import_name, module_path in module_folders.get(package, []): - doc = auto_doc_module(module_path, import_name, root_package) - out_path = out_dir + import_name.replace('.', os.path.sep) + '.rst' - if not os.path.exists(out_path): - print('Creating non-existent document {} ...'.format( - out_path)) - with open(out_path, 'w') as fh: - fh.write(doc) - else: - with open(out_path, 'r') as fh: - existing_content = ''.join(fh.readlines()) - if doc != existing_content: - print('Creating out of date document {} ...'.format( - out_path)) - with open(out_path, 'w') as fh: - fh.write(doc) + # check for any modules to exclude + for exclude_module in exclude_modules: + if import_name == exclude_module[1]: + autolog( + "Excluding module file: {}".format(exclude_module[1]) + ) + else: + doc = auto_doc_module( + module_path, import_name, root_package + ) + out_path = ( + out_dir + + import_name.replace(".", os.path.sep) + + ".rst" + ) + if not os.path.exists(out_path): + autolog("Creating {} ...".format(out_path)) + with open(out_path, "w") as fh: + fh.write(doc) + else: + with open(out_path, "r") as fh: + existing_content = "".join(fh.readlines()) + if doc != existing_content: + autolog("Creating {} ...".format(out_path)) + with open(out_path, "w") as fh: + fh.write(doc) def setup(app): - app.connect('builder-inited', auto_package_build) - app.add_config_value('autopackage_name', None, 'env') + app.connect("builder-inited", auto_package_build) + app.add_config_value("autopackage_name", None, "env") diff --git a/docs/iris/src/whitepapers/change_management.rst b/docs/iris/src/techpapers/change_management.rst similarity index 96% rename from docs/iris/src/whitepapers/change_management.rst rename to docs/iris/src/techpapers/change_management.rst index b279c91b96..2218eb4212 100644 --- a/docs/iris/src/whitepapers/change_management.rst +++ b/docs/iris/src/techpapers/change_management.rst @@ -1,3 +1,5 @@ +:orphan: + .. _change_management: Change Management in Iris from the User's perspective @@ -44,25 +46,28 @@ User Actions : How you should respond to changes and releases Checklist : * when a new **testing or candidate version** is announced - if convenient, test your working legacy code against it and report any problems. + + * if convenient, test your working legacy code against it and report any problems. * when a new **minor version is released** - * review the 'Whats New' documentation to see if it introduces any - deprecations that may affect you. - * run your working legacy code and check for any deprecation warnings, - indicating that modifications may be necessary at some point - * when convenient : + * review the 'Whats New' documentation to see if it introduces any + deprecations that may affect you. + * run your working legacy code and check for any deprecation warnings, + indicating that modifications may be necessary at some point + * when convenient : * review existing code for use of deprecated features * rewrite code to replace deprecated features * when a new major version is **announced** - ensure your code runs, without producing deprecation warnings, in the + + * ensure your code runs, without producing deprecation warnings, in the previous minor release * when a new major version is **released** - check for new deprecation warnings, as for a minor release + + * check for new deprecation warnings, as for a minor release Details @@ -81,6 +86,7 @@ Our practices are intended be compatible with the principles defined in the `SemVer project `_ . Key concepts covered here: + * :ref:`Release versions ` * :ref:`Backwards compatibility ` * :ref:`Deprecation ` @@ -95,18 +101,18 @@ Backwards compatibility usages unchanged (see :ref:`terminology ` below). Minor releases may only include backwards-compatible changes. -The following are examples of backward-compatible changes : +The following are examples of backward-compatible changes: * changes to documentation * adding to a module : new submodules, functions, classes or properties * adding to a class : new methods or properties * adding to a function or method : new **optional** arguments or keywords -The following are examples of **non-** backward-compatible changes : +The following are examples of **non-** backward-compatible changes: * removing (which includes *renaming*) any public module or submodule * removing any public component : a module, class, method, function or - data object property of a public API component + data object property of a public API component * removing any property of a public object * removing an argument or keyword from a method or function * adding a required argument to a method or function diff --git a/docs/iris/src/whitepapers/index.rst b/docs/iris/src/techpapers/index.rst similarity index 54% rename from docs/iris/src/whitepapers/index.rst rename to docs/iris/src/techpapers/index.rst index dd0876d257..773c8f7059 100644 --- a/docs/iris/src/whitepapers/index.rst +++ b/docs/iris/src/techpapers/index.rst @@ -1,8 +1,9 @@ -.. _whitepapers_index: +.. _techpapers_index: + + +Iris Technical Papers +===================== -============================ -Iris technical 'Whitepapers' -============================ Extra information on specific technical issues. .. toctree:: diff --git a/docs/iris/src/whitepapers/missing_data_handling.rst b/docs/iris/src/techpapers/missing_data_handling.rst similarity index 100% rename from docs/iris/src/whitepapers/missing_data_handling.rst rename to docs/iris/src/techpapers/missing_data_handling.rst diff --git a/docs/iris/src/whitepapers/um_files_loading.rst b/docs/iris/src/techpapers/um_files_loading.rst similarity index 100% rename from docs/iris/src/whitepapers/um_files_loading.rst rename to docs/iris/src/techpapers/um_files_loading.rst diff --git a/docs/iris/src/userguide/citation.rst b/docs/iris/src/userguide/citation.rst index 01b655574e..7ce0a8ffc0 100644 --- a/docs/iris/src/userguide/citation.rst +++ b/docs/iris/src/userguide/citation.rst @@ -23,7 +23,7 @@ For example:: ******************* -Downloaded Software +Downloaded software ******************* Suggested format:: @@ -36,7 +36,7 @@ For example:: ******************** -Checked out Software +Checked out software ******************** Suggested format:: diff --git a/docs/iris/src/userguide/code_maintenance.rst b/docs/iris/src/userguide/code_maintenance.rst index 00ba30506c..f5914da471 100644 --- a/docs/iris/src/userguide/code_maintenance.rst +++ b/docs/iris/src/userguide/code_maintenance.rst @@ -1,11 +1,11 @@ -Code Maintenance +Code maintenance ================ From a user point of view "code maintenance" means ensuring that your existing working code stays working, in the face of changes to Iris. -Stability and Change +Stability and change --------------------- In practice, as Iris develops, most users will want to periodically upgrade @@ -25,7 +25,7 @@ maintenance effort is probably still necessary : for some completely unconnected reason. -Principles of Change Management +Principles of change management ------------------------------- When you upgrade software to a new version, you often find that you need to diff --git a/docs/iris/src/userguide/cube_maths.rst b/docs/iris/src/userguide/cube_maths.rst index 8fe6eb12d5..6af4d5b3a6 100644 --- a/docs/iris/src/userguide/cube_maths.rst +++ b/docs/iris/src/userguide/cube_maths.rst @@ -208,7 +208,7 @@ The result could now be plotted using the guidance provided in the .. only:: html A very similar example to this can be found in - :doc:`/examples/Meteorology/deriving_phenomena`. + :ref:`sphx_glr_generated_gallery_meteorology_plot_deriving_phenomena.py`. .. only:: latex diff --git a/docs/iris/src/userguide/cube_statistics.rst b/docs/iris/src/userguide/cube_statistics.rst index 3ca7d9a2e0..31e165d35c 100644 --- a/docs/iris/src/userguide/cube_statistics.rst +++ b/docs/iris/src/userguide/cube_statistics.rst @@ -93,7 +93,8 @@ can be used instead of ``MEAN``, see :mod:`iris.analysis` for a full list of currently supported operators. For an example of using this functionality, the -:ref:`Hovmoller diagram ` example found +:ref:`sphx_glr_generated_gallery_meteorology_plot_hovmoller.py` +example found in the gallery takes a zonal mean of an ``XYT`` cube by using the ``collapsed`` method with ``latitude`` and ``iris.analysis.MEAN`` as arguments. @@ -147,7 +148,7 @@ These areas can now be passed to the ``collapsed`` method as weights: Several examples of area averaging exist in the gallery which may be of interest, including an example on taking a :ref:`global area-weighted mean -`. +`. .. _cube-statistics-aggregated-by: diff --git a/docs/iris/src/userguide/end_of_userguide.rst b/docs/iris/src/userguide/end_of_userguide.rst deleted file mode 100644 index c8f951a634..0000000000 --- a/docs/iris/src/userguide/end_of_userguide.rst +++ /dev/null @@ -1,15 +0,0 @@ -End of the user guide -===================== - -If this was your first time reading the user guide, we hope you found it enjoyable and informative. -It is advised that you now go back to the :doc:`start ` and try experimenting with your own data. - - - -Iris gallery ------------- -It can be very daunting to start coding a project from an empty file, that is why you will find many in-depth -examples in the Iris gallery which can be used as a goal driven reference to producing your own visualisations. - -If you produce a visualisation which you think would add value to the gallery, please get in touch with us and -we will consider including it as an example for all to benefit from. diff --git a/docs/iris/src/userguide/index.rst b/docs/iris/src/userguide/index.rst index 4fb7b62155..2a3b32fe11 100644 --- a/docs/iris/src/userguide/index.rst +++ b/docs/iris/src/userguide/index.rst @@ -1,11 +1,9 @@ .. _user_guide_index: +.. _user_guide_introduction: -=============== -Iris user guide -=============== +Introduction +============ -How to use the user guide ---------------------------- If you are reading this user guide for the first time it is strongly recommended that you read the user guide fully before experimenting with your own data files. @@ -18,24 +16,16 @@ links in order to understand the guide but they may serve as a useful reference Since later pages depend on earlier ones, try reading this user guide sequentially using the ``next`` and ``previous`` links. -User guide table of contents -------------------------------- - -.. toctree:: - :maxdepth: 2 - :numbered: - - iris_cubes.rst - loading_iris_cubes.rst - saving_iris_cubes.rst - navigating_a_cube.rst - subsetting_a_cube.rst - real_and_lazy_data.rst - plotting_a_cube.rst - interpolation_and_regridding.rst - merge_and_concat.rst - cube_statistics.rst - cube_maths.rst - citation.rst - code_maintenance.rst - end_of_userguide.rst +* :doc:`iris_cubes` +* :doc:`loading_iris_cubes` +* :doc:`saving_iris_cubes` +* :doc:`navigating_a_cube` +* :doc:`subsetting_a_cube` +* :doc:`real_and_lazy_data` +* :doc:`plotting_a_cube` +* :doc:`interpolation_and_regridding` +* :doc:`merge_and_concat` +* :doc:`cube_statistics` +* :doc:`cube_maths` +* :doc:`citation` +* :doc:`code_maintenance` diff --git a/docs/iris/src/userguide/iris_cubes.rst b/docs/iris/src/userguide/iris_cubes.rst index dc423afba1..5929c402f2 100644 --- a/docs/iris/src/userguide/iris_cubes.rst +++ b/docs/iris/src/userguide/iris_cubes.rst @@ -1,13 +1,9 @@ -.. _user_guide_introduction: - -=================== -Introduction -=================== - .. _iris_data_structures: +==================== Iris data structures --------------------- +==================== + The top level object in Iris is called a cube. A cube contains data and metadata about a phenomenon. In Iris, a cube is an interpretation of the *Climate and Forecast (CF) Metadata Conventions* whose purpose is to: @@ -33,6 +29,7 @@ by definition, its phenomenon. * Each coordinate has a name and a unit. * When a coordinate is added to a cube, the data dimensions that it represents are also provided. + * The shape of a coordinate is always the same as the shape of the associated data dimension(s) on the cube. * A dimension not explicitly listed signifies that the coordinate is independent of that dimension. * Each dimension of a coordinate must be mapped to a data dimension. The only coordinates with no mapping are diff --git a/docs/iris/src/userguide/loading_iris_cubes.rst b/docs/iris/src/userguide/loading_iris_cubes.rst index bf50acc614..bbb83194db 100644 --- a/docs/iris/src/userguide/loading_iris_cubes.rst +++ b/docs/iris/src/userguide/loading_iris_cubes.rst @@ -38,10 +38,12 @@ This shows that there were 2 cubes as a result of loading the file, they were: ``air_potential_temperature`` and ``surface_altitude``. The ``surface_altitude`` cube was 2 dimensional with: + * the two dimensions have extents of 204 and 187 respectively and are represented by the ``grid_latitude`` and ``grid_longitude`` coordinates. The ``air_potential_temperature`` cubes were 4 dimensional with: + * the same length ``grid_latitude`` and ``grid_longitude`` dimensions as ``surface_altitide`` * a ``time`` dimension of length 3 diff --git a/docs/iris/src/userguide/merge_and_concat.rst b/docs/iris/src/userguide/merge_and_concat.rst index b742b3ef5f..0d844ac403 100644 --- a/docs/iris/src/userguide/merge_and_concat.rst +++ b/docs/iris/src/userguide/merge_and_concat.rst @@ -1,7 +1,7 @@ .. _merge_and_concat: ===================== -Merge and Concatenate +Merge and concatenate ===================== We saw in the :doc:`loading_iris_cubes` chapter that Iris tries to load as few cubes as diff --git a/docs/iris/src/userguide/plotting_a_cube.rst b/docs/iris/src/userguide/plotting_a_cube.rst index d82cbbb027..f646aa4b3e 100644 --- a/docs/iris/src/userguide/plotting_a_cube.rst +++ b/docs/iris/src/userguide/plotting_a_cube.rst @@ -190,7 +190,7 @@ and providing the label keyword to identify it. Once all of the lines have been added the :func:`matplotlib.pyplot.legend` function can be called to indicate that a legend is desired: -.. plot:: ../example_code/General/lineplot_with_legend.py +.. plot:: ../gallery_code/general/plot_lineplot_with_legend.py :include-source: This example of consecutive ``qplt.plot`` calls coupled with the @@ -272,7 +272,7 @@ Brewer colour palettes *********************** Iris includes colour specifications and designs developed by -`Cynthia Brewer `_. +`Cynthia Brewer `_ These colour schemes are freely available under the following licence:: Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes @@ -298,7 +298,7 @@ For adding citations to Iris plots, see :ref:`brewer-cite` (below). Available Brewer Schemes ======================== The following subset of Brewer palettes found at -`colorbrewer.org `_ are available within Iris. +`colorbrewer2.org `_ are available within Iris. .. plot:: userguide/plotting_examples/brewer.py diff --git a/docs/iris/src/userguide/plotting_examples/1d_quickplot_simple.py b/docs/iris/src/userguide/plotting_examples/1d_quickplot_simple.py index 30a5fc4318..f3772328ab 100644 --- a/docs/iris/src/userguide/plotting_examples/1d_quickplot_simple.py +++ b/docs/iris/src/userguide/plotting_examples/1d_quickplot_simple.py @@ -11,4 +11,5 @@ temperature_1d = temperature[5, :] qplt.plot(temperature_1d) + plt.show() diff --git a/docs/iris/src/userguide/plotting_examples/1d_simple.py b/docs/iris/src/userguide/plotting_examples/1d_simple.py index b76752ac18..ea90faf402 100644 --- a/docs/iris/src/userguide/plotting_examples/1d_simple.py +++ b/docs/iris/src/userguide/plotting_examples/1d_simple.py @@ -11,4 +11,5 @@ temperature_1d = temperature[5, :] iplt.plot(temperature_1d) + plt.show() diff --git a/docs/iris/src/userguide/plotting_examples/1d_with_legend.py b/docs/iris/src/userguide/plotting_examples/1d_with_legend.py index 1ee75e1ed9..26aeeef9a6 100644 --- a/docs/iris/src/userguide/plotting_examples/1d_with_legend.py +++ b/docs/iris/src/userguide/plotting_examples/1d_with_legend.py @@ -1,5 +1,4 @@ import matplotlib.pyplot as plt - import iris import iris.plot as iplt diff --git a/docs/iris/src/userguide/plotting_examples/brewer.py b/docs/iris/src/userguide/plotting_examples/brewer.py index e4533a28f5..f2ede9f9bc 100644 --- a/docs/iris/src/userguide/plotting_examples/brewer.py +++ b/docs/iris/src/userguide/plotting_examples/brewer.py @@ -4,19 +4,26 @@ import iris.palette -a = np.linspace(0, 1, 256).reshape(1, -1) -a = np.vstack((a, a)) - -maps = sorted(iris.palette.CMAP_BREWER) -nmaps = len(maps) - -fig = plt.figure(figsize=(7, 10)) -fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) -for i, m in enumerate(maps): - ax = plt.subplot(nmaps, 1, i + 1) - plt.axis("off") - plt.imshow(a, aspect="auto", cmap=plt.get_cmap(m), origin="lower") - pos = list(ax.get_position().bounds) - fig.text(pos[0] - 0.01, pos[1], m, fontsize=8, horizontalalignment="right") - -plt.show() +def main(): + a = np.linspace(0, 1, 256).reshape(1, -1) + a = np.vstack((a, a)) + + maps = sorted(iris.palette.CMAP_BREWER) + nmaps = len(maps) + + fig = plt.figure(figsize=(7, 10)) + fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) + for i, m in enumerate(maps): + ax = plt.subplot(nmaps, 1, i + 1) + plt.axis("off") + plt.imshow(a, aspect="auto", cmap=plt.get_cmap(m), origin="lower") + pos = list(ax.get_position().bounds) + fig.text( + pos[0] - 0.01, pos[1], m, fontsize=8, horizontalalignment="right" + ) + + plt.show() + + +if __name__ == "__main__": + main() diff --git a/docs/iris/src/userguide/plotting_examples/cube_blockplot.py b/docs/iris/src/userguide/plotting_examples/cube_blockplot.py index cd380f5e35..0961a97fdb 100644 --- a/docs/iris/src/userguide/plotting_examples/cube_blockplot.py +++ b/docs/iris/src/userguide/plotting_examples/cube_blockplot.py @@ -1,5 +1,4 @@ import matplotlib.pyplot as plt - import iris import iris.quickplot as qplt diff --git a/docs/iris/src/userguide/plotting_examples/cube_brewer_cite_contourf.py b/docs/iris/src/userguide/plotting_examples/cube_brewer_cite_contourf.py index 6dce2b39de..45ba800485 100644 --- a/docs/iris/src/userguide/plotting_examples/cube_brewer_cite_contourf.py +++ b/docs/iris/src/userguide/plotting_examples/cube_brewer_cite_contourf.py @@ -1,5 +1,4 @@ import matplotlib.pyplot as plt - import iris import iris.quickplot as qplt import iris.plot as iplt diff --git a/docs/iris/src/userguide/saving_iris_cubes.rst b/docs/iris/src/userguide/saving_iris_cubes.rst index f14f83006e..fa67b6213d 100644 --- a/docs/iris/src/userguide/saving_iris_cubes.rst +++ b/docs/iris/src/userguide/saving_iris_cubes.rst @@ -97,7 +97,7 @@ netCDF NetCDF is a flexible container for metadata and cube metadata is closely related to the CF for netCDF semantics. This means that cube metadata is well represented in netCDF files, closely resembling the in memory metadata representation. Thus there is no provision for similar save customisation functionality for netCDF saving, all customisations should be applied to the cube prior to saving to netCDF. -Bespoke Saver +Bespoke saver -------------- A bespoke saver may be written to support an alternative file format. This can be provided to the :py:func:`iris.save` function, enabling Iris to write to a different file format. diff --git a/docs/iris/src/whatsnew/1.0.rst b/docs/iris/src/whatsnew/1.0.rst index 2a415c1bfe..6340d0495d 100644 --- a/docs/iris/src/whatsnew/1.0.rst +++ b/docs/iris/src/whatsnew/1.0.rst @@ -69,7 +69,7 @@ CF-netCDF coordinate systems ============================ The coordinate systems in Iris are now defined by the CF-netCDF -`grid mappings `_. +`grid mappings `_. As of Iris 1.0 a subset of the CF-netCDF coordinate systems are supported, but this will be expanded in subsequent versions. Adding this code is a relatively simple, incremental process - it would make a @@ -79,13 +79,13 @@ contributing to the project. The coordinate systems available in Iris 1.0 and their corresponding Iris classes are: -================================================================================================== ========================================= -CF name Iris class -================================================================================================== ========================================= -`Latitude-longitude `_ :class:`~iris.coord_systems.GeogCS` -`Rotated pole `_ :class:`~iris.coord_systems.RotatedGeogCS` -`Transverse Mercator `_ :class:`~iris.coord_systems.TransverseMercator` -================================================================================================== ========================================= +================================================================================================================= ========================================= +CF name Iris class +================================================================================================================= ========================================= +`Latitude-longitude `_ :class:`~iris.coord_systems.GeogCS` +`Rotated pole `_ :class:`~iris.coord_systems.RotatedGeogCS` +`Transverse Mercator `_ :class:`~iris.coord_systems.TransverseMercator` +================================================================================================================= ========================================= For convenience, Iris also includes the :class:`~iris.coord_systems.OSGB` class which provides a simple way to create the transverse Mercator @@ -147,8 +147,7 @@ Hybrid-pressure With the introduction of the :class:`~iris.aux_factory.HybridPressureFactory` class, it is now possible to represent data expressed on a -hybrid-pressure vertical coordinate, as defined by the second variant in -`Appendix D `_. +`hybrid-pressure vertical coordinate `_. A hybrid-pressure factory is created with references to the coordinates which provide the components of the hybrid coordinate ("ap" and "b") and the surface pressure. In return, it provides a virtual "pressure" @@ -160,7 +159,7 @@ the derived "pressure" coordinate for certain data [#f1]_ from the .. [#f1] Where the level type is either 105 or 119, and where the surface pressure has an ECMWF paramId of - `152 `_. + `152 `_. NetCDF diff --git a/docs/iris/src/whatsnew/1.10.rst b/docs/iris/src/whatsnew/1.10.rst index 26f21c0252..bc2b7528b2 100644 --- a/docs/iris/src/whatsnew/1.10.rst +++ b/docs/iris/src/whatsnew/1.10.rst @@ -1,4 +1,4 @@ -What's New in Iris 1.10 +What's new in Iris 1.10 *********************** :Release: 1.10 @@ -7,7 +7,7 @@ What's New in Iris 1.10 This document explains the new/changed features of Iris in version 1.10 (:doc:`View all changes `.) -Iris 1.10 Features +Iris 1.10 features ================== .. _iris_grib_added: @@ -76,7 +76,7 @@ Iris 1.10 Features * Cubes with anonymous dimensions can now be concatenated. This can only occur along a dimension that is not anonymous. * NetCDF saving of ``valid_range``, ``valid_min`` and ``valid_max`` cube attributes is now allowed. -Bugs Fixed +Bugs fixed ========== * Altered Cell Methods to display coordinate's standard_name rather than var_name where appropriate to avoid human confusion. * Saving multiple cubes with netCDF4 protected attributes should now work as expected. @@ -101,7 +101,7 @@ Bugs Fixed * Concatenation no longer occurs when the auxiliary coordinates of the cubes do not match. This check is not applied to AuxCoords that span the dimension the concatenation is occuring along. This behaviour can be switched off by setting the ``check_aux_coords`` kwarg in :meth:`iris.cube.CubeList.concatenate` to False. * Fixed a bug in :meth:`iris.cube.Cube.subset` where an exception would be thrown while trying to subset over a non-dimensional scalar coordinate. -Incompatible Changes +Incompatible changes ==================== * The source and target for :meth:`iris.experimental.regrid.PointInCell.regridder` must now have defined coordinate systems (i.e. not ``None``). Additionally, the source data X and Y coordinates must have the same cube dimensions. @@ -170,7 +170,7 @@ Documentation Changes * It is now clear that repeated values will form a group under :meth:`iris.cube.Cube.aggregated_by` even if they aren't consecutive. Hence, the documentation for :mod:`iris.cube` has been changed to reflect this. * The documentation for :meth:`iris.analysis.calculus.curl` has been updated for clarity. * False claims about :meth:`iris.fileformats.pp.save`, :meth:`iris.fileformats.pp.as_pairs`, and :meth:`iris.fileformats.pp.as_fields` being able to take instances of :class:`iris.cube.CubeList` as inputs have been removed. -* A :doc:`new code example <../examples/Meteorology/wind_speed>`, demonstrating the use of a quiver plot to display wind speeds over Lake Victoria, has been added. +* A new code example :ref:`sphx_glr_generated_gallery_meteorology_plot_wind_speed.py`, demonstrating the use of a quiver plot to display wind speeds over Lake Victoria, has been added. * The docstring for :data:`iris.analysis.SUM` has been updated to explicitly state that weights passed to it aren't normalised internally. * A note regarding the impossibility of partially collapsing multi-dimensional coordinates has been added to the user guide. diff --git a/docs/iris/src/whatsnew/1.11.rst b/docs/iris/src/whatsnew/1.11.rst index eb93ec2f8c..560bb07032 100644 --- a/docs/iris/src/whatsnew/1.11.rst +++ b/docs/iris/src/whatsnew/1.11.rst @@ -1,4 +1,4 @@ -What's New in Iris 1.11 +What's new in Iris 1.11 *********************** :Release: 1.11 @@ -7,14 +7,14 @@ What's New in Iris 1.11 This document explains the new/changed features of Iris in version 1.11 (:doc:`View all changes `.) -Iris 1.11 Features +Iris 1.11 features ================== * If available, display the ``STASH`` code instead of ``unknown / (unknown)`` when printing cubes with no ``standard_name`` and no ``units``. * Support for saving to netCDF with data packing has been added. * The coordinate system :class:`iris.coord_systems.LambertAzimuthalEqualArea` has been added with NetCDF saving support. -Bugs Fixed +Bugs fixed ========== * Fixed a floating point tolerance bug in :func:`iris.experimental.regrid.regrid_area_weighted_rectilinear_src_and_grid` for wrapped longitudes. @@ -25,7 +25,7 @@ Bugs Fixed * When saving to NetCDF, the existing behaviour of writing string attributes as ASCII has been maintained across known versions of netCDF4-python. -Documentation Changes +Documentation changes ===================== * Fuller doc-string detail added to :func:`iris.analysis.cartography.unrotate_pole` and :func:`iris.analysis.cartography.rotate_pole`. diff --git a/docs/iris/src/whatsnew/1.12.rst b/docs/iris/src/whatsnew/1.12.rst index 59ea47d876..bd02f0937a 100644 --- a/docs/iris/src/whatsnew/1.12.rst +++ b/docs/iris/src/whatsnew/1.12.rst @@ -1,4 +1,4 @@ -What's New in Iris 1.12 +What's new in Iris 1.12 *********************** :Release: 1.12 @@ -7,7 +7,7 @@ What's New in Iris 1.12 This document explains the new/changed features of Iris in version 1.12 (:doc:`View all changes `.) -Iris 1.12 Features +Iris 1.12 features ================== .. _showcase: @@ -125,7 +125,7 @@ Deprecations of the new fast-loading mechanism provided by :meth:`iris.fileformats.um.structured_um_loading`. -Documentation Changes +Documentation changes ===================== * Corrected documentation of :class:`iris.analysis.AreaWeighted` scheme to make the usage scope clearer. diff --git a/docs/iris/src/whatsnew/1.13.rst b/docs/iris/src/whatsnew/1.13.rst index 532c160f13..7435e5bb07 100644 --- a/docs/iris/src/whatsnew/1.13.rst +++ b/docs/iris/src/whatsnew/1.13.rst @@ -1,4 +1,4 @@ -What's New in Iris 1.13 +What's new in Iris 1.13 *********************** :Release: 1.13 @@ -8,7 +8,7 @@ What's New in Iris 1.13 This document explains the new/changed features of Iris in version 1.13 (:doc:`View all changes `.) -Iris 1.13 Features +Iris 1.13 features ================== * Allow the reading of NAME trajectories stored by time instead of by particle number. @@ -16,7 +16,7 @@ Iris 1.13 Features * Data arrays may be shared between cubes, and subsets of cubes, by using the :meth:`iris.cube.share_data` flag. -Bug Fixes +Bug fixes ========= * The bounds are now set correctly on the longitude coordinate if a zonal mean diagnostic has been loaded from a PP file as per the CF Standard. diff --git a/docs/iris/src/whatsnew/1.4.rst b/docs/iris/src/whatsnew/1.4.rst index 053a6e1096..3586b05a5c 100644 --- a/docs/iris/src/whatsnew/1.4.rst +++ b/docs/iris/src/whatsnew/1.4.rst @@ -105,8 +105,8 @@ Iris-Pandas interoperablilty Conversion to and from Pandas Series_ and DataFrames_ is now available. See :mod:`iris.pandas` for more details. -.. _Series: http://pandas.pydata.org/pandas-docs/stable/api.html#series -.. _DataFrames: http://pandas.pydata.org/pandas-docs/stable/api.html#dataframe +.. _Series: https://pandas.pydata.org/pandas-docs/stable/reference/series.html +.. _DataFrames: https://pandas.pydata.org/pandas-docs/stable/reference/frame.html .. _load-opendap: diff --git a/docs/iris/src/whatsnew/1.5.rst b/docs/iris/src/whatsnew/1.5.rst index 7af1e40285..6a4f418259 100644 --- a/docs/iris/src/whatsnew/1.5.rst +++ b/docs/iris/src/whatsnew/1.5.rst @@ -101,7 +101,7 @@ Iris 1.5 features the direction of vertical axes will be reversed if the corresponding coordinate has a "positive" attribute set to "down". - see: :ref:`Oceanography-atlantic_profiles` + see: :ref:`sphx_glr_generated_gallery_oceanography_plot_atlantic_profiles.py` * New PP stashcode translations added including 'dewpoint' and 'relative_humidity'. diff --git a/docs/iris/src/whatsnew/1.7.rst b/docs/iris/src/whatsnew/1.7.rst index 2f3a52fbb9..2d4395239b 100644 --- a/docs/iris/src/whatsnew/1.7.rst +++ b/docs/iris/src/whatsnew/1.7.rst @@ -229,20 +229,19 @@ Deprecations :func:`iris.fileformats.grib.reset_load_rules` functions. * Matplotlib is no longer a core Iris dependency. -Documentation Changes +Documentation changes ===================== * New sections on :ref:`cube broadcasting ` and :doc:`regridding and interpolation ` have been added to the :doc:`user guide `. * An example demonstrating custom log-scale colouring has been added. - See :ref:`General-anomaly_log_colouring`. + See :ref:`sphx_glr_generated_gallery_general_plot_anomaly_log_colouring.py`. * An example demonstrating the creation of a custom :class:`iris.analysis.Aggregator` has been added. - See :ref:`General-custom_aggregation`. + See :ref:`sphx_glr_generated_gallery_general_plot_custom_aggregation.py`. * An example of reprojecting data from 2D auxiliary spatial coordinates - (such as that from the ORCA grid) has been added. See :ref:`General-orca_projection`. + (such as that from the ORCA grid) has been added. See :ref:`sphx_glr_generated_gallery_general_plot_orca_projection.py`. * A clarification of the behaviour of :func:`iris.analysis.calculus.differentiate`. -* A new :doc:`"whitepapers" ` section has been added to the documentation along +* A new :doc:`"Technical Papers" ` section has been added to the documentation along with the addition of a paper providing an :doc:`overview of the load process for UM-like - fileformats (e.g. PP and Fieldsfile) `. - + fileformats (e.g. PP and Fieldsfile) `. diff --git a/docs/iris/src/whatsnew/1.8.rst b/docs/iris/src/whatsnew/1.8.rst index c763411ed8..54763a194b 100644 --- a/docs/iris/src/whatsnew/1.8.rst +++ b/docs/iris/src/whatsnew/1.8.rst @@ -169,7 +169,7 @@ Deprecations "iris.experimental.regrid.regrid_bilinear_rectilinear_src_and_grid" has been removed, as :class:`iris.analysis.Linear` now includes this functionality. -Documentation Changes +Documentation changes ===================== * A chapter on :doc:`merge and concatenate ` has been added to the :doc:`user guide `. diff --git a/docs/iris/src/whatsnew/1.9.rst b/docs/iris/src/whatsnew/1.9.rst index 7a4848b434..7fda661ebc 100644 --- a/docs/iris/src/whatsnew/1.9.rst +++ b/docs/iris/src/whatsnew/1.9.rst @@ -1,4 +1,4 @@ -What's New in Iris 1.9 +What's new in Iris 1.9 ********************** :Release: 1.9.2 @@ -7,7 +7,7 @@ What's New in Iris 1.9 This document explains the new/changed features of Iris in version 1.9 (:doc:`View all changes `.) -Iris 1.9 Features +Iris 1.9 features ================= * Support for running on Python 3.4 has been added to the whole code base. Some features which depend on external libraries will not be available until they also support Python 3, namely: @@ -66,7 +66,7 @@ Iris 1.9 Features * The :meth:`iris.experimental.um.Field.get_data` method can now be used to read Fieldsfile data after the original :class:`iris.experimental.um.FieldsFileVariant` has been closed. -Bugs Fixed +Bugs fixed ========== * Fixed a bug in :meth:`iris.unit.Unit.convert` (and the equivalent in `cf_units `_) @@ -109,7 +109,7 @@ Version 1.9.2 * Fixed a bug avoiding sorting classes directly when :meth:`iris.cube.Cube.coord_system` is used in Python3. * Fixed a bug regarding unsuccessful dot import. -Incompatible Changes +Incompatible changes ==================== * GRIB message/file reading and writing may not be available for Python 3 due to GRIB API limitations. @@ -121,7 +121,7 @@ Deprecations but it is *not* set. * Deprecated :class:`iris.aux_factory.LazyArray` -Documentation Changes +Documentation changes ===================== * A chapter on :doc:`saving iris cubes ` has been added to the :doc:`user guide `. diff --git a/docs/iris/src/whatsnew/2.0.rst b/docs/iris/src/whatsnew/2.0.rst index 43d60a8539..61568d3a8e 100644 --- a/docs/iris/src/whatsnew/2.0.rst +++ b/docs/iris/src/whatsnew/2.0.rst @@ -1,4 +1,4 @@ -What's New in Iris 2.0.0 +What's new in Iris 2.0.0 ************************ :Release: 2.0.0rc1 @@ -9,7 +9,7 @@ This document explains the new/changed features of Iris in version 2.0.0 (:doc:`View all changes `). -Iris 2.0.0 Features +Iris 2.0.0 features =================== .. _showcase: @@ -114,7 +114,7 @@ all existing toggles in :attr:`iris.FUTURE` now default to :data:`True`. off is now deprecated. -Bugs Fixed +Bugs fixed ========== * Indexing or slicing an :class:`~iris.coords.AuxCoord` coordinate will return a coordinate with @@ -289,7 +289,7 @@ been removed. In particular: removed from the :class:`iris.fileformats.rules.Loader` constructor. -Documentation Changes +Documentation changes ===================== * A new UserGuide chapter on :doc:`Real and Lazy Data diff --git a/docs/iris/src/whatsnew/2.1.rst b/docs/iris/src/whatsnew/2.1.rst index 00f7115431..a82d3b8470 100644 --- a/docs/iris/src/whatsnew/2.1.rst +++ b/docs/iris/src/whatsnew/2.1.rst @@ -1,4 +1,4 @@ -What's New in Iris 2.1 +What's new in Iris 2.1 ********************** :Release: 2.1 @@ -8,7 +8,7 @@ This document explains the new/changed features of Iris in version 2.1 (:doc:`older "What's New" release notes can be found here`.) -Iris 2.1 Dependency updates +Iris 2.1 dependency updates =========================== * The `cf_units `_ dependency @@ -30,7 +30,7 @@ Iris 2.1 Dependency updates Full requirements can be seen in the `requirements `_ directory of the Iris' the source. -Iris 2.1 Features +Iris 2.1 features ================= * Added ``repr_html`` functionality to the :class:`~iris.cube.Cube` to provide @@ -60,7 +60,7 @@ Iris 2.1 Features * The :class:`~iris.coord_systems.Mercator` projection has been updated to accept the ``standard_parallel`` keyword argument (:pull:`3041`). -Bugs Fixed +Bugs fixed ========== * All var names being written to NetCDF are now CF compliant. @@ -73,7 +73,7 @@ Bugs Fixed * :mod:`iris.quickplot` labels now honour the axes being drawn to when using the ``axes`` keyword (:pull:`3010`). -Incompatible Changes +Incompatible changes ==================== * The deprecated :mod:`iris.experimental.um` was removed. Please use consider using `mule `_ diff --git a/docs/iris/src/whatsnew/2.2.rst b/docs/iris/src/whatsnew/2.2.rst index 1eff99ecb4..75be5460b3 100644 --- a/docs/iris/src/whatsnew/2.2.rst +++ b/docs/iris/src/whatsnew/2.2.rst @@ -1,4 +1,4 @@ -What's New in Iris 2.2 +What's new in Iris 2.2 ************************ :Release: 2.2.0 @@ -10,7 +10,7 @@ of version 2.2 (:doc:`View all changes `). -Iris 2.2 Features +Iris 2.2 features =================== .. _showcase: @@ -70,7 +70,7 @@ Iris 2.2 Features a NaN-tolerant array comparison. -Iris 2.2 Dependency updates +Iris 2.2 dependency updates ============================= * Iris is now using the latest version release of dask (currently 0.19.3) @@ -82,7 +82,7 @@ Iris 2.2 Dependency updates its changes in all SciTools libraries. -Bugs Fixed +Bugs fixed ========== * The bug has been fixed that prevented printing time coordinates with bounds @@ -109,7 +109,7 @@ Bugs fixed in v2.2.1 -Documentation Changes +Documentation changes ===================== * Iris' `INSTALL` document has been updated to include guidance for running diff --git a/docs/iris/src/whatsnew/2.3.rst b/docs/iris/src/whatsnew/2.3.rst index 872fb44cd6..6fb7088339 100644 --- a/docs/iris/src/whatsnew/2.3.rst +++ b/docs/iris/src/whatsnew/2.3.rst @@ -1,4 +1,4 @@ -What's New in Iris 2.3.0 +What's new in Iris 2.3.0 ************************ :Release: 2.3.0 @@ -7,7 +7,7 @@ What's New in Iris 2.3.0 This document explains the new/changed features of Iris in version 2.3.0 (:doc:`View all changes `.) -Iris 2.3.0 Features +Iris 2.3.0 features =================== .. _showcase: @@ -103,12 +103,12 @@ Iris 2.3.0 Features relaxed tolerance : This means that some cubes may now test 'equal' that previously did not. - Previously, Iris compared cube data arrays using: - ``abs(a - b) < 1.e-8`` + Previously, Iris compared cube data arrays using + ``abs(a - b) < 1.e-8`` We now apply the default operation of :func:`numpy.allclose` instead, - which is equivalent to: - ``abs(a - b) < (1.e-8 + 1.e-5 * b)`` + which is equivalent to + ``abs(a - b) < (1.e-8 + 1.e-5 * b)`` * Added support to render HTML for :class:`~iris.cube.CubeList` in Jupyter Notebooks and JupyterLab. @@ -135,7 +135,7 @@ Iris 2.3.0 Features `metarelate/metOcean commit 448f2ef, 2019-11-29 `_ -Iris 2.3.0 Dependency Updates +Iris 2.3.0 dependency updates ============================= * Iris now supports Proj4 up to version 5, but not yet 6 or beyond, pending `fixes to some cartopy tests `_; had been erroneously using Geostationary. -* :class:`~iris.coords.CellMethod` will now only use valid `NetCDF name tokens `_ to reference the coordinates involved in the statistical operation. -* The following var_name properties will now only allow valid `NetCDF name - tokens - `_ to - reference the said NetCDF variable name. Note that names with a leading +* :class:`~iris.coords.CellMethod` will now only use valid `NetCDF name tokens`_ to reference the coordinates involved in the statistical operation. +* The following var_name properties will now only allow valid + `NetCDF name tokens`_ + to reference the said NetCDF variable name. Note that names with a leading underscore are not permitted. - - :attr:`iris.aux_factory.AuxCoordFactory.var_name` - - :attr:`iris.coords.CellMeasure.var_name` - - :attr:`iris.coords.Coord.var_name` - - :attr:`iris.coords.AuxCoord.var_name` - - :attr:`iris.cube.Cube.var_name` + +.. _NetCDF name tokens: https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/netcdf_data_set_components.html#object_name + + * :attr:`iris.aux_factory.AuxCoordFactory.var_name` + * :attr:`iris.coords.CellMeasure.var_name` + * :attr:`iris.coords.Coord.var_name` + * :attr:`iris.coords.AuxCoord.var_name` + * :attr:`iris.cube.Cube.var_name` + * Rendering a cube in Jupyter will no longer crash for a cube with attributes containing ``\n``. * NetCDF variables which reference themselves in their ``cell_measures`` @@ -199,12 +201,12 @@ Bugs Fixed the original attached AuxCoords. -Documentation Changes +Documentation changes ===================== * Adopted a `new colour logo for Iris <../_static/Iris7_1_trim_full.png>`_ -* Added a gallery example showing `how to concatenate NEMO ocean model data - <../examples/Oceanography/load_nemo.html>`_. +* Added a gallery example showing how to concatenate NEMO ocean model data, + see :ref:`sphx_glr_generated_gallery_oceanography_plot_load_nemo.py`. * Added an example in the `Loading Iris Cubes: Constraining on Time <../userguide/loading_iris_cubes .html#constraining-on-time>`_ diff --git a/docs/iris/src/whatsnew/2.4.rst b/docs/iris/src/whatsnew/2.4.rst index 2facb97a7a..776cc8aa69 100644 --- a/docs/iris/src/whatsnew/2.4.rst +++ b/docs/iris/src/whatsnew/2.4.rst @@ -1,4 +1,4 @@ -What's New in Iris 2.4.0 +What's new in Iris 2.4.0 ************************ :Release: 2.4.0 @@ -8,7 +8,7 @@ This document explains the new/changed features of Iris in version 2.4.0 (:doc:`View all changes `.) -Iris 2.4.0 Features +Iris 2.4.0 features =================== .. admonition:: Last python 2 version of Iris @@ -44,12 +44,12 @@ Iris 2.4.0 Features from the attributes dictionary of a :class:`~iris.cube.Cube`. -Iris 2.4.0 Dependency Updates +Iris 2.4.0 dependency updates ============================= * Iris is now able to use the latest version of matplotlib. -Bugs Fixed +Bugs fixed ========== * Fixed a problem which was causing file loads to fetch *all* field data whenever UM files (PP or Fieldsfiles) were loaded. diff --git a/docs/iris/src/whatsnew/aggregate_directory.py b/docs/iris/src/whatsnew/aggregate_directory.py index c7b497307f..6fe92f6764 100644 --- a/docs/iris/src/whatsnew/aggregate_directory.py +++ b/docs/iris/src/whatsnew/aggregate_directory.py @@ -42,7 +42,7 @@ SOFTWARE_NAME = "Iris" EXTENSION = ".rst" VALID_CATEGORIES = [ - {"Prefix": "newfeature", "Title": "Features"}, + {"Prefix": "newfeature", "Title": "features"}, {"Prefix": "bugfix", "Title": "Bugs Fixed"}, {"Prefix": "incompatiblechange", "Title": "Incompatible Changes"}, {"Prefix": "deprecate", "Title": "Deprecations"}, @@ -165,7 +165,7 @@ def generate_header(release, unreleased=False): else: isodatestamp = datetime.date.today().strftime("%Y-%m-%d") header_text = [] - title_template = "What's New in {} {!s}\n" + title_template = "What's new in {} {!s}\n" title_line = title_template.format(SOFTWARE_NAME, release) title_underline = ("*" * (len(title_line) - 1)) + "\n" header_text.append(title_line) diff --git a/docs/iris/src/whatsnew/contributions_3.0.0/docchange_2020-Jul-10_modernise_documentation_using_themes_and_readthedocs.txt b/docs/iris/src/whatsnew/contributions_3.0.0/docchange_2020-Jul-10_modernise_documentation_using_themes_and_readthedocs.txt new file mode 100644 index 0000000000..5ff8c001e8 --- /dev/null +++ b/docs/iris/src/whatsnew/contributions_3.0.0/docchange_2020-Jul-10_modernise_documentation_using_themes_and_readthedocs.txt @@ -0,0 +1,2 @@ +* Updated documentation to use a modern sphinx theme and be served from + https://scitools-iris.readthedocs.io/en/latest/. diff --git a/docs/iris/src/whatsnew/contributions_3.0.0/newfeature_2020-Jan-31_nimrod_format_enhancement.txt b/docs/iris/src/whatsnew/contributions_3.0.0/newfeature_2020-Jan-31_nimrod_format_enhancement.txt index 454fc3617f..18378691cb 100644 --- a/docs/iris/src/whatsnew/contributions_3.0.0/newfeature_2020-Jan-31_nimrod_format_enhancement.txt +++ b/docs/iris/src/whatsnew/contributions_3.0.0/newfeature_2020-Jan-31_nimrod_format_enhancement.txt @@ -1,3 +1,3 @@ * The :class:`~iris.fileformats.nimrod` provides richer meta-data translation -when loading Nimrod-format data into cubes. This covers most known operational -use-cases. + when loading Nimrod-format data into cubes. This covers most known operational + use-cases. diff --git a/docs/iris/src/whatsnew/index.rst b/docs/iris/src/whatsnew/index.rst index 03834a43a7..00b925a48e 100644 --- a/docs/iris/src/whatsnew/index.rst +++ b/docs/iris/src/whatsnew/index.rst @@ -7,10 +7,10 @@ These "What's new" pages describe the important changes between major Iris versions. .. toctree:: - :maxdepth: 2 + :maxdepth: 1 latest.rst - 3.0.rst + 3.0.0.rst 2.4.rst 2.3.rst 2.2.rst diff --git a/lib/iris/_constraints.py b/lib/iris/_constraints.py index 37daeec4aa..4746425bb3 100644 --- a/lib/iris/_constraints.py +++ b/lib/iris/_constraints.py @@ -515,6 +515,7 @@ def __init__( match. Kwargs: + * standard_name: A string or callable representing the standard name to match against. @@ -534,6 +535,7 @@ def __init__( where the standard_name is not set, then use standard_name=None. Returns: + * Boolean Example usage:: @@ -544,8 +546,8 @@ def __init__( iris.NameConstraint(standard_name='air_temperature', STASH=lambda stash: stash.item == 203) - """ + self.standard_name = standard_name self.long_name = long_name self.var_name = var_name diff --git a/lib/iris/analysis/__init__.py b/lib/iris/analysis/__init__.py index 5b7dff813d..0d4d3bfdab 100644 --- a/lib/iris/analysis/__init__.py +++ b/lib/iris/analysis/__init__.py @@ -27,11 +27,11 @@ The gallery contains several interesting worked examples of how an :class:`~iris.analysis.Aggregator` may be used, including: - * :ref:`Meteorology-COP_1d_plot` - * :ref:`General-SOI_filtering` - * :ref:`Meteorology-hovmoller` - * :ref:`Meteorology-lagged_ensemble` - * :ref:`General-custom_aggregation` + * :ref:`sphx_glr_generated_gallery_meteorology_plot_COP_1d.py` + * :ref:`sphx_glr_generated_gallery_general_plot_SOI_filtering.py` + * :ref:`sphx_glr_generated_gallery_meteorology_plot_hovmoller.py` + * :ref:`sphx_glr_generated_gallery_meteorology_plot_lagged_ensemble.py` + * :ref:`sphx_glr_generated_gallery_general_plot_custom_aggregation.py` """ @@ -487,7 +487,8 @@ def __init__( A variety of ready-made aggregators are provided in this module, such as :data:`~iris.analysis.MEAN` and :data:`~iris.analysis.MAX`. Custom aggregators can also be created for special purposes, see - :ref:`General-custom_aggregation` for a worked example. + :ref:`sphx_glr_generated_gallery_general_plot_custom_aggregation.py` + for a worked example. """ #: Cube cell method string. diff --git a/lib/iris/analysis/stats.py b/lib/iris/analysis/stats.py index ba3ed2504c..bb283a0e89 100644 --- a/lib/iris/analysis/stats.py +++ b/lib/iris/analysis/stats.py @@ -64,7 +64,7 @@ def pearsonr( correlation at each time/altitude point. Reference: - http://www.statsoft.com/textbook/glosp.html#Pearson%20Correlation + https://en.wikipedia.org/wiki/Pearson_correlation_coefficient This operation is non-lazy. diff --git a/lib/iris/cube.py b/lib/iris/cube.py index 03e942c6c9..964e56c313 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -1200,6 +1200,7 @@ def add_ancillary_variable(self, ancillary_variable, data_dims=None): the cube Kwargs: + * data_dims Integer or iterable of integers giving the data dimensions spanned by the ancillary variable. @@ -1207,6 +1208,7 @@ def add_ancillary_variable(self, ancillary_variable, data_dims=None): Raises a ValueError if an ancillary variable with identical metadata already exists on the cube. """ + if self.ancillary_variables(ancillary_variable): raise ValueError("Duplicate ancillary variables not permitted") diff --git a/lib/iris/experimental/stratify.py b/lib/iris/experimental/stratify.py index 2992360247..e357f2ca9d 100644 --- a/lib/iris/experimental/stratify.py +++ b/lib/iris/experimental/stratify.py @@ -68,8 +68,8 @@ def relevel(cube, src_levels, tgt_levels, axis=None, interpolator=None): that are generally monotonic in the direction of interpolation, such as height/pressure or salinity/depth. - Parameters - ---------- + Args: + cube : :class:`~iris.cube.Cube` The phenomenon data to be re-levelled. diff --git a/lib/iris/fileformats/cf.py b/lib/iris/fileformats/cf.py index 1db4e6c61e..75f328a80e 100644 --- a/lib/iris/fileformats/cf.py +++ b/lib/iris/fileformats/cf.py @@ -10,7 +10,7 @@ References: [CF] NetCDF Climate and Forecast (CF) Metadata conventions, Version 1.5, October, 2010. -[NUG] NetCDF User's Guide, http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html +[NUG] NetCDF User's Guide, https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/ """ diff --git a/lib/iris/fileformats/netcdf.py b/lib/iris/fileformats/netcdf.py index 4d7ddedc61..867b0c9faf 100644 --- a/lib/iris/fileformats/netcdf.py +++ b/lib/iris/fileformats/netcdf.py @@ -959,7 +959,7 @@ def write( than global attributes. * unlimited_dimensions (iterable of strings and/or - :class:`iris.coords.Coord` objects): + :class:`iris.coords.Coord` objects): List of coordinate names (or coordinate objects) corresponding to coordinate dimensions of `cube` to save with the NetCDF dimension variable length 'UNLIMITED'. By default, no @@ -992,10 +992,10 @@ def write( Used to manually specify the HDF5 chunksizes for each dimension of the variable. A detailed discussion of HDF chunking and I/O performance is available here: - http://www.hdfgroup.org/HDF5/doc/H5.user/Chunking.html. Basically, - you want the chunk size for each dimension to match as closely as - possible the size of the data block that users will read from the - file. `chunksizes` cannot be set if `contiguous=True`. + https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/netcdf_perf_chunking.html. + Basically, you want the chunk size for each dimension to match + as closely as possible the size of the data block that users will + read from the file. `chunksizes` cannot be set if `contiguous=True`. * endian (string): Used to control whether the data is stored in little or big endian @@ -2506,7 +2506,7 @@ def save( than global attributes. * unlimited_dimensions (iterable of strings and/or - :class:`iris.coords.Coord` objects): + :class:`iris.coords.Coord` objects): List of coordinate names (or coordinate objects) corresponding to coordinate dimensions of `cube` to save with the NetCDF dimension variable length 'UNLIMITED'. By default, no unlimited dimensions are @@ -2538,7 +2538,7 @@ def save( * chunksizes (tuple of int): Used to manually specify the HDF5 chunksizes for each dimension of the variable. A detailed discussion of HDF chunking and I/O performance is - available here: http://www.hdfgroup.org/HDF5/doc/H5.user/Chunking.html. + available here: https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/netcdf_perf_chunking.html. Basically, you want the chunk size for each dimension to match as closely as possible the size of the data block that users will read from the file. `chunksizes` cannot be set if `contiguous=True`. diff --git a/lib/iris/tests/__init__.py b/lib/iris/tests/__init__.py index 8602defa16..9132e16680 100644 --- a/lib/iris/tests/__init__.py +++ b/lib/iris/tests/__init__.py @@ -792,7 +792,7 @@ def _unique_id(self): bits[0] = os.path.splitext(file_name)[0] folder, location = os.path.split(path) bits = [location] + bits - while location not in ["iris", "example_tests"]: + while location not in ["iris", "gallery_tests"]: folder, location = os.path.split(folder) bits = [location] + bits test_id = ".".join(bits) diff --git a/lib/iris/tests/results/imagerepo.json b/lib/iris/tests/results/imagerepo.json index e6a225f022..a353507d12 100644 --- a/lib/iris/tests/results/imagerepo.json +++ b/lib/iris/tests/results/imagerepo.json @@ -1,129 +1,129 @@ { - "example_tests.test_COP_1d_plot.TestCOP1DPlot.test_COP_1d_plot.0": [ + "gallery_tests.test_plot_COP_1d.TestCOP1DPlot.test_plot_COP_1d.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/baff589936602d8ec977334ae4dac9b61a6dc4d99532c86cc2913e36c4cc0f61.png", "https://scitools.github.io/test-iris-imagehash/images/v4/aefec91c3601249cc9b3336dc4c8cdb31a64c6d997b3c0eccb5932d285e42f33.png" ], - "example_tests.test_COP_maps.TestCOPMaps.test_cop_maps.0": [ + "gallery_tests.test_plot_COP_maps.TestCOPMaps.test_plot_cop_maps.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ea9138db95668524913e6ac168997e85957e917e876396b96a81b5ce3c496935.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ea9130db95668524913c6ac178995b0d956e917ec76396b96a853dcf94696935.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ea9130db95668524913e6ac168991f0d956e917ec76396b96a853dcf94796931.png" ], - "example_tests.test_SOI_filtering.TestSOIFiltering.test_soi_filtering.0": [ + "gallery_tests.test_plot_SOI_filtering.TestSOIFiltering.test_plot_soi_filtering.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fac460b9c17b78723e05a5a9954edaf062332799954e9ca5c63b9a52d24e5a95.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa8460b9c17b78723e05a5a9954edaf062333799954e9ca5c63b9a52d24e4a9d.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa167295c5e0696a3c17a58c9568da536233da19994cdab487739b4b9b444eb5.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa56f295c5e0694a3c17a58d95e8da536233da99984c5af4c6739b4a9a444eb4.png" ], - "example_tests.test_TEC.TestTEC.test_TEC.0": [ + "gallery_tests.test_plot_TEC.TestTEC.test_plot_TEC.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/e1a561b69b1a9a42846e9a49c7596e3cce6c907b3a83c17e1b8239b3e4f33bc4.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e1a561b69b1a9e43846e9a49c7596e2cce6c907b3a83c16e1b9231b3e4f33b8c.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e5a761b69a589a4bc46f9e48c65c6631ce61d1ce3982c13739b33193c0ee3f8c.png" ], - "example_tests.test_anomaly_log_colouring.TestAnomalyLogColouring.test_anomaly_log_colouring.0": [ + "gallery_tests.test_plot_anomaly_log_colouring.TestAnomalyLogColouring.test_plot_anomaly_log_colouring.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ec4464e185a39f93931e9b1e91696d2949dde6e63e26a47a5ad391938d9a5a0c.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ecc164e78e979b19b3789b0885a564a56cc2c65e3ec69469db1bdb9a853c1e24.png" ], - "example_tests.test_atlantic_profiles.TestAtlanticProfiles.test_atlantic_profiles.0": [ + "gallery_tests.test_plot_atlantic_profiles.TestAtlanticProfiles.test_plot_atlantic_profiles.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/9f8260536bd28e1320739437b5f437b0a51d66f4cc5d08fcd00fdb1c93fcb21c.png", "https://scitools.github.io/test-iris-imagehash/images/v4/9f8260536bd28e1320739437b5f437b0a51d66f4cc7c09f4d00fdb1c93fcb21c.png", "https://scitools.github.io/test-iris-imagehash/images/v4/9f8a60536bd28e1320739437b5f437b0a53d66f4cc5c08f4d00fdb1c93fcb21c.png", "https://scitools.github.io/test-iris-imagehash/images/v4/9fc060f462a08f07203ebc77a1f36707e61f4e38d8f7d08a910197fc877cec58.png", "https://scitools.github.io/test-iris-imagehash/images/v4/97c160f462a88f07203ebc77a1e36707e61f4e38d8f3d08a910597fc877cec58.png" ], - "example_tests.test_atlantic_profiles.TestAtlanticProfiles.test_atlantic_profiles.1": [ + "gallery_tests.test_plot_atlantic_profiles.TestAtlanticProfiles.test_plot_atlantic_profiles.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/a6eaa57e6e81ddf999311ba3b3775e20845d5889c199673b4e22a4675e8ca11c.png", "https://scitools.github.io/test-iris-imagehash/images/v4/eeea64dd6ea8cd99991f1322b3761e06845718d89995b3131f32a4765ec2a1cd.png", "https://scitools.github.io/test-iris-imagehash/images/v4/eeea64dd6ea8cd99991d1322b3741e2684571cd89995b3131f32a4765ee2a1cc.png" ], - "example_tests.test_coriolis_plot.TestCoriolisPlot.test_coriolis_plot.0": [ + "gallery_tests.test_plot_coriolis.TestCoriolisPlot.test_plot_coriolis.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/e78665de9a699659e55e9965886979966986c5e63e98c19e3a256679e1981a24.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e68665de9a699659c1fe99a5896965966996c46e3e19c1da3a652669c51e1a26.png" ], - "example_tests.test_cross_section.TestCrossSection.test_cross_section.0": [ + "gallery_tests.test_plot_cross_section.TestCrossSection.test_plot_cross_section.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ea95317b9562e4d1649f5a05856e4ca4da52947e4ea5f13f1b499d42f13b1b41.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ea91b17b9562e4d1609f5a05856e4ca45a52957e5ea5f13b1bca9dc0b17b1ac1.png" ], - "example_tests.test_cross_section.TestCrossSection.test_cross_section.1": [ + "gallery_tests.test_plot_cross_section.TestCrossSection.test_plot_cross_section.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ea9521fb956a394069921e93f07f4aad856cc47e4e95857a1ea5da3591ba1b81.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ea9521fb956a394068931e9be07e4aa5856cc47e4a91957a1ba55bb5b17a3b81.png" ], - "example_tests.test_custom_aggregation.TestCustomAggregation.test_custom_aggregation.0": [ + "gallery_tests.test_plot_custom_aggregation.TestCustomAggregation.test_plot_custom_aggregation.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fe816e81917e907eb43e873f85677ac190f0703c6a95811f1ac33ce1a57a6f18.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fe816e81817e907eb43e873f85637ac198d8703c6a94811f1ac73ee1a57a6f90.png" ], - "example_tests.test_custom_file_loading.TestCustomFileLoading.test_custom_file_loading.0": [ + "gallery_tests.test_plot_custom_file_loading.TestCustomFileLoading.test_plot_custom_file_loading.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/faa0cbf1845e34be913787416edcc8bc3bc81f9b63332662a4ed30cdc1b2cd21.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fba0cbf1845e34be912787416edcc8bc3b881f9b62332762a5ad32cdc1b2cd21.png", "https://scitools.github.io/test-iris-imagehash/images/v4/faa1cb47845e34bc912797436cccc8343f11359b73523746c48c72d9d9b34da5.png" ], - "example_tests.test_deriving_phenomena.TestDerivingPhenomena.test_deriving_phenomena.0": [ + "gallery_tests.test_plot_deriving_phenomena.TestDerivingPhenomena.test_plot_deriving_phenomena.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/b9993986866952e6c9464639c4766bd9c669916e7b99c1663f99768990763e81.png", "https://scitools.github.io/test-iris-imagehash/images/v4/b99139de866952e6c946c639c47e6bd18769d16e7a9981662e813699d0763e89.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ec97681793689768943c97e8926669d186e8c33f6c99c32e6b936c83d33e2c98.png" ], - "example_tests.test_global_map.TestGlobalMap.test_global_map.0": [ + "gallery_tests.test_plot_global_map.TestGlobalMap.test_plot_global_map.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fa9979468566857ef07e3e8978566b91cb0179883c89946686a96b9d83766f81.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa997b958466846ed13e87467a997a898d66d17e2cc9906684696f99d3162f81.png" ], - "example_tests.test_hovmoller.TestGlobalMap.test_hovmoller.0": [ + "gallery_tests.test_plot_hovmoller.TestGlobalMap.test_plot_hovmoller.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/bab430b4ce4bce43c5becf89c54b1a63c543c56e1e64907e3bb469b490de1ac1.png", "https://scitools.github.io/test-iris-imagehash/images/v4/eeb46cb4934b934bc07e974bc14b38949943c0fe3e94c17f6ea46cb4c07b3f00.png" ], - "example_tests.test_inset_plot.TestInsetPlot.test_inset_plot.0": [ + "gallery_tests.test_plot_inset.TestInsetPlot.test_plot_inset.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ebff6992f50096a5b245dac4f6559496b49248dbc95dcb699529912dcf244a54.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e9ff6992b50096a5b245dac4f64594b6b49248dbc95dcb699529952dcf244a56.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ebff6992b50096ad9267dac4d64094b294924cdbc95d4b699d29952dcda46e94.png" ], - "example_tests.test_lagged_ensemble.TestLaggedEnsemble.test_lagged_ensemble.0": [ + "gallery_tests.test_plot_lagged_ensemble.TestLaggedEnsemble.test_plot_lagged_ensemble.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/bbbb31e1c44e64e4b0459b5bb1716ecac464f496ce34618eb1079b39b193ce25.png", "https://scitools.github.io/test-iris-imagehash/images/v4/bbbb31b1c44e64e4b1579b5b917133cecc61f146c414668eb1119b1bb197ce34.png" ], - "example_tests.test_lagged_ensemble.TestLaggedEnsemble.test_lagged_ensemble.1": [ + "gallery_tests.test_plot_lagged_ensemble.TestLaggedEnsemble.test_plot_lagged_ensemble.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/abfef958fd462c993a07d87960464b81d1009687c139d3b594e9cf87c6b89687.png", "https://scitools.github.io/test-iris-imagehash/images/v4/aafec5e9e5e03e099a07e0f86542db879438261ec3b13ce78d8dc65a92d83d89.png" ], - "example_tests.test_lineplot_with_legend.TestLineplotWithLegend.test_lineplot_with_legend.0": [ + "gallery_tests.test_plot_lineplot_with_legend.TestLineplotWithLegend.test_plot_lineplot_with_legend.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/eae942526540b869961f8da694589da69543cc9af1014afbc3fd596b84fe19a7.png", "https://scitools.github.io/test-iris-imagehash/images/v4/eae942146540b869961f8de694589da69543cc9af1014afbc3fd596b84fe19a7.png", "https://scitools.github.io/test-iris-imagehash/images/v4/eafd9e12a5a061e9925ec716de489e9685078ec981b229e70ddb79219cc3768d.png" ], - "example_tests.test_load_nemo.TestLoadNemo.test_load_nemo.0": [ + "gallery_tests.test_plot_load_nemo.TestLoadNemo.test_plot_load_nemo.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/a3ff34e87f0049496d17c4d9c04fc225d256971392d39f1696df0f16cec00f36.png" ], - "example_tests.test_orca_projection.TestOrcaProjection.test_orca_projection.0": [ + "gallery_tests.test_plot_orca_projection.TestOrcaProjection.test_plot_orca_projection.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fb11731a94cea4ee64b35e91d1d2304e9e5ac7397b20e1fe12852487e666ce46.png", "https://scitools.github.io/test-iris-imagehash/images/v4/bb11721a87cce5e4cce79e81d19b3b5e1e1cd3783168e07835853485e65e2e1e.png" ], - "example_tests.test_orca_projection.TestOrcaProjection.test_orca_projection.1": [ + "gallery_tests.test_plot_orca_projection.TestOrcaProjection.test_plot_orca_projection.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/e5a665a69a599659e5db1865c2653b869996cce63e99e19a1a912639e7181e65.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e58661969e799659c1f719a6c867359a1996c0773649c09c3e612679c07b3f66.png" ], - "example_tests.test_orca_projection.TestOrcaProjection.test_orca_projection.2": [ + "gallery_tests.test_plot_orca_projection.TestOrcaProjection.test_plot_orca_projection.2": [ "https://scitools.github.io/test-iris-imagehash/images/v4/f2c464ce9e399332e1b74ce1cc79338c6586e5b33b31b37a66c9664cc06e1a64.png", "https://scitools.github.io/test-iris-imagehash/images/v4/a58660ce9e739b31c93d1cc9c8df33863383e33b3f11c03f2664366cc8ee3cc1.png" ], - "example_tests.test_orca_projection.TestOrcaProjection.test_orca_projection.3": [ + "gallery_tests.test_plot_orca_projection.TestOrcaProjection.test_plot_orca_projection.3": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fa817a83846ea46ce539c93391de32cc86cf87a33fa168721cdb3e896e374b04.png", "https://scitools.github.io/test-iris-imagehash/images/v4/be817a87845ea56cec79817a919e338436a5c1e73fa16c736c4a3e816a1e6b1c.png" ], - "example_tests.test_polar_stereo.TestPolarStereo.test_polar_stereo.0": [ + "gallery_tests.test_plot_polar_stereo.TestPolarStereo.test_plot_polar_stereo.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/e168317a92d36d89c5bb9e94c55e6f0c9a93c15a6ec584763b21716791de3a81.png", "https://scitools.github.io/test-iris-imagehash/images/v4/b9e16079971e9e93c8ce0f84c31e3b929f92c0ff3ca1c17e39e03961c07e3f80.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ba1e615ec7e097a9961f9cb190f838e091c2c1e73f07c11f6f386b3cc1783e11.png" ], - "example_tests.test_polynomial_fit.TestPolynomialFit.test_polynomial_fit.0": [ + "gallery_tests.test_plot_polynomial_fit.TestPolynomialFit.test_plot_polynomial_fit.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/abff4a9df26435886520c97f12414695c4b69d23934bc86adc969237d68ccc6f.png", "https://scitools.github.io/test-iris-imagehash/images/v4/aaff4a9df26435886520c97f12414695c4b69d23934bc86adc969a17d69ccc6f.png", "https://scitools.github.io/test-iris-imagehash/images/v4/aeffcb34d244348be5a2c96c3a4fc6d0c4b69f2d87294ccb9f1a125684cd7c11.png" ], - "example_tests.test_projections_and_annotations.TestProjectionsAndAnnotations.test_projections_and_annotations.0": [ + "gallery_tests.test_plot_projections_and_annotations.TestProjectionsAndAnnotations.test_plot_projections_and_annotations.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fa854f19851a30e4cc76cd0bb179325ca7c665b0c938cb4b4e719e9cb727b5c0.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fac54f19851a30e4cc76cd0bb179325cb78665b0c938cb4b4e719e9c9727b5c0.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa854e19851a30e4cc76cd0bb179325cb7c664b0c938cb4bce739e9c37a3b5c0.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa854e19851a30e4cc76cd0bb179325cb78665b1c938c94bce739e9c3727b5c0.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa854f19851a30e4cc76cd0bb0f932dca7c665b1c92ccb4b4ed19e9c3721b5c8.png" ], - "example_tests.test_projections_and_annotations.TestProjectionsAndAnnotations.test_projections_and_annotations.1": [ + "gallery_tests.test_plot_projections_and_annotations.TestProjectionsAndAnnotations.test_plot_projections_and_annotations.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/e385699d9c3896627243318fcdad5a7dc6dba492e9b69964936dc21974b18592.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e385699d9c3896727243318f8dad5a7dc65ba492b93699649b6dc25b64938592.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e385699d9c3896627243318fcdad5a7dc6dba492b93699649b6dc25964938592.png", @@ -131,29 +131,29 @@ "https://scitools.github.io/test-iris-imagehash/images/v4/e3856b999c3896727243318f8dad5a75865ba492e9b69964db6cc65b74918592.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e3856d999c389662734731afcdad5a7384daa592b1b69b64d26dc29974b18590.png" ], - "example_tests.test_rotated_pole_mapping.TestRotatedPoleMapping.test_rotated_pole_mapping.0": [ + "gallery_tests.test_plot_rotated_pole_mapping.TestRotatedPoleMapping.test_plot_rotated_pole_mapping.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fa15615e97a193adc15e1e81c4fa3eb49d30817e3e05c17e7ba59927817e1e01.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ee46607e97a19781c0df1f81d0bb3e241f20c16f3fc0c1fe39263d33d06f3e80.png" ], - "example_tests.test_rotated_pole_mapping.TestRotatedPoleMapping.test_rotated_pole_mapping.1": [ + "gallery_tests.test_plot_rotated_pole_mapping.TestRotatedPoleMapping.test_plot_rotated_pole_mapping.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ba056717c3e099e9b90f8e81c4da589499b696763e45e56b3b893929c17b7e01.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ea57685f95a886a1c0de9da090be3e2697e1c0ff3f00c17e6b266c17c07f3f00.png" ], - "example_tests.test_rotated_pole_mapping.TestRotatedPoleMapping.test_rotated_pole_mapping.2": [ + "gallery_tests.test_plot_rotated_pole_mapping.TestRotatedPoleMapping.test_plot_rotated_pole_mapping.2": [ "https://scitools.github.io/test-iris-imagehash/images/v4/ba1e605ec7a191a1b85e9e81c4da58909996b37e3a65e16f7b817939e57a1e01.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ba1e605ec7a193a1b85e9e81c4da58909996b3763a65e16f7b816939ed7a1e01.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e85a697e97a18681c6da9f8190bf3e263624c1ef3b48c17a2b223c47c0ff3f81.png", "https://scitools.github.io/test-iris-imagehash/images/v4/ea57685f95a886a1c0de9da090be3e2497e1c0ef3f01c17e6b366c17c07b3f01.png" ], - "example_tests.test_rotated_pole_mapping.TestRotatedPoleMapping.test_rotated_pole_mapping.3": [ + "gallery_tests.test_plot_rotated_pole_mapping.TestRotatedPoleMapping.test_plot_rotated_pole_mapping.3": [ "https://scitools.github.io/test-iris-imagehash/images/v4/fa8172d0847ecd2bc913939c36846c714933799cc3cc8727e67639f939996a58.png", "https://scitools.github.io/test-iris-imagehash/images/v4/fa8172c6857ecd38cb3392ce36c564311931d85ec64e9787719a39993c316e66.png" ], - "example_tests.test_wind_speed.TestWindSpeed.test_wind_speed.0": [ + "gallery_tests.test_plot_wind_speed.TestWindSpeed.test_plot_wind_speed.0": [ "https://scitools.github.io/test-iris-imagehash/images/v4/bcf924fb9306930ce12ccf97c73236b28ecec4cd3e29847b18e639e6c14f1a09.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e9e960e996169306c1ee9e96c29e36739e13c07d3d61c07f39a139a1c07f3f01.png" ], - "example_tests.test_wind_speed.TestWindSpeed.test_wind_speed.1": [ + "gallery_tests.test_plot_wind_speed.TestWindSpeed.test_plot_wind_speed.1": [ "https://scitools.github.io/test-iris-imagehash/images/v4/bcf924fb9306930ce12ccf97c73236b28ecec4cc3e29847b38e639e6c14f1a09.png", "https://scitools.github.io/test-iris-imagehash/images/v4/e9e960e996169306c1ee9e86c29e36739e13c07d3d61c07f39a139a1c17f3f01.png" ], diff --git a/lib/iris/tests/runner/_runner.py b/lib/iris/tests/runner/_runner.py index 8175e7b19f..71b6e5fcc6 100644 --- a/lib/iris/tests/runner/_runner.py +++ b/lib/iris/tests/runner/_runner.py @@ -21,7 +21,7 @@ class TestRunner: description = ( "Run tests under nose and multiprocessor for performance. " - "Default behaviour is to run all non-example tests. " + "Default behaviour is to run all non-gallery tests. " "Specifying one or more test flags will run *only* those " "tests." ) @@ -34,7 +34,7 @@ class TestRunner: ), ("stop", "x", "Stop running tests after the first error or failure."), ("system-tests", "s", "Run the limited subset of system tests."), - ("example-tests", "e", "Run the example code tests."), + ("gallery-tests", "e", "Run the gallery code tests."), ("default-tests", "d", "Run the default tests."), ( "coding-tests", @@ -53,7 +53,7 @@ class TestRunner: "no-data", "system-tests", "stop", - "example-tests", + "gallery-tests", "default-tests", "coding-tests", "create-missing", @@ -63,7 +63,7 @@ def initialize_options(self): self.no_data = False self.stop = False self.system_tests = False - self.example_tests = False + self.gallery_tests = False self.default_tests = False self.coding_tests = False self.num_processors = None @@ -87,8 +87,8 @@ def finalize_options(self): tests.append("default") if self.coding_tests: tests.append("coding") - if self.example_tests: - tests.append("example") + if self.gallery_tests: + tests.append("gallery") if not tests: tests.append("default") print("Running test suite(s): {}".format(", ".join(tests))) @@ -114,19 +114,19 @@ def run(self): tests.append("iris.tests") if self.coding_tests: tests.append("iris.tests.test_coding_standards") - if self.example_tests: + if self.gallery_tests: import iris.config default_doc_path = os.path.join(sys.path[0], "docs", "iris") doc_path = iris.config.get_option( "Resources", "doc_dir", default=default_doc_path ) - example_path = os.path.join(doc_path, "example_tests") - if os.path.exists(example_path): - tests.append(example_path) + gallery_path = os.path.join(doc_path, "gallery_tests") + if os.path.exists(gallery_path): + tests.append(gallery_path) else: print( - "WARNING: Example path %s does not exist." % (example_path) + "WARNING: Gallery path %s does not exist." % (gallery_path) ) if not tests: tests.append("iris.tests") diff --git a/lib/iris/tests/test_coding_standards.py b/lib/iris/tests/test_coding_standards.py index cfb54203b3..00ce7b7d44 100644 --- a/lib/iris/tests/test_coding_standards.py +++ b/lib/iris/tests/test_coding_standards.py @@ -104,13 +104,12 @@ def test_license_headers(self): "setup.py", "build/*", "dist/*", - "docs/iris/example_code/*/*.py", + "docs/iris/gallery_code/*/*.py", "docs/iris/src/developers_guide/documenting/*.py", - "docs/iris/src/sphinxext/gen_gallery.py", "docs/iris/src/userguide/plotting_examples/*.py", "docs/iris/src/userguide/regridding_plots/*.py", "docs/iris/src/developers_guide/gitwash_dumper.py", - "docs/iris/build/*", + "docs/iris/src/_build/*", "lib/iris/analysis/_scipy_interpolate.py", "lib/iris/fileformats/_pyke_rules/*", ) diff --git a/requirements/docs.txt b/requirements/docs.txt index 6966869c70..2d2c03f688 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1 +1,4 @@ sphinx +sphinx_rtd_theme +sphinx-copybutton +sphinx-gallery diff --git a/setup.py b/setup.py index e5dd0e7bb9..b078e3de1f 100644 --- a/setup.py +++ b/setup.py @@ -181,7 +181,6 @@ def build_std_names(cmd, directory): xml_path = os.path.join("etc", "cf-standard-name-table.xml") module_path = os.path.join(directory, "iris", "std_names.py") args = (sys.executable, script_path, xml_path, module_path) - cmd.spawn(args) diff --git a/tools/generate_std_names.py b/tools/generate_std_names.py index 3aad3bb09c..95dcce8171 100644 --- a/tools/generate_std_names.py +++ b/tools/generate_std_names.py @@ -35,14 +35,17 @@ This file is automatically generated. Do not edit this file by hand. -The file will be generated during a standard build/installation: +The file will be generated during a standard build/installation:: + python setup.py build python setup.py install -Also, the file can be re-generated in the source distribution via: +Also, the file can be re-generated in the source distribution via:: + python setup.py std_names -Or for more control (e.g. to use an alternative XML file) via: +Or for more control (e.g. to use an alternative XML file) via:: + python tools/generate_std_names.py XML_FILE MODULE_FILE """