...
 
Commits (14)
......@@ -23,6 +23,8 @@ env-run: &env-setup
# a separate environment.
name: Setup conda environment
command: |
# Update conda to fix https://github.com/conda/conda/issues/6811
conda install -n base conda
conda config --set always_yes yes --set changeps1 no --set show_channel_urls yes
conda create -n test-environment python=$PYTHON_VERSION
conda config --add channels conda-forge
......@@ -44,8 +46,9 @@ deps-run: &deps-install
requests \
pyepsg \
owslib \
$EXTRA_PACKAGES
conda install --quiet --file docs/doc-requirements.txt
pykdtree \
$EXTRA_PACKAGES \
--file docs/doc-requirements.txt
conda list
cp-run: &cp-install
......
* Ask usage questions on [StackOverflow](https://stackoverflow.com/questions/tagged/cartopy).
* For less well defined questions, ideas, general discussion or announcements of related projects use the [Google Group](https://groups.google.com/forum/#!forum/scitools-iris).
* Report bugs, suggest features or view the source code on [GitHub](https://github.com/SciTools/cartopy).
......@@ -2,6 +2,8 @@
*.py[co]
build
docs/build
dist
.pytest_cache/
# cartopy build files
lib/cartopy/trace.cpp
......@@ -31,6 +33,8 @@ lib/cartopy/data/shapefiles
lib/cartopy/tests/.pep8_test_exclude.txt
lib/cartopy/siteconfig.py
cartopy_test_output
# pydev files
.project
.pydevproject
......@@ -41,12 +45,16 @@ lib/cartopy/siteconfig.py
\.\#*
*.swp
.ipynb_checkpoints/
.idea/
# Operating system files
\.DS_Store
.cache/
__pycache__/
# PyTest cache files
.pytest_cache
# Egg that gets created with 'pip install -v -e .'
lib/Cartopy.egg-info/
*.egg-info/
.eggs/
......@@ -4,19 +4,17 @@ env:
matrix:
# These ancient versions are linked to an old libgfortran, but that version
# isn't pinned in the package metadata
# Forcing build 3 for numpy pulls in the packages from defaults, which
# is needed in order to work with libgfortran 1
- PYTHON_VERSION=2.7
PACKAGES="numpy=1.9.3=py27_3 matplotlib=1.4.3 nose scipy=0.16.0 libgfortran=1 mock"
PACKAGES="numpy=1.10.0 matplotlib=1.5.1 nose proj4=4.9.1 scipy=0.16.0 libgfortran=1 mock"
- PYTHON_VERSION=3.5
PACKAGES="numpy=1.9.3=py35_3 matplotlib=1.4.3 nose scipy=0.16.0 libgfortran=1"
# New FreeType causes changes in text output.
PACKAGES="numpy=1.10.0 matplotlib=1.5.1 nose proj4=4.9.1 scipy=0.16.0 libgfortran=1"
PYTHONHASHSEED=0 # So pytest-xdist works.
- NAME="Latest everything."
PYTHON_VERSION=3.6
PACKAGES="numpy matplotlib freetype<2.8 scipy"
PACKAGES="numpy matplotlib-base proj4 pykdtree scipy"
- NAME="Latest everything (py2k)."
PYTHON_VERSION=2
PACKAGES="numpy matplotlib freetype<2.8 scipy mock"
PACKAGES="numpy matplotlib proj4 scipy mock"
sudo: false
......@@ -40,19 +38,22 @@ install:
# Create the basic testing environment
# ------------------------------------
- conda config --set always_yes yes --set changeps1 no --set show_channel_urls yes
- conda update conda
- conda create -n test-environment python=$PYTHON_VERSION
- source activate test-environment
- ENV_NAME="test-environment"
- conda create -n $ENV_NAME python=$PYTHON_VERSION
- source activate $ENV_NAME
# Customise the testing environment
# ---------------------------------
- conda config --add channels conda-forge
- PACKAGES="$PACKAGES cython pillow pytest pep8 proj4 pyshp shapely six requests pyepsg owslib"
- conda config --add channels conda-forge/label/testing
- PACKAGES="$PACKAGES cython pillow pytest pytest-xdist filelock pep8 pyshp shapely six requests pyepsg owslib"
- conda install --quiet $PACKAGES
# Conda debug
# -----------
- conda list
- conda list -n $ENV_NAME
- conda list -n $ENV_NAME --explicit
- conda info -a
- MPL_CONFIG_DIR=~/.config/matplotlib
- mkdir -p $MPL_CONFIG_DIR
......@@ -71,11 +72,24 @@ script:
- python $TRAVIS_BUILD_DIR/tools/feature_download.py gshhs physical --dry-run
- if [[ "$NAME" == "Latest everything"* ]]; then
CARTOPY_GIT_DIR=$TRAVIS_BUILD_DIR pytest --doctest-modules --pyargs cartopy;
CARTOPY_GIT_DIR=$TRAVIS_BUILD_DIR pytest -n 4 --doctest-modules --pyargs cartopy;
else
CARTOPY_GIT_DIR=$TRAVIS_BUILD_DIR pytest --pyargs cartopy;
CARTOPY_GIT_DIR=$TRAVIS_BUILD_DIR pytest -n 4 --pyargs cartopy;
fi
after_failure:
- source activate test-environment
- source activate $ENV_NAME
- python -c "from __future__ import print_function; import cartopy.tests.mpl; print(cartopy.tests.mpl.failed_images_html())"
deploy:
- provider: pypi
user: scitools-cartopy
# travis encrypt <password>
password:
secure: Wbc/NQkcEsWVGn3hTemLbaDond6dtAO46Q6PVSS0GiL9RU0bH6QIpLq34JV5hKRuhooFp8WaU49OJsH71iMB4Utrr1y8olkwpTuq7BBsuZGSHtStX0T4UKUCAHynlLnCEqIyBBDIWFsIy6OnLZDnKmPkqLW8IdQfk0aWl0mDv5w=
distributions: sdist
upload_docs: false
on:
repo: SciTools/cartopy
condition: $NAME == "Latest everything"*
tags: true
......@@ -40,17 +40,17 @@ These external packages are required to install Cartopy or gain access to
significant Cartopy functionality.
Many of these packages are available in Linux package managers
such as aptitude and yum. For example, it may be possible to install
such as aptitude and yum. For example, it may be possible to install
Numpy using::
apt-get install python-numpy
If you are installing dependencies with a package manager on Linux,
you may need to install the development packages (look for a "-dev"
suffix) in addition to the core packages.
If you are installing dependencies with a package manager on Linux,
you may need to install the development packages (look for a "-dev"
suffix) in addition to the core packages.
Many of these dependencies are built as part of Cartopy's conda distribution.
The recipes for these can be found at `https://github.com/conda-forge/feedstocks`_.
The recipes for these can be found at https://github.com/conda-forge/feedstocks.
**Python** 2.7 or later (https://www.python.org/)
......@@ -58,7 +58,7 @@ The recipes for these can be found at `https://github.com/conda-forge/feedstocks
**Cython** 0.15.1 or later (https://pypi.python.org/pypi/Cython/)
**NumPy** 1.6 or later (http://www.numpy.org/)
**NumPy** 1.10 or later (http://www.numpy.org/)
Python package for scientific computing including a powerful N-dimensional
array object.
......@@ -73,7 +73,7 @@ The recipes for these can be found at `https://github.com/conda-forge/feedstocks
**pyshp** 1.1.4 or later (https://pypi.python.org/pypi/pyshp)
Pure Python read/write support for ESRI Shapefile format.
**PROJ.4** 4.9.0 or later (http://proj4.org/)
**PROJ** 4.9.0 or later (https://proj4.org/)
Cartographic Projections library.
**six** 1.3.0 or later (https://pypi.python.org/pypi/six)
......@@ -85,7 +85,7 @@ Optional Dependencies
These are optional packages which you may want to install to enable
additional Cartopy functionality.
**matplotlib** 1.3.0 or later (https://matplotlib.org/)
**Matplotlib** 1.5.1 or later (https://matplotlib.org/)
Python package for 2D plotting. This package is required for any
graphical capability.
......@@ -99,6 +99,10 @@ additional Cartopy functionality.
**pyepsg** 0.2.0 or later (https://github.com/rhattersley/pyepsg)
A simple Python interface to https://epsg.io
**pykdtree** 1.2.2 or later (https://github.com/storpipfugl/pykdtree)
Fast kd-tree implementation in Python; used for faster warping of images in
preference to SciPy.
**SciPy** 0.10 or later (https://www.scipy.org/)
Python package for scientific computing.
......@@ -106,19 +110,23 @@ additional Cartopy functionality.
Python package for client programming with Open Geospatial Consortium
(OGC) web service. Gives access to cartopy ogc clients.
**Fiona** 1.0 or later (https://github.com/Toblerity/Fiona)
Python package for reading shapefiles faster than the default (pyshp).
Testing Dependencies
~~~~~~~~~~~~~~~~~~~~
These packages are required for the full Cartopy test suite to run.
**filelock** (https://filelock.readthedocs.io/)
A platform independent file lock for Python.
**mock** 1.0.1 (https://pypi.python.org/pypi/mock/)
Python mocking and patching package for testing. Note that this package
is only required to support the Cartopy unit tests.
**pytest** 3.0.0 or later (https://docs.pytest.org/en/latest/)
**pytest** 3.1.0 or later (https://docs.pytest.org/en/latest/)
Python package for software testing.
**pep8** 1.3.3 or later (https://pypi.python.org/pypi/pep8)
**pep8** 1.3.3 or later (https://pypi.python.org/pypi/pep8)
Python package for software testing.
......@@ -3,9 +3,11 @@ include CHANGES
include COPYING*
include INSTALL
include README.rst
include pyproject.toml
include requirements/*.txt
include lib/cartopy/data/*
include lib/cartopy/io/srtm.npz
include lib/cartopy/tests/lakes_shapefile/*
recursive-include lib *.py
recursive-include lib *.pyx *.pxd *.h
include versioneer.py
![Cartopy logo](http://scitools.org.uk/cartopy/docs/latest/_static/cartopy.png)
<h1 align="center" style="margin:1em;">
<a href="http://scitools.org.uk/cartopy/docs/latest/">
<img src="http://scitools.org.uk/cartopy/docs/latest/_static/cartopy.png"
alt="Cartopy"></a>
</h1>
Cartopy
-------
[![Build Status](https://api.travis-ci.org/repositories/SciTools/cartopy.svg?branch=master)](https://travis-ci.org/SciTools/cartopy/branches)
<h4 align="center">
Cartopy is a Python package designed to make drawing maps for
data analysis and visualisation easy.
</h4>
Cartopy is a Python package designed to make drawing maps for data analysis and visualisation easy.
<p align="center">
<!-- https://shields.io/ is a good source of these -->
<a href="https://anaconda.org/conda-forge/cartopy">
<img src="https://img.shields.io/conda/dn/conda-forge/cartopy.svg"
alt="conda-forge downloads" /></a>
<a href="https://github.com/SciTools/cartopy/releases">
<img src="https://img.shields.io/github/tag/SciTools/cartopy.svg"
alt="Latest version" /></a>
<a href="https://github.com/SciTools/cartopy/commits/master">
<img src="https://img.shields.io/github/commits-since/SciTools/cartopy/latest.svg"
alt="Commits since last release" /></a>
<a href="https://github.com/SciTools/cartopy/graphs/contributors">
<img src="https://img.shields.io/github/contributors/SciTools/cartopy.svg"
alt="# contributors" /></a>
<a href="https://travis-ci.org/SciTools/cartopy/branches">
<img src="https://api.travis-ci.org/repositories/SciTools/cartopy.svg?branch=master"
alt="Travis-CI" /></a>
<a href="https://zenodo.org/badge/latestdoi/5282596">
<img src="https://zenodo.org/badge/5282596.svg"
alt="zenodo" /></a>
<a href="https://gitter.im/SciTools/cartopy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge">
<img src="https://badges.gitter.im/SciTools/cartopy.svg" alt="Gitter Chat" /></a>
</p>
<br>
# Table of contents
<!--
NOTE: toc auto-generated with https://github.com/jonschlinkert/markdown-toc
$> markdown-toc -i --bullets='-' README.md
NOTE: This entire README can be markdown linted with
https://github.com/igorshubovych/markdownlint-cli
$ echo '{"no-inline-html": false}' > .markdownrc
$ markdownlint README.md
-->
<!-- toc -->
- [Overview](#overview)
- [Get in touch](#get-in-touch)
- [License and copyright](#license-and-copyright)
<!-- tocstop -->
## Overview
Cartopy is a Python package designed to make drawing maps for data
analysis and visualisation easy.
It features:
* object oriented projection definitions
* point, line, polygon and image transformations between projections
* integration to expose advanced mapping in Matplotlib with a simple and intuitive interface
* powerful vector data handling by integrating shapefile reading with Shapely capabilities
- object oriented projection definitions
- point, line, polygon and image transformations between projections
- integration to expose advanced mapping in Matplotlib with a simple and
intuitive interface
- powerful vector data handling by integrating shapefile reading with Shapely
capabilities
Documentation can be found at <http://scitools.org.uk/cartopy/docs/latest/>.
## Get in touch
- Ask usage questions on
[StackOverflow](https://stackoverflow.com/questions/tagged/cartopy).
- For less well defined questions, ideas, general discussion or announcements
of related projects use the
[Google Group](https://groups.google.com/forum/#!forum/scitools-iris).
- Report bugs, suggest features or view the source code on
[GitHub](https://github.com/SciTools/cartopy).
- To chat with developers and other users you can use the
[Gitter Chat](https://gitter.im/SciTools/cartopy)
## License and copyright
Cartopy is licensed under GNU Lesser General Public License (LGPLv3).
Development occurs on GitHub at <https://github.com/SciTools/cartopy>, with a
contributor's license agreement (CLA) that can be found at
<http://scitools.org.uk/governance.html>.
Licence
-------
Cartopy is licenced under GNU Lesser General Public License (LGPLv3).
(C) British Crown Copyright, Met Office
=======
Cartopy
=======
.. image:: http://scitools.org.uk/cartopy/docs/latest/_static/cartopy.png
Cartopy is a Python package designed to make drawing maps for data analysis and visualisation easy.
It features:
* object oriented projection definitions
* point, line, polygon and image transformations between projections
* integration to expose advanced mapping in Matplotlib with a simple and intuitive interface
* powerful vector data handling by integrating shapefile reading with Shapely capabilities
Documentation can be found at http://scitools.org.uk/cartopy/docs/latest/.
----
Code
----
Cartopy is licenced under GNU Lesser General Public License (LGPLv3).
Development occurs at https://github.com/SciTools/cartopy.
python-cartopy (0.16.0+dfsg1-4) UNRELEASED; urgency=medium
python-cartopy (0.17.0+dfsg-1) unstable; urgency=medium
* Team upload.
* New upstream release.
* Bump Standards-Version to 4.2.1, no changes.
-- Bas Couwenberg <sebastic@debian.org> Tue, 28 Aug 2018 15:22:30 +0200
* Add filelock, fiona & pykdtree (build) dependencies.
* Add license & copyright for pre_sphinx_gallery.py.
* Use pytest markers to skip certain tests.
* Refresh i386 patch.
* Drop proj 5 patches, fixed upstream.
* Add python{,3}-{pil,scipy,tk} build dependencies for tests.
* Use xvfb to run dh_auto_test for Tk tests.
* Add patch to mark additional tests as requiring network.
* Remove executable bit from lock files.
* Remove Multi-Arch fields due to pycompile in postinst.
-- Bas Couwenberg <sebastic@debian.org> Sun, 18 Nov 2018 11:43:11 +0100
python-cartopy (0.16.0+dfsg1-3) unstable; urgency=medium
......
......@@ -12,22 +12,36 @@ Build-Depends: cython,
libproj-dev (>= 4.9.0),
proj-bin,
python-all-dev,
python-filelock,
python-fiona,
python-matplotlib,
python-mock,
python-numpy,
python-pil,
python-pykdtree,
python-pyshp,
python-pytest,
python-scipy,
python-setuptools,
python-shapely (>= 1.5.6),
python-six (>= 1.3.0),
python-tk,
python3-all-dev,
python3-filelock,
python3-fiona,
python3-matplotlib,
python3-numpy,
python3-pil,
python3-pykdtree,
python3-pyshp,
python3-pytest,
python3-scipy,
python3-setuptools,
python3-shapely (>= 1.5.6),
python3-six (>= 1.3.0)
python3-six (>= 1.3.0),
python3-tk,
xauth,
xvfb
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/debian-gis-team/python-cartopy
Vcs-Git: https://salsa.debian.org/debian-gis-team/python-cartopy.git
......@@ -35,16 +49,17 @@ Homepage: https://scitools.org.uk/cartopy/
Package: python-cartopy
Architecture: any
Multi-Arch: same
Depends: python-cartopy-data (= ${source:Version}),
${shlibs:Depends},
${python:Depends},
${misc:Depends}
Suggests: python-gdal,
Suggests: python-fiona,
python-gdal,
python-matplotlib,
python-owslib,
python-pil,
python-pyepsg,
python-pykdtree,
python-scipy
Description: Cartographic library for Python 2
Cartopy is a Python package designed to make drawing maps for data analysis
......@@ -63,16 +78,17 @@ Description: Cartographic library for Python 2
Package: python3-cartopy
Architecture: any
Multi-Arch: same
Depends: python-cartopy-data (= ${source:Version}),
${shlibs:Depends},
${python3:Depends},
${misc:Depends}
Suggests: python3-gdal,
Suggests: python3-fiona,
python3-gdal,
python3-matplotlib,
python3-owslib,
python3-pil,
python3-pyepsg,
python3-pykdtree,
python3-scipy
Description: Cartographic library for Python 3
Cartopy is a Python package designed to make drawing maps for data analysis
......@@ -92,7 +108,6 @@ Description: Cartographic library for Python 3
Package: python-cartopy-data
Architecture: all
Depends: ${misc:Depends}
Multi-Arch: foreign
Description: cartographic library for Python (package data)
Cartopy is a Python package designed to make drawing maps for data analysis
and visualisation easy.
......
......@@ -25,6 +25,10 @@ Comment: This file is lifted from the change proposed in
<https://github.com/matplotlib/matplotlib/pull/6213>.
License: matplotlib
Files: docs/source/sphinxext/pre_sphinx_gallery.py
Copyright: 2015, Óscar Nájera
License: BSD-3-Clause
Files: lib/cartopy/data/raster/natural_earth/*
Copyright: None
Comment: http://www.naturalearthdata.com/about/terms-of-use/
......@@ -64,6 +68,33 @@ License: LGPL-3+
On Debian systems, the complete text of version 3 of the GNU Lesser
General Public License can be found in `/usr/share/common-licenses/LGPL-3'.
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
1) Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
3) Neither the name of the ORGANIZATION nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
License: matplotlib
License agreement for matplotlib versions 1.3.0 and later
=========================================================
......
......@@ -4,7 +4,7 @@ Subject: Skip tests failing on i386 architectures
--- a/lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py
+++ b/lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py
@@ -22,6 +22,10 @@ from numpy.testing import assert_almost_
@@ -23,6 +23,10 @@ import pytest
import cartopy.crs as ccrs
......@@ -13,9 +13,9 @@ Subject: Skip tests failing on i386 architectures
+triplet = sysconfig.get_config_var('MULTIARCH')
+arch_is_i386 = 'i386' in triplet
class TestLambertAzimuthalEqualArea(object):
def test_default(self):
@@ -33,9 +37,10 @@ class TestLambertAzimuthalEqualArea(obje
def check_proj4_params(crs, other_args):
expected = other_args | {'proj=laea', 'no_defs'}
@@ -40,9 +44,10 @@ class TestLambertAzimuthalEqualArea(obje
assert_almost_equal(np.array(crs.x_limits),
[-12755636.1863, 12755636.1863],
decimal=4)
......
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sun, 6 May 2018 19:46:16 +0000
Subject: Compatibility with proj5 +over
See also https://github.com/OSGeo/proj.4/issues/985 and
https://github.com/OSGeo/proj.4/issues/941.
--- a/lib/cartopy/crs.py
+++ b/lib/cartopy/crs.py
@@ -964,7 +964,8 @@ class Mercator(Projection):
proj4_params = [('proj', 'merc'),
('lon_0', central_longitude),
('lat_ts', latitude_true_scale),
- ('units', 'm')]
+ ('units', 'm'),
+ ('over', None)]
super(Mercator, self).__init__(proj4_params, globe=globe)
# Calculate limits.
--- a/lib/cartopy/tests/crs/test_mercator.py
+++ b/lib/cartopy/tests/crs/test_mercator.py
@@ -26,7 +26,7 @@ def test_default():
crs = ccrs.Mercator()
assert crs.proj4_init == ('+ellps=WGS84 +proj=merc +lon_0=0.0 +lat_ts=0.0 '
- '+units=m +no_defs')
+ '+units=m +over +no_defs')
assert_almost_equal(crs.boundary.bounds,
[-20037508, -15496571, 20037508, 18764656], decimal=0)
@@ -36,7 +36,7 @@ def test_eccentric_globe():
ellipse=None)
crs = ccrs.Mercator(globe=globe, min_latitude=-40, max_latitude=40)
assert crs.proj4_init == ('+a=10000 +b=5000 +proj=merc +lon_0=0.0 '
- '+lat_ts=0.0 +units=m +no_defs')
+ '+lat_ts=0.0 +units=m +over +no_defs')
assert_almost_equal(crs.boundary.bounds,
[-31415.93, -2190.5, 31415.93, 2190.5], decimal=2)
@@ -61,7 +61,7 @@ def test_central_longitude():
cl = 10.0
crs = ccrs.Mercator(central_longitude=cl)
proj4_str = ('+ellps=WGS84 +proj=merc +lon_0={} +lat_ts=0.0 '
- '+units=m +no_defs'.format(cl))
+ '+units=m +over +no_defs'.format(cl))
assert crs.proj4_init == proj4_str
assert_almost_equal(crs.boundary.bounds,
@@ -72,7 +72,7 @@ def test_latitude_true_scale():
lat_ts = 20.0
crs = ccrs.Mercator(latitude_true_scale=lat_ts)
proj4_str = ('+ellps=WGS84 +proj=merc +lon_0=0.0 +lat_ts={} '
- '+units=m +no_defs'.format(lat_ts))
+ '+units=m +over +no_defs'.format(lat_ts))
assert crs.proj4_init == proj4_str
assert_almost_equal(crs.boundary.bounds,
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Mon, 21 May 2018 22:08:04 +0000
Subject: Compatibility with proj5 TM
--- a/lib/cartopy/tests/crs/test_transverse_mercator.py
+++ b/lib/cartopy/tests/crs/test_transverse_mercator.py
@@ -97,8 +97,8 @@ class TestOSNI(object):
def test_default(self):
proj = ccrs.OSNI()
res = proj.transform_point(*self.point_a, src_crs=self.src_crs)
- np.testing.assert_array_almost_equal(res, (275614.87105610,
- 386984.15347340))
+ np.testing.assert_array_almost_equal(res, (275614.267627,
+ 386984.20643))
def test_nan(self):
proj = ccrs.OSNI()
Description: Mark additional tests as requiring network.
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: https://github.com/SciTools/cartopy/issues/1206
--- a/lib/cartopy/tests/mpl/test_nightshade.py
+++ b/lib/cartopy/tests/mpl/test_nightshade.py
@@ -27,6 +27,7 @@ from cartopy.feature.nightshade import N
from cartopy.tests.mpl import ImageTesting
+@pytest.mark.network
@ImageTesting(['nightshade_platecarree'])
def test_nightshade_image():
# Test the actual creation of the image
0001-Skip-tests-failing-on-i386-architectures.patch
0002-Compatibility-with-proj5+over.patch
0003-Compatibility-with-proj5-TM.patch
no-network.patch
......@@ -12,10 +12,7 @@ export PYBUILD_TEST_PYTEST = 1
# See: https://github.com/SciTools/cartopy/issues/797.
# Testing of the plot feature (cartopy/tests/mpl/*) is disabled due to a bug in
# the matplotlib Debian package. See Bug-Debian #838301.
export PYBUILD_TEST_ARGS = --pyargs \
cartopy.tests.crs \
cartopy.tests.test_crs \
cartopy.tests.test_geodesic
export PYBUILD_TEST_ARGS = --pyargs -m "not network and not natural_earth"
%:
dh $@ --with python2,python3 --buildsystem=pybuild
......@@ -24,6 +21,9 @@ override_dh_auto_clean:
dh_auto_clean || true
rm -rf .pybuild
override_dh_auto_test:
xvfb-run -a -n 1 -s "-screen 0 1280x1024x24 -dpi 96" dh_auto_test
override_dh_auto_install:
mkdir -p debian/python-cartopy-data/usr/share/cartopy/data
dh_auto_install
......@@ -38,6 +38,9 @@ override_dh_install:
# Remove documentation outside usr/share/doc
$(RM) debian/*/usr/share/cartopy/data/shapefiles/shapefiles/gshhs/README.TXT
# Remove executable bit from lock files
chmod -x debian/*/usr/lib/python*/dist-packages/cartopy_test_output/*/*.lock
override_dh_python2:
dh_python2
dh_numpy
......
......@@ -3,5 +3,5 @@ netCDF4
iris
iris-sample-data
cf_units
sphinx-gallery =0.1.12
sphinx-gallery =0.2.0
beautifulsoup4
# (C) British Crown Copyright 2011 - 2017, Met Office
# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
......@@ -16,22 +16,59 @@
# along with cartopy. If not, see <https://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
import os
import inspect
import textwrap
import numpy as np
import cartopy.crs as ccrs
SPECIAL_CASES = {
ccrs.PlateCarree: [{}, {'central_longitude': 180}],
ccrs.RotatedPole: [{'pole_longitude': 177.5, 'pole_latitude': 37.5}],
ccrs.UTM: [{'zone': 30}],
ccrs.AzimuthalEquidistant: [{'central_latitude': 90}],
ccrs.NearsidePerspective: [{
#: A dictionary to allow examples to use non-default parameters to the CRS
#: constructor.
SPECIFIC_PROJECTION_KWARGS = {
ccrs.RotatedPole: {'pole_longitude': 177.5, 'pole_latitude': 37.5},
ccrs.AzimuthalEquidistant: {'central_latitude': 90},
ccrs.NearsidePerspective: {
'central_longitude': -3.53, 'central_latitude': 50.72,
'satellite_height': 10.0e6}],
'satellite_height': 10.0e6},
}
def plate_carree_plot():
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
nplots = 2
fig = plt.figure(figsize=(6, 6))
for i in range(0, nplots):
central_longitude = 0 if i == 0 else 180
ax = fig.add_subplot(
nplots, 1, i+1,
projection=ccrs.PlateCarree(central_longitude=central_longitude))
ax.coastlines(resolution='110m')
ax.gridlines()
def utm_plot():
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
nplots = 60
fig = plt.figure(figsize=(10, 3))
for i in range(0, nplots):
ax = fig.add_subplot(1, nplots, i+1,
projection=ccrs.UTM(zone=i+1,
southern_hemisphere=True))
ax.coastlines(resolution='110m')
ax.gridlines()
MULTI_PLOT_CASES = {
ccrs.PlateCarree: plate_carree_plot,
ccrs.UTM: utm_plot,
}
......@@ -39,15 +76,19 @@ COASTLINE_RESOLUTION = {ccrs.OSNI: '10m',
ccrs.OSGB: '50m',
ccrs.EuroPP: '50m'}
PRJ_SORT_ORDER = {'PlateCarree': 1,
'Mercator': 2, 'Mollweide': 2, 'Robinson': 2,
'TransverseMercator': 2, 'LambertCylindrical': 2,
'LambertConformal': 2, 'Stereographic': 2, 'Miller': 2,
'LambertConformal': 2, 'EquidistantConic': 2,
'Stereographic': 2, 'Miller': 2,
'Orthographic': 2, 'UTM': 2, 'AlbersEqualArea': 2,
'AzimuthalEquidistant': 2, 'Sinusoidal': 2,
'InterruptedGoodeHomolosine': 3, 'RotatedPole': 3,
'OSGB': 4, 'EuroPP': 5,
'Geostationary': 6, 'NearsidePerspective': 7}
'Geostationary': 6, 'NearsidePerspective': 7,
'EckertI': 8.1, 'EckertII': 8.2, 'EckertIII': 8.3,
'EckertIV': 8.4, 'EckertV': 8.5, 'EckertVI': 8.6}
def find_projections():
......@@ -58,6 +99,25 @@ def find_projections():
yield o
def create_instance(prj_cls, instance_args):
name = prj_cls.__name__
# Format instance arguments into strings
instance_params = ',\n '.join(
'{}={}'.format(k, v)
for k, v in sorted(instance_args.items()))
if instance_params:
instance_params = '\n ' \
+ instance_params
instance_creation_code = '{}({})'.format(name, instance_params)
prj_inst = prj(**instance_args)
return prj_inst, instance_creation_code
if __name__ == '__main__':
fname = os.path.join(os.path.dirname(__file__), 'source',
'crs', 'projections.rst')
......@@ -75,8 +135,7 @@ if __name__ == '__main__':
=======================
"""
for line in notes.split('\n'):
table.write(line.strip() + '\n')
table.write(textwrap.dedent(notes))
def prj_class_sorter(cls):
return (PRJ_SORT_ORDER.get(cls.__name__, 100),
......@@ -90,31 +149,47 @@ if __name__ == '__main__':
table.write('.. autoclass:: cartopy.crs.%s\n' % name)
for instance_args in SPECIAL_CASES.get(prj, [{}]):
prj_inst = prj(**instance_args)
if prj not in MULTI_PLOT_CASES:
# Get instance arguments and number of plots
instance_args = SPECIFIC_PROJECTION_KWARGS.get(prj, {})
prj_inst, instance_repr = create_instance(prj, instance_args)
aspect = (np.diff(prj_inst.x_limits) /
np.diff(prj_inst.y_limits))[0]
width = 3 * aspect
width = '{:.4f}'.format(width).rstrip('0').rstrip('.')
instance_params = ',\n '.join(
'{}={}'.format(k, v)
for k, v in sorted(instance_args.items()))
if instance_params:
instance_params = '\n ' + instance_params
instance_creation_code = '{}({})'.format(name, instance_params)
code = """
.. plot::
# Generate plotting code
code = textwrap.dedent("""
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=({width}, 3))
ax = plt.axes(projection=ccrs.{proj_constructor})
ax.coastlines(resolution={coastline_resolution!r})
ax.gridlines()
""").format(width=width,
proj_constructor=instance_repr,
coastline_resolution=COASTLINE_RESOLUTION.get(prj,
'110m'))
else:
func = MULTI_PLOT_CASES[prj]
lines = inspect.getsourcelines(func)
func_code = "".join(lines[0][1:])
code = textwrap.dedent("""
.. plot::
plt.figure(figsize=({width}, 3))
ax = plt.axes(projection=ccrs.{proj_constructor})
ax.coastlines(resolution={coastline_resolution!r})
ax.gridlines()
{func_code}
\n""".format(width=width, proj_constructor=instance_creation_code,
coastline_resolution=COASTLINE_RESOLUTION.get(prj, '110m'))
""").format(func_code=func_code)
table.write(code)
table.write(code)
Geodesic calculations
=====================
This module defines the Geodesic class which can interface with the Proj
geodesic functions. See the `Proj geodesic page`_ for more background
information.
.. _Proj geodesic page: https://proj4.org/geodesic.html
.. autoclass:: cartopy.geodesic.Geodesic
:members:
LinearRing/LineString projection
================================
.. automodule:: cartopy.trace
:members:
......@@ -60,7 +60,7 @@ Copyright note
Since basemap data is taken from external sources, it is advised to cite and credit the data provider accordingly.
Some data providers request or at least recommend to include a corresponding note along with the map.
Depending on the policy, this may either be only the data source and licese or terms of use.
Depending on the policy, this may either be only the data source and license or terms of use.
The corresponding information for the data providers included in cartopy is listed in the :ref:`data_copyright_table`:
......
......@@ -98,10 +98,12 @@ version = cartopy.__version__
release = cartopy.__version__
# Sphinx gallery configuration
from sphinx_gallery.sorting import ExampleTitleSortKey
sphinx_gallery_conf = {
'examples_dirs': ['../../lib/cartopy/examples'],
'filename_pattern': '^((?!sgskip).)*$',
'gallery_dirs': ['gallery'],
'within_subsection_order': ExampleTitleSortKey,
'doc_module': ('cartopy',),
'reference_url': {'cartopy': None},
'backreferences_dir': '../build/backrefs',
......@@ -122,7 +124,7 @@ sphinx_gallery_conf = {
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
default_role = 'py:obj'
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
......@@ -345,7 +347,8 @@ epub_copyright = u'2012, Philip Elson, Richard Hattersley'
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'matplotlib': ('https://matplotlib.org', None),
'shapely': ('https://toblerity.org/shapely', None), }
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'shapely': ('http://toblerity.org/shapely', None), }
......
......@@ -10,7 +10,7 @@ cartopy was born. From such simple beginnings cartopy has grown into a community
package with exciting scientific geospatial visualisation capabilities and a simple, pythonic
interface.
The following people have dedicated their time and effort to deliver
The following people have dedicated their time and effort to deliver
new functionality, fix bugs, review code and provide support for, cartopy, without whom
the package wouldn't be as rich or diverse as it is today:
......@@ -37,7 +37,7 @@ the package wouldn't be as rich or diverse as it is today:
* Crispian Batstone
* Daryl Herzmann
* Robert Redl
* Greg Lucas
Thank you!
......@@ -45,4 +45,3 @@ Thank you!
.. note::
If you have been excluded from the list, please add yourself and submit a pull request.
......@@ -5,7 +5,7 @@ The :class:`cartopy.crs.CRS` class is the very core of cartopy, all coordinate r
in cartopy have :class:`~cartopy.crs.CRS` as a parent class, meaning all projections have
the interface described below.
.. autoclass:: cartopy.crs.CRS()
.. autoclass:: cartopy.crs.CRS
:members:
.. data:: globe
......@@ -17,7 +17,7 @@ The :class:`~cartopy.crs.Globe` class is used to encapsulate the underlying sphe
All CRSs have an associated :class:`~cartopy.crs.Globe`, though often it is just the default :class:`~cartopy.crs.Globe`
which represents the reference ellipsoid (i.e. "wgs84").
.. autoclass:: cartopy.crs.Globe(datum=None, ellipse='WGS84', semimajor_axis=None, semiminor_axis=None, flattening=None, inverse_flattening=None, towgs84=None)
.. autoclass:: cartopy.crs.Globe
:members:
:exclude-members: to_proj4_params
......@@ -34,9 +34,9 @@ all projections in the :ref:`cartopy_projections`.
There are a few non-:class:`~cartopy.crs.Projection` subclasses. These represent
coordinate reference systems which are 3 dimensional and could not be drawn directly on a piece of paper.
.. autoclass:: cartopy.crs.Geodetic(globe=None)
.. autoclass:: cartopy.crs.Geodetic
.. autoclass:: cartopy.crs.Geocentric(globe=None)
.. autoclass:: cartopy.crs.Geocentric
.. autoclass:: cartopy.crs.RotatedGeodetic
......
......@@ -9,7 +9,6 @@
Cartopy projection list
=======================
PlateCarree
-----------
......@@ -20,23 +19,17 @@ PlateCarree
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines(resolution='110m')
ax.gridlines()
nplots = 2
fig = plt.figure(figsize=(6, 6))
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.PlateCarree(
central_longitude=180))
ax.coastlines(resolution='110m')
ax.gridlines()
for i in range(0, nplots):
central_longitude = 0 if i == 0 else 180
ax = fig.add_subplot(nplots, 1, i+1,
projection=ccrs.PlateCarree(
central_longitude=central_longitude))
ax.coastlines(resolution='110m')
ax.gridlines()
AlbersEqualArea
......@@ -67,7 +60,23 @@ AzimuthalEquidistant
plt.figure(figsize=(3, 3))
ax = plt.axes(projection=ccrs.AzimuthalEquidistant(
central_latitude=90))
central_latitude=90))
ax.coastlines(resolution='110m')
ax.gridlines()
EquidistantConic
----------------
.. autoclass:: cartopy.crs.EquidistantConic
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(4.9603, 3))
ax = plt.axes(projection=ccrs.EquidistantConic())
ax.coastlines(resolution='110m')
ax.gridlines()
......@@ -242,11 +251,16 @@ UTM
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(0.1286, 3))
ax = plt.axes(projection=ccrs.UTM(
zone=30))
ax.coastlines(resolution='110m')
ax.gridlines()
nplots = 60
fig = plt.figure(figsize=(10, 3))
for i in range(0, nplots):
ax = fig.add_subplot(1, nplots, i+1,
projection=ccrs.UTM(zone=i+1,
southern_hemisphere=True))
ax.coastlines(resolution='110m')
ax.gridlines()
InterruptedGoodeHomolosine
......@@ -277,8 +291,8 @@ RotatedPole
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.RotatedPole(
pole_latitude=37.5,
pole_longitude=177.5))
pole_latitude=37.5,
pole_longitude=177.5))
ax.coastlines(resolution='110m')
ax.gridlines()
......@@ -343,9 +357,121 @@ NearsidePerspective
plt.figure(figsize=(3, 3))
ax = plt.axes(projection=ccrs.NearsidePerspective(
central_latitude=50.72,
central_longitude=-3.53,
satellite_height=10000000.0))
central_latitude=50.72,
central_longitude=-3.53,
satellite_height=10000000.0))
ax.coastlines(resolution='110m')
ax.gridlines()
EckertI
-------
.. autoclass:: cartopy.crs.EckertI
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.EckertI())
ax.coastlines(resolution='110m')
ax.gridlines()
EckertII
--------
.. autoclass:: cartopy.crs.EckertII
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.EckertII())
ax.coastlines(resolution='110m')
ax.gridlines()
EckertIII
---------
.. autoclass:: cartopy.crs.EckertIII
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.EckertIII())
ax.coastlines(resolution='110m')
ax.gridlines()
EckertIV
--------
.. autoclass:: cartopy.crs.EckertIV
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.EckertIV())
ax.coastlines(resolution='110m')
ax.gridlines()
EckertV
-------
.. autoclass:: cartopy.crs.EckertV
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.EckertV())
ax.coastlines(resolution='110m')
ax.gridlines()
EckertVI
--------
.. autoclass:: cartopy.crs.EckertVI
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6, 3))
ax = plt.axes(projection=ccrs.EckertVI())
ax.coastlines(resolution='110m')
ax.gridlines()
EqualEarth
----------
.. autoclass:: cartopy.crs.EqualEarth
.. plot::
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.figure(figsize=(6.1637, 3))
ax = plt.axes(projection=ccrs.EqualEarth())
ax.coastlines(resolution='110m')
ax.gridlines()
......
......@@ -11,7 +11,7 @@ Introduction
Cartopy is a Python package designed for geospatial data processing in order to produce maps and other geospatial data analyses.
Cartopy makes use of the powerful PROJ.4, numpy and shapely libraries and includes a programatic interface
Cartopy makes use of the powerful PROJ.4, NumPy and Shapely libraries and includes a programmatic interface
built on top of Matplotlib for the creation of publication quality maps.
Key features of cartopy are its object oriented :ref:`projection definitions <cartopy_projections>`, and its
......@@ -56,8 +56,10 @@ outlines recent changes, new features, and future development plans.
:hidden:
cartopy.rst
cartopy/geodesic.rst
cartopy/io/img_tiles.rst
cartopy/io/ogc_clients.rst
cartopy/trace.rst
cartopy/util/util.rst
......@@ -82,6 +84,7 @@ There are many ways to get involved in the development of cartopy:
re-designing its layout/logos etc.. The `documentation source <https://github.com/SciTools/cartopy>`_ is kept in the same repository as the source code.
* Contribute bug fixes (:issues:`a list of outstanding bugs can be found on github <bug>`).
* Contribute enhancements and new features on the issue tracker.
* Chat with users and developers in the `Gitter chat room <https://gitter.im/SciTools/cartopy>`_.
......
......@@ -27,6 +27,8 @@ Natural Earth or GSHHS shapefiles.
.. autoclass:: WFSFeature
.. autoclass:: AdaptiveScaler
----------
To simplify some very common cases, some pre-defined Features exist as :mod:`cartopy.feature`
......
# -*- coding: utf-8 -*-
"""
Override sphinx_gallery's treatment of groups (folders) with cartopy's
``__tags__`` semantics. This is tightly bound to the sphinx_gallery
implementation, hence the explicit version checking.
This code was modified from sphinx-gallery:
Copyright (c) 2015, Óscar Nájera
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of sphinx-gallery nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
from collections import OrderedDict
from collections import OrderedDict, defaultdict
import os.path
import shutil
import tempfile
import textwrap
import sphinx_gallery.gen_gallery
import sphinx_gallery.gen_rst
from sphinx_gallery.gen_rst import (
write_backreferences, extract_intro, _thumbnail_div,
generate_file_rst, sphinx_compatibility)
if sphinx_gallery.__version__ not in ['0.1.12']:
import sphinx_gallery
if sphinx_gallery.__version__ not in ['0.2.0']: # noqa: E402
raise RuntimeError('not tested with this version of sphinx_gallery ({}). '
'Please modify this check, and validate sphinx_gallery'
' behaves as expected.'
''.format(sphinx_gallery.__version__))
import sphinx_gallery.gen_gallery
import sphinx_gallery.gen_rst
from sphinx_gallery.gen_rst import (
write_backreferences, _thumbnail_div,
generate_file_rst, sphinx_compatibility)
GALLERY_HEADER = textwrap.dedent("""
......@@ -43,21 +74,20 @@ def example_groups(src_dir):
sorted_listdir = [fname for fname in sorted(os.listdir(src_dir))
if fname.endswith('.py') and not fname.startswith('_')]
tagged_examples = {}
tagged_examples = defaultdict(list)
for fname in sorted_listdir:
fpath = os.path.join(src_dir, fname)
with open(fpath, 'r') as fh:
for line in fh:
# Crudely remove the __tags__ line.
# Crudely extract the __tags__ line.
if line.startswith('__tags__ = '):
exec(line.strip(), locals(), globals())
for tag in __tags__: # noqa:
tagged_examples.setdefault(tag, []).append(fname)
tagged_examples[tag].append(fname)
break
else:
tag = 'Miscellanea'
tagged_examples.setdefault(tag, []).append(fname)
tagged_examples['Miscellanea'].append(fname)
return tagged_examples
......@@ -109,7 +139,9 @@ def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs):
tmp_dir = tempfile.mkdtemp()
for tag, examples in tagged_examples.items():
sorted_listdir = examples
sorted_listdir = sorted(
examples,
key=gallery_conf['within_subsection_order'](src_dir))
entries_text = []
iterator = sphinx_compatibility.status_iterator(
......@@ -118,15 +150,13 @@ def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs):
length=len(sorted_listdir))
for fname in iterator:
write_example(os.path.join(src_dir, fname), tmp_dir)
amount_of_code, time_elapsed = generate_file_rst(
intro, time_elapsed = generate_file_rst(
fname, target_dir, tmp_dir, gallery_conf)
if fname not in seen:
seen.add(fname)
computation_times.append((time_elapsed, fname))
new_fname = os.path.join(src_dir, fname)
intro = extract_intro(new_fname)
this_entry = _thumbnail_div(build_target_dir, fname, intro) + textwrap.dedent("""
.. toctree::
......@@ -136,15 +166,12 @@ def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs):
""") % os.path.join(build_target_dir, fname[:-3]).replace(os.sep, '/') # noqa: E501
entries_text.append((amount_of_code, this_entry))
entries_text.append(this_entry)
if gallery_conf['backreferences_dir']:
write_backreferences(seen_backrefs, gallery_conf,
target_dir, fname, intro)
# sort to have the smallest entries in the beginning
entries_text.sort()
fhindex += textwrap.dedent("""
{tag}
......@@ -154,7 +181,7 @@ def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs):
""".format(tag=tag, tag_underline='-' * len(tag)))
for _, entry_text in entries_text:
for entry_text in entries_text:
fhindex += '\n '.join(entry_text.split('\n'))
# clear at the end of the section
......
What's New in cartopy 0.17
==========================
:Release: 0.17.0
:Date: 16th Nov 2018
For a full list of included Pull Requests and closed Issues, please see the
`0.17 milestone <https://github.com/SciTools/cartopy/milestone/23>`_.
Features
--------
* The :class:`cartopy.feature.NaturalEarthFeature` class now allows a
:class:`cartopy.feature.AdaptiveScaler` object to be passed as the ``scale``
argument. This will automatically choose the appropriate feature scale from
the GeoAxes extent. This can also be used interactively while panning and
zooming in a figure. :data:`cartopy.feature.NaturalEarthFeature.scale` is
now read-only. (:pull:`1102`, :pull:`983`)
* Proj version 5.x is now supported in Cartopy, thanks to hard work by
Elliott Sales de Andrade. As part of making this version work, the inner
workings and boundaries of many projections were improved.
(:pull:`1124`, :pull:`1148`) Elliott also improved support for warped
rectangular projections (:pull:`1180`) as well as added support for the
Eckert family of projections (:pull:`1168`) and Equal Earth projection.
(:pull:`1182`)
.. plot::
:width: 400pt
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
eq_earth = ccrs.EqualEarth()
fig = plt.figure(figsize=(10, 5))
ax = plt.axes(projection=eq_earth)
ax.set_global()
ax.gridlines()
ax.stock_img()
ax.coastlines()
plt.show()
* Greg Lucas contributed functionality to plot day/night across the globe,
which was turned into a map feature by Phil Elson. The shading can be added
to a map with :data:`cartopy.feature.nightshade.Nightshade(datetime)`. For
more information, see the :ref:`sphx_glr_gallery_nightshade.py` example.
(:pull:`1135`, :pull:`1181`)
.. figure:: _images/sphx_glr_nightshade_001.png
:target: gallery/nightshade.html
:align: center
* Elliott Sales de Andrade added optional support for the use of
`pykdtree <https://github.com/storpipfugl/pykdtree>`_
when performing image transformations. This module has been demonstrated to
be twice as fast as the old code for most of the Cartopy examples, with one
example (geostationary) having a 95% reduction in run time. (:pull:`1150`)
* Greg Lucas added a Fiona-based shapefile reader. If
`Fiona <https://github.com/Toblerity/Fiona>`_ is installed on
a user's system, this will now be the default shapefile reader, adding
significant speed improvements. (:pull:`1000`)
* Phil Elson added the ability to control the appearance of Shapely geometries
using a function. :func:`cartopy.mpl.geoaxes.GeoAxes.add_geometries` gained
a ``styler`` argument that takes a function that given a geometry, returns a
dictionary of style keyword arguments. The
:ref:`sphx_glr_gallery_hurricane_katrina.py`
example has been updated to use this. (:pull:`1019`)
* Kevin Donkers, with help from Phil Elson and Peter Killick, improved the
interactivity of panning and zooming images by adding a raster