Skip to content
Commits on Source (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
......@@ -50,7 +50,7 @@ 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)
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
#: 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},
}
def plate_carree_plot():
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
nplots = 2
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: [{
'central_longitude': -3.53, 'central_latitude': 50.72,
'satellite_height': 10.0e6}],
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,20 +149,20 @@ 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 = """
# Generate plotting code
code = textwrap.dedent("""
.. plot::
import matplotlib.pyplot as plt
......@@ -114,7 +173,23 @@ if __name__ == '__main__':
ax.coastlines(resolution={coastline_resolution!r})
ax.gridlines()
\n""".format(width=width, proj_constructor=instance_creation_code,
coastline_resolution=COASTLINE_RESOLUTION.get(prj, '110m'))
""").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::
{func_code}
""").format(func_code=func_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: