Compare commits

..

No commits in common. "rawhide" and "f26" have entirely different histories.

16 changed files with 1394 additions and 400 deletions

19
.gitignore vendored
View file

@ -1,21 +1,2 @@
/Cartopy-0.16.0.tar.gz
/Cartopy-norm-images.tar.xz
/Cartopy-0.17.0.tar.gz
/Cartopy-0.18.0b1.tar.gz
/Cartopy-0.18.0b2.tar.gz
/Cartopy-0.18.0rc1.tar.gz
/Cartopy-0.18.0.tar.gz
/Cartopy-0.19.0rc1.tar.gz
/proj-7.2.1.tar.gz
/Cartopy-0.19.0.tar.gz
/Cartopy-0.20.0.tar.gz
/Cartopy-0.20.1.tar.gz
/Cartopy-0.20.2.tar.gz
/Cartopy-0.20.3.tar.gz
/Cartopy-0.21.0.tar.gz
/Cartopy-0.21.1.tar.gz
/Cartopy-0.22.0.tar.gz
/Cartopy-0.23.0.tar.gz
/cartopy-0.24.0.tar.gz
/cartopy-0.24.1.tar.gz
/cartopy-0.25.0.tar.gz

View file

@ -1,20 +0,0 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/
---
jobs:
- job: pull_from_upstream
trigger: release
dist_git_branches:
rawhide:
fast_forward_merge_into:
- fedora-branched
- job: koji_build
trigger: commit
allowed_committers:
- all_admins
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-all

View file

@ -0,0 +1,911 @@
From 756c9af63aee1785da91b218633a2c2fdfa09f11 Mon Sep 17 00:00:00 2001
From: Phil Elson <pelson.pub@gmail.com>
Date: Fri, 23 Feb 2018 06:55:16 +0000
Subject: [PATCH 1/7] Merge pull request #1032 from QuLogic/test-updates
Improvements to test metadata
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/_epsg.py | 5 +++--
lib/cartopy/tests/io/test_downloaders.py | 4 +++-
lib/cartopy/tests/io/test_ogc_clients.py | 5 ++++-
lib/cartopy/tests/io/test_srtm.py | 5 +++--
lib/cartopy/tests/mpl/test_caching.py | 3 +++
lib/cartopy/tests/mpl/test_crs.py | 5 ++++-
lib/cartopy/tests/mpl/test_examples.py | 2 ++
lib/cartopy/tests/mpl/test_features.py | 5 ++++-
lib/cartopy/tests/mpl/test_gridliner.py | 4 +++-
lib/cartopy/tests/mpl/test_images.py | 8 ++++++-
lib/cartopy/tests/mpl/test_img_transform.py | 3 ++-
lib/cartopy/tests/mpl/test_mpl_integration.py | 31 ++++++++++++++++++++++++++-
lib/cartopy/tests/mpl/test_shapely_to_mpl.py | 5 ++++-
lib/cartopy/tests/mpl/test_ticks.py | 7 +++++-
lib/cartopy/tests/mpl/test_web_services.py | 4 +++-
lib/cartopy/tests/test_coastline.py | 9 +++++---
lib/cartopy/tests/test_coding_standards.py | 6 ++++--
lib/cartopy/tests/test_crs.py | 3 ++-
lib/cartopy/tests/test_img_nest.py | 4 +++-
lib/cartopy/tests/test_img_tiles.py | 3 ++-
lib/cartopy/tests/test_shapereader.py | 19 ++++++++--------
lib/cartopy/util.py | 31 ++++++++++++++++-----------
22 files changed, 127 insertions(+), 44 deletions(-)
diff --git a/lib/cartopy/_epsg.py b/lib/cartopy/_epsg.py
index 8444d47..65c03de 100644
--- a/lib/cartopy/_epsg.py
+++ b/lib/cartopy/_epsg.py
@@ -21,11 +21,11 @@ Provide support for converting EPSG codes to Projection instances.
from __future__ import (absolute_import, division, print_function)
-import cartopy.crs as ccrs
import numpy as np
-import pyepsg
import shapely.geometry as sgeom
+import cartopy.crs as ccrs
+
_GLOBE_PARAMS = {'datum': 'datum',
'ellps': 'ellipse',
@@ -39,6 +39,7 @@ _GLOBE_PARAMS = {'datum': 'datum',
class _EPSGProjection(ccrs.Projection):
def __init__(self, code):
+ import pyepsg
projection = pyepsg.get(code)
if not isinstance(projection, pyepsg.ProjectedCRS):
raise ValueError('EPSG code does not define a projection')
diff --git a/lib/cartopy/tests/io/test_downloaders.py b/lib/cartopy/tests/io/test_downloaders.py
index 4fade4d..c935b41 100644
--- a/lib/cartopy/tests/io/test_downloaders.py
+++ b/lib/cartopy/tests/io/test_downloaders.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -107,6 +107,7 @@ def test_from_config():
assert r is land_downloader
+@pytest.mark.network
def test_downloading_simple_ascii(download_to_temp):
# downloads a file from the Google APIs. (very high uptime and file will
# always be there - if this goes down, most of the internet would break!)
@@ -139,6 +140,7 @@ def test_downloading_simple_ascii(download_to_temp):
assert counter.count == 0, 'Item was re-downloaded.'
+@pytest.mark.network
def test_natural_earth_downloader(tmpdir):
# downloads a file to a temporary location, and uses that temporary
# location, then:
diff --git a/lib/cartopy/tests/io/test_ogc_clients.py b/lib/cartopy/tests/io/test_ogc_clients.py
index 1dc7048..b1d0f3c 100644
--- a/lib/cartopy/tests/io/test_ogc_clients.py
+++ b/lib/cartopy/tests/io/test_ogc_clients.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -41,6 +41,7 @@ from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE
RESOLUTION = (30, 30)
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
class TestWMSRasterSource(object):
URI = 'http://vmap0.tiles.osgeo.org/wms/vmap0'
@@ -144,6 +145,7 @@ class TestWMSRasterSource(object):
assert img.shape == (40, 20, 4)
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
class TestWMTSRasterSource(object):
URI = 'https://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi'
@@ -217,6 +219,7 @@ class TestWMTSRasterSource(object):
assert im2.extent == extent
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
class TestWFSGeometrySource(object):
URI = 'https://nsidc.org/cgi-bin/atlas_south?service=WFS'
diff --git a/lib/cartopy/tests/io/test_srtm.py b/lib/cartopy/tests/io/test_srtm.py
index e998dfc..2f255d2 100644
--- a/lib/cartopy/tests/io/test_srtm.py
+++ b/lib/cartopy/tests/io/test_srtm.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -27,7 +27,8 @@ import cartopy.crs as ccrs
import cartopy.io.srtm
-pytestmark = pytest.mark.skip('SRTM login not supported')
+pytestmark = [pytest.mark.skip('SRTM login not supported'),
+ pytest.mark.network]
class TestRetrieve(object):
diff --git a/lib/cartopy/tests/mpl/test_caching.py b/lib/cartopy/tests/mpl/test_caching.py
index f8da599..dbc367f 100644
--- a/lib/cartopy/tests/mpl/test_caching.py
+++ b/lib/cartopy/tests/mpl/test_caching.py
@@ -76,6 +76,7 @@ class CallCounter(object):
setattr(self.parent, self.function_name, self.orig_fn)
+@pytest.mark.natural_earth
def test_coastline_loading_cache():
# a5caae040ee11e72a62a53100fe5edc355304419 added coastline caching.
# This test ensures it is working.
@@ -99,6 +100,7 @@ def test_coastline_loading_cache():
plt.close()
+@pytest.mark.natural_earth
def test_shapefile_transform_cache():
# a5caae040ee11e72a62a53100fe5edc355304419 added shapefile mpl
# geometry caching based on geometry object id. This test ensures
@@ -185,6 +187,7 @@ def test_contourf_transform_path_counting():
plt.close()
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
def test_wmts_tile_caching():
image_cache = WMTSRasterSource._shared_image_cache
diff --git a/lib/cartopy/tests/mpl/test_crs.py b/lib/cartopy/tests/mpl/test_crs.py
index d0099fa..9076e38 100644
--- a/lib/cartopy/tests/mpl/test_crs.py
+++ b/lib/cartopy/tests/mpl/test_crs.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2013 - 2017, Met Office
+# (C) British Crown Copyright 2013 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -18,11 +18,13 @@
from __future__ import (absolute_import, division, print_function)
import matplotlib.pyplot as plt
+import pytest
import cartopy.crs as ccrs
from cartopy.tests.mpl import ImageTesting
+@pytest.mark.natural_earth
@ImageTesting(['lambert_conformal_south'])
def test_lambert_south():
# Reference image: http://www.icsm.gov.au/mapping/map_projections.html
@@ -33,6 +35,7 @@ def test_lambert_south():
ax.gridlines()
+@pytest.mark.natural_earth
@ImageTesting(['mercator_squashed'])
def test_mercator_squashed():
globe = ccrs.Globe(semimajor_axis=10000, semiminor_axis=9000,
diff --git a/lib/cartopy/tests/mpl/test_examples.py b/lib/cartopy/tests/mpl/test_examples.py
index 59fd1f5..db689e0 100644
--- a/lib/cartopy/tests/mpl/test_examples.py
+++ b/lib/cartopy/tests/mpl/test_examples.py
@@ -18,6 +18,7 @@
from __future__ import (absolute_import, division, print_function)
import matplotlib.pyplot as plt
+import pytest
from cartopy.tests.mpl import MPL_VERSION, ImageTesting
@@ -40,6 +41,7 @@ class ExampleImageTesting(ImageTesting):
return new_fn
+@pytest.mark.natural_earth
@ExampleImageTesting(['global_map'],
tolerance=4 if MPL_VERSION < '2' else 0)
def test_global_map():
diff --git a/lib/cartopy/tests/mpl/test_features.py b/lib/cartopy/tests/mpl/test_features.py
index c675a3b..250e3db 100644
--- a/lib/cartopy/tests/mpl/test_features.py
+++ b/lib/cartopy/tests/mpl/test_features.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -27,6 +27,7 @@ from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE
from cartopy.tests.mpl import MPL_VERSION, ImageTesting
+@pytest.mark.natural_earth
@ImageTesting(['natural_earth'])
def test_natural_earth():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -40,6 +41,7 @@ def test_natural_earth():
ax.set_ylim((-40, 40))
+@pytest.mark.natural_earth
@ImageTesting(['natural_earth_custom'])
def test_natural_earth_custom():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -65,6 +67,7 @@ def test_gshhs():
facecolor='green'), facecolor='blue')
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@ImageTesting(['wfs'])
def test_wfs():
diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py
index d59e639..9fbeba7 100644
--- a/lib/cartopy/tests/mpl/test_gridliner.py
+++ b/lib/cartopy/tests/mpl/test_gridliner.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -33,6 +33,7 @@ from cartopy.mpl.gridliner import LATITUDE_FORMATTER, LONGITUDE_FORMATTER
from cartopy.tests.mpl import MPL_VERSION, ImageTesting
+@pytest.mark.natural_earth
@ImageTesting(['gridliner1'])
def test_gridliner():
ny, nx = 2, 4
@@ -112,6 +113,7 @@ else:
grid_label_image = 'gridliner_labels_pre_mpl_1.5'
+@pytest.mark.natural_earth
@ImageTesting([grid_label_image])
def test_grid_labels():
plt.figure(figsize=(8, 10))
diff --git a/lib/cartopy/tests/mpl/test_images.py b/lib/cartopy/tests/mpl/test_images.py
index b705c8d..105ee80 100644
--- a/lib/cartopy/tests/mpl/test_images.py
+++ b/lib/cartopy/tests/mpl/test_images.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -23,6 +23,7 @@ import types
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
+import pytest
import shapely.geometry as sgeom
from cartopy import config
@@ -43,6 +44,8 @@ REGIONAL_IMG = os.path.join(config['repo_data_dir'], 'raster', 'sample',
# We have an exceptionally large tolerance for the web_tiles test.
# The basemap changes on a regular basis (for seasons) and we really only
# care that it is putting images onto the map which are roughly correct.
+@pytest.mark.natural_earth
+@pytest.mark.network
@ImageTesting(['web_tiles'],
tolerance=12 if MPL_VERSION < '2' else 2.9)
def test_web_tiles():
@@ -78,6 +81,8 @@ def test_web_tiles():
ax.coastlines()
+@pytest.mark.natural_earth
+@pytest.mark.network
@ImageTesting(['image_merge'],
tolerance=3.6 if MPL_VERSION < '2' else 0)
def test_image_merge():
@@ -118,6 +123,7 @@ def test_imshow():
extent=[-180, 180, -90, 90])
+@pytest.mark.natural_earth
@ImageTesting(['imshow_regional_projected'],
tolerance=10.4 if MPL_VERSION < '2' else 0)
def test_imshow_projected():
diff --git a/lib/cartopy/tests/mpl/test_img_transform.py b/lib/cartopy/tests/mpl/test_img_transform.py
index d966cc8..3b53c0a 100644
--- a/lib/cartopy/tests/mpl/test_img_transform.py
+++ b/lib/cartopy/tests/mpl/test_img_transform.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -101,6 +101,7 @@ else:
regrid_tolerance = 0
+@pytest.mark.natural_earth
@ImageTesting(['regrid_image'],
tolerance=regrid_tolerance)
def test_regrid_image():
diff --git a/lib/cartopy/tests/mpl/test_mpl_integration.py b/lib/cartopy/tests/mpl/test_mpl_integration.py
index 1fe91f8..681c9bc 100644
--- a/lib/cartopy/tests/mpl/test_mpl_integration.py
+++ b/lib/cartopy/tests/mpl/test_mpl_integration.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -23,6 +23,7 @@ import warnings
import numpy as np
import matplotlib.pyplot as plt
+import pytest
import six
import cartopy.crs as ccrs
@@ -41,6 +42,7 @@ else:
_STREAMPLOT_IMAGE = 'streamplot_pre_mpl_1.4.3'
+@pytest.mark.natural_earth
@ImageTesting(['global_contour_wrap'])
def test_global_contour_wrap_new_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -50,6 +52,7 @@ def test_global_contour_wrap_new_transform():
plt.contour(x, y, data, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting(['global_contour_wrap'])
def test_global_contour_wrap_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -59,6 +62,7 @@ def test_global_contour_wrap_no_transform():
plt.contour(x, y, data)
+@pytest.mark.natural_earth
@ImageTesting(['global_contourf_wrap'])
def test_global_contourf_wrap_new_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -68,6 +72,7 @@ def test_global_contourf_wrap_new_transform():
plt.contourf(x, y, data, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting(['global_contourf_wrap'])
def test_global_contourf_wrap_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -82,6 +87,7 @@ global_pcolor_wrap = ('global_pcolor_wrap'
'global_pcolor_wrap_pre_mpl_1.4.3')
+@pytest.mark.natural_earth
@ImageTesting([global_pcolor_wrap])
def test_global_pcolor_wrap_new_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -91,6 +97,7 @@ def test_global_pcolor_wrap_new_transform():
plt.pcolor(x, y, data, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting([global_pcolor_wrap])
def test_global_pcolor_wrap_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -100,6 +107,7 @@ def test_global_pcolor_wrap_no_transform():
plt.pcolor(x, y, data)
+@pytest.mark.natural_earth
@ImageTesting(['global_scatter_wrap'])
def test_global_scatter_wrap_new_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -112,6 +120,7 @@ def test_global_scatter_wrap_new_transform():
plt.scatter(x, y, c=data, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting(['global_scatter_wrap'])
def test_global_scatter_wrap_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
@@ -137,6 +146,7 @@ def test_global_map():
transform=ccrs.Geodetic())
+@pytest.mark.natural_earth
@ImageTesting(['simple_global'])
def test_simple_global():
plt.axes(projection=ccrs.PlateCarree())
@@ -144,6 +154,7 @@ def test_simple_global():
# produces a global map, despite not having needed to set the limits
+@pytest.mark.natural_earth
@ImageTesting(['multiple_projections1'])
def test_multiple_projections():
@@ -206,6 +217,7 @@ def test_cursor_values():
plt.close()
+@pytest.mark.natural_earth
@ImageTesting(['natural_earth_interface'], tolerance=_ROB_TOL)
def test_axes_natural_earth_interface():
rob = ccrs.Robinson()
@@ -226,6 +238,7 @@ def test_axes_natural_earth_interface():
assert 'add_feature' in msg
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_global_wrap1'])
def test_pcolormesh_global_with_wrap1():
# make up some realistic data with bounds (such as data from the UM)
@@ -248,6 +261,7 @@ def test_pcolormesh_global_with_wrap1():
ax.set_global() # make sure everything is visible
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_global_wrap2'])
def test_pcolormesh_global_with_wrap2():
# make up some realistic data with bounds (such as data from the UM)
@@ -274,6 +288,7 @@ def test_pcolormesh_global_with_wrap2():
ax.set_global() # make sure everything is visible
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_global_wrap3'], tolerance=_ROB_TOL)
def test_pcolormesh_global_with_wrap3():
nx, ny = 33, 17
@@ -311,6 +326,7 @@ def test_pcolormesh_global_with_wrap3():
ax.set_global() # make sure everything is visible
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_limited_area_wrap'],
tolerance=1.41 if MPL_VERSION >= '2.1.0' else 0.7)
def test_pcolormesh_limited_area_wrap():
@@ -349,6 +365,7 @@ def test_pcolormesh_limited_area_wrap():
ax.coastlines()
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_single_column_wrap'], tolerance=0.7)
def test_pcolormesh_single_column_wrap():
# Check a wrapped mesh like test_pcolormesh_limited_area_wrap, but only use
@@ -371,6 +388,7 @@ def test_pcolormesh_single_column_wrap():
ax.set_global()
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_goode_wrap'])
def test_pcolormesh_goode_wrap():
# global data on an Interrupted Goode Homolosine projection
@@ -385,6 +403,7 @@ def test_pcolormesh_goode_wrap():
ax.pcolormesh(x, y, Z, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_mercator_wrap'])
def test_pcolormesh_mercator_wrap():
x = np.linspace(0, 360, 73)
@@ -397,6 +416,7 @@ def test_pcolormesh_mercator_wrap():
ax.pcolormesh(x, y, Z, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting(['quiver_plate_carree'])
def test_quiver_plate_carree():
x = np.arange(-60, 42.5, 2.5)
@@ -419,6 +439,7 @@ def test_quiver_plate_carree():
ax.quiver(x, y, u, v, mag, transform=ccrs.PlateCarree())
+@pytest.mark.natural_earth
@ImageTesting(['quiver_rotated_pole'])
def test_quiver_rotated_pole():
nx, ny = 22, 36
@@ -443,6 +464,7 @@ def test_quiver_rotated_pole():
ax.quiver(x, y, u, v, mag, transform=rp)
+@pytest.mark.natural_earth
@ImageTesting(['quiver_regrid'])
def test_quiver_regrid():
x = np.arange(-60, 42.5, 2.5)
@@ -460,6 +482,7 @@ def test_quiver_regrid():
regrid_shape=30)
+@pytest.mark.natural_earth
@ImageTesting(['quiver_regrid_with_extent'])
def test_quiver_regrid_with_extent():
x = np.arange(-60, 42.5, 2.5)
@@ -478,6 +501,7 @@ def test_quiver_regrid_with_extent():
regrid_shape=10, target_extent=target_extent)
+@pytest.mark.natural_earth
@ImageTesting(['barbs_plate_carree'])
def test_barbs():
x = np.arange(-60, 45, 5)
@@ -499,6 +523,7 @@ def test_barbs():
ax.barbs(x, y, u, v, transform=ccrs.PlateCarree(), length=4, linewidth=.25)
+@pytest.mark.natural_earth
@ImageTesting(['barbs_regrid'])
def test_barbs_regrid():
x = np.arange(-60, 42.5, 2.5)
@@ -516,6 +541,7 @@ def test_barbs_regrid():
length=4, linewidth=.4, regrid_shape=20)
+@pytest.mark.natural_earth
@ImageTesting(['barbs_regrid_with_extent'])
def test_barbs_regrid_with_extent():
x = np.arange(-60, 42.5, 2.5)
@@ -535,6 +561,7 @@ def test_barbs_regrid_with_extent():
target_extent=target_extent)
+@pytest.mark.natural_earth
@ImageTesting(['barbs_1d'])
def test_barbs_1d():
x = np.array([20., 30., -17., 15.])
@@ -550,6 +577,7 @@ def test_barbs_1d():
length=8, linewidth=1, color='#7f7f7f')
+@pytest.mark.natural_earth
@ImageTesting(['barbs_1d_transformed'])
def test_barbs_1d_transformed():
x = np.array([20., 30., -17., 15.])
@@ -565,6 +593,7 @@ def test_barbs_1d_transformed():
length=8, linewidth=1, color='#7f7f7f')
+@pytest.mark.natural_earth
@ImageTesting([_STREAMPLOT_IMAGE])
def test_streamplot():
x = np.arange(-60, 42.5, 2.5)
diff --git a/lib/cartopy/tests/mpl/test_shapely_to_mpl.py b/lib/cartopy/tests/mpl/test_shapely_to_mpl.py
index f9146ae..f46dde3 100644
--- a/lib/cartopy/tests/mpl/test_shapely_to_mpl.py
+++ b/lib/cartopy/tests/mpl/test_shapely_to_mpl.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -22,6 +22,7 @@ import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.collections import PatchCollection
from matplotlib.path import Path
+import pytest
import shapely.geometry as sgeom
import cartopy.crs as ccrs
@@ -30,6 +31,7 @@ import cartopy.mpl.patch as cpatch
from cartopy.tests.mpl import MPL_VERSION, ImageTesting
+@pytest.mark.natural_earth
@ImageTesting(['poly_interiors'
if MPL_VERSION >= '1.5' else
'poly_interiors_pre_mpl_1.5'])
@@ -83,6 +85,7 @@ def test_polygon_interiors():
ax.add_collection(collection)
+@pytest.mark.natural_earth
@ImageTesting(['contour_with_interiors'])
def test_contour_interiors():
# produces a polygon with multiple holes:
diff --git a/lib/cartopy/tests/mpl/test_ticks.py b/lib/cartopy/tests/mpl/test_ticks.py
index 3ec6844..1397f19 100644
--- a/lib/cartopy/tests/mpl/test_ticks.py
+++ b/lib/cartopy/tests/mpl/test_ticks.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -61,6 +61,7 @@ else:
ticks_tolerance = 0.5
+@pytest.mark.natural_earth
@ImageTesting(['xticks_no_transform' + test_fn_suffix],
tolerance=ticks_tolerance)
def test_set_xticks_no_transform():
@@ -72,6 +73,7 @@ def test_set_xticks_no_transform():
ax.set_xticks([-135, -45, 45, 135], minor=True)
+@pytest.mark.natural_earth
@ImageTesting(['xticks_cylindrical' + test_fn_suffix],
tolerance=ticks_tolerance)
def test_set_xticks_cylindrical():
@@ -95,6 +97,7 @@ def test_set_xticks_non_cylindrical():
plt.close()
+@pytest.mark.natural_earth
@ImageTesting(['yticks_no_transform' + test_fn_suffix],
tolerance=ticks_tolerance)
def test_set_yticks_no_transform():
@@ -106,6 +109,7 @@ def test_set_yticks_no_transform():
ax.set_yticks([-75, -45, 15, 45, 75], minor=True)
+@pytest.mark.natural_earth
@ImageTesting(['yticks_cylindrical' + test_fn_suffix],
tolerance=ticks_tolerance)
def test_set_yticks_cylindrical():
@@ -129,6 +133,7 @@ def test_set_yticks_non_cylindrical():
plt.close()
+@pytest.mark.natural_earth
@ImageTesting(['xyticks' + test_fn_suffix], tolerance=ticks_tolerance)
def test_set_xyticks():
fig = plt.figure(figsize=(10, 10))
diff --git a/lib/cartopy/tests/mpl/test_web_services.py b/lib/cartopy/tests/mpl/test_web_services.py
index 1f50868..07aae88 100644
--- a/lib/cartopy/tests/mpl/test_web_services.py
+++ b/lib/cartopy/tests/mpl/test_web_services.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2014 - 2017, Met Office
+# (C) British Crown Copyright 2014 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -25,6 +25,7 @@ import cartopy.crs as ccrs
from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@ImageTesting(['wmts'], tolerance=7.56 if MPL_VERSION < '2' else 0)
def test_wmts():
@@ -34,6 +35,7 @@ def test_wmts():
ax.add_wmts(url, 'MODIS_Water_Mask')
+@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@ImageTesting(['wms'], tolerance=7.76 if MPL_VERSION < '2' else 0)
def test_wms():
diff --git a/lib/cartopy/tests/test_coastline.py b/lib/cartopy/tests/test_coastline.py
index 7c995cb..d1eb76d 100644
--- a/lib/cartopy/tests/test_coastline.py
+++ b/lib/cartopy/tests/test_coastline.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -17,14 +17,17 @@
from __future__ import (absolute_import, division, print_function)
+import pytest
+
import cartopy
import cartopy.io.shapereader as shp
-COASTLINE_PATH = shp.natural_earth()
-
+@pytest.mark.natural_earth
class TestCoastline(object):
def test_robust(self):
+ COASTLINE_PATH = shp.natural_earth()
+
# Make sure all the coastlines can be projected without raising any
# exceptions.
projection = cartopy.crs.TransverseMercator(central_longitude=-90)
diff --git a/lib/cartopy/tests/test_coding_standards.py b/lib/cartopy/tests/test_coding_standards.py
index 0b0f1de..cfa1cd8 100644
--- a/lib/cartopy/tests/test_coding_standards.py
+++ b/lib/cartopy/tests/test_coding_standards.py
@@ -24,6 +24,8 @@ import os
import re
import subprocess
+import pytest
+
import cartopy
@@ -133,8 +135,8 @@ class TestLicenseHeaders(object):
last_change_by_fname = self.last_change_by_fname()
except ValueError as e:
# Caught the case where this is not a git repo.
- return self.skipTest('cartopy installation did not look like a '
- 'git repo: ' + str(e))
+ return pytest.skip('cartopy installation did not look like a git '
+ 'repo: ' + str(e))
failed = False
for fname, last_change in sorted(last_change_by_fname.items()):
diff --git a/lib/cartopy/tests/test_crs.py b/lib/cartopy/tests/test_crs.py
index a9dc3ff..b54463c 100644
--- a/lib/cartopy/tests/test_crs.py
+++ b/lib/cartopy/tests/test_crs.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -85,6 +85,7 @@ class TestCRS(object):
def test_osgb(self):
self._check_osgb(ccrs.OSGB())
+ @pytest.mark.network
@pytest.mark.skipif(pyepsg is None, reason='requires pyepsg')
def test_epsg(self):
uk = ccrs.epsg(27700)
diff --git a/lib/cartopy/tests/test_img_nest.py b/lib/cartopy/tests/test_img_nest.py
index aac87dd..97ee401 100644
--- a/lib/cartopy/tests/test_img_nest.py
+++ b/lib/cartopy/tests/test_img_nest.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -219,6 +219,7 @@ class RoundedImg(cimg_nest.Img):
@pytest.mark.xfail(reason='MapQuest is unavailable')
+@pytest.mark.network
def test_nest(nest_from_config):
crs = cimgt.GoogleTiles().crs
z0 = cimg_nest.ImageCollection('aerial z0 test', crs)
@@ -365,6 +366,7 @@ def wmts_data():
@pytest.mark.xfail(reason='MapQuest is unavailable')
+@pytest.mark.network
def test_find_images(wmts_data):
z2_dir = os.path.join(_TEST_DATA_DIR, 'z_2')
img_fname = os.path.join(z2_dir, 'x_2_y_0.png')
diff --git a/lib/cartopy/tests/test_img_tiles.py b/lib/cartopy/tests/test_img_tiles.py
index 11efda5..9af3cc9 100644
--- a/lib/cartopy/tests/test_img_tiles.py
+++ b/lib/cartopy/tests/test_img_tiles.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -141,6 +141,7 @@ def test_tile_find_images():
[(7, 4, 4), (7, 5, 4), (8, 4, 4), (8, 5, 4)])
+@pytest.mark.network
def test_image_for_domain():
gt = cimgt.GoogleTiles()
gt._image_url = types.MethodType(GOOGLE_IMAGE_URL_REPLACEMENT, gt)
diff --git a/lib/cartopy/tests/test_shapereader.py b/lib/cartopy/tests/test_shapereader.py
index 0e17fac..895721a 100644
--- a/lib/cartopy/tests/test_shapereader.py
+++ b/lib/cartopy/tests/test_shapereader.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2017, Met Office
+# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
@@ -19,20 +19,17 @@ from __future__ import (absolute_import, division, print_function)
import numpy as np
from numpy.testing import assert_array_almost_equal
+import pytest
import cartopy.io.shapereader as shp
-LAKES_PATH = shp.natural_earth(resolution='110m',
- category='physical',
- name='lakes')
-RIVERS_PATH = shp.natural_earth(resolution='110m',
- category='physical',
- name='rivers_lake_centerlines')
-
-
+@pytest.mark.natural_earth
class TestLakes(object):
def setup_class(self):
+ LAKES_PATH = shp.natural_earth(resolution='110m',
+ category='physical',
+ name='lakes')
self.reader = shp.Reader(LAKES_PATH)
names = [record.attributes['name'] for record in self.reader.records()]
# Choose a nice small lake
@@ -83,8 +80,12 @@ class TestLakes(object):
'The geometry was loaded in order to create the bounds.'
+@pytest.mark.natural_earth
class TestRivers(object):
def setup_class(self):
+ RIVERS_PATH = shp.natural_earth(resolution='110m',
+ category='physical',
+ name='rivers_lake_centerlines')
self.reader = shp.Reader(RIVERS_PATH)
names = [record.attributes['name'] for record in self.reader.records()]
# Choose a nice small river
diff --git a/lib/cartopy/util.py b/lib/cartopy/util.py
index ec181ba..0725e8d 100644
--- a/lib/cartopy/util.py
+++ b/lib/cartopy/util.py
@@ -56,26 +56,33 @@ def add_cyclic_point(data, coord=None, axis=-1):
Adding a cyclic point to a data array, where the cyclic dimension is
the right-most dimension
+ .. testsetup::
+ >>> from distutils.version import LooseVersion
+ >>> import numpy as np
+ >>> if LooseVersion(np.__version__) >= '1.14.0':
+ ... # To provide consistent doctests.
+ ... np.set_printoptions(legacy='1.13')
+
>>> import numpy as np
>>> data = np.ones([5, 6]) * np.arange(6)
>>> cyclic_data = add_cyclic_point(data)
- >>> print(cyclic_data)
- [[0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]]
+ >>> print(cyclic_data) # doctest: +NORMALIZE_WHITESPACE
+ [[ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]]
Adding a cyclic point to a data array and an associated coordinate
>>> lons = np.arange(0, 360, 60)
>>> cyclic_data, cyclic_lons = add_cyclic_point(data, coord=lons)
- >>> print(cyclic_data)
- [[0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]
- [0. 1. 2. 3. 4. 5. 0.]]
+ >>> print(cyclic_data) # doctest: +NORMALIZE_WHITESPACE
+ [[ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]
+ [ 0. 1. 2. 3. 4. 5. 0.]]
>>> print(cyclic_lons)
[ 0 60 120 180 240 300 360]
--
2.14.3

View file

@ -1,26 +0,0 @@
From e3a61e272d5ab58a2b8f13c6ad05d1136d3a5ecc Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Thu, 25 Apr 2024 16:35:29 -0400
Subject: [PATCH 1/2] Reduce numpy build dependency
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyproject.toml b/pyproject.toml
index f0172aac..4e012ede 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,7 @@ requires = [
# Note that building against numpy 1.x works fine too - users and
# redistributors can do this by installing the numpy version they like and
# disabling build isolation.
- "numpy>=2.0.0",
+ "numpy>=1.23",
"setuptools_scm >= 8.0.0",
]
build-backend = "setuptools.build_meta"
--
2.50.0

View file

@ -1,170 +0,0 @@
From d3d4e7a80ded257b3094d837e5133b199989b460 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 26 Feb 2018 02:42:50 -0500
Subject: [PATCH 2/2] Increase tolerance for new FreeType
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/tests/mpl/test_examples.py | 2 +-
lib/cartopy/tests/mpl/test_gridliner.py | 19 +++++++------------
lib/cartopy/tests/mpl/test_mpl_integration.py | 2 +-
lib/cartopy/tests/mpl/test_ticks.py | 14 +++++++++-----
4 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/lib/cartopy/tests/mpl/test_examples.py b/lib/cartopy/tests/mpl/test_examples.py
index a7f64ac9..404d3d83 100644
--- a/lib/cartopy/tests/mpl/test_examples.py
+++ b/lib/cartopy/tests/mpl/test_examples.py
@@ -37,7 +37,7 @@ def test_global_map():
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(
- filename='contour_label.png', tolerance=3.9 if _MPL_38 else 0.5)
+ filename='contour_label.png', tolerance=11.2 if _MPL_38 else 0.5)
def test_contour_label():
from cartopy.tests.mpl.test_caching import sample_data
fig = plt.figure()
diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py
index 66144070..3ff88139 100644
--- a/lib/cartopy/tests/mpl/test_gridliner.py
+++ b/lib/cartopy/tests/mpl/test_gridliner.py
@@ -130,15 +130,10 @@ def test_gridliner_specified_lines():
assert gl.ylocator.tick_values(None, None).tolist() == parallels
-# The tolerance on these tests are particularly high because of the high number
-# of text objects. A new testing strategy is needed for this kind of test.
-grid_label_tol = 3.9
-
-
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename='gridliner_labels.png',
- tolerance=grid_label_tol)
+ tolerance=15.2)
def test_grid_labels():
fig = plt.figure(figsize=(10, 10))
@@ -211,7 +206,7 @@ def test_grid_labels():
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename='gridliner_labels_tight.png',
- tolerance=2.9)
+ tolerance=47.1)
def test_grid_labels_tight():
# Ensure tight layout accounts for gridlines
fig = plt.figure(figsize=(7, 5))
@@ -259,7 +254,7 @@ def test_grid_labels_tight():
@pytest.mark.mpl_image_compare(
filename='gridliner_constrained_adjust_datalim.png',
- tolerance=grid_label_tol)
+ tolerance=46.5)
def test_gridliner_constrained_adjust_datalim():
fig = plt.figure(figsize=(8, 4), layout="constrained")
@@ -293,7 +288,7 @@ def test_gridliner_constrained_adjust_datalim():
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.parametrize('proj', TEST_PROJS)
-@pytest.mark.mpl_image_compare(style='mpl20')
+@pytest.mark.mpl_image_compare(style='mpl20', tolerance=8.36)
def test_grid_labels_inline(proj):
fig = plt.figure()
if isinstance(proj, tuple):
@@ -309,7 +304,7 @@ def test_grid_labels_inline(proj):
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.parametrize('proj', TEST_PROJS)
-@pytest.mark.mpl_image_compare(style='mpl20', tolerance=0.79)
+@pytest.mark.mpl_image_compare(style='mpl20', tolerance=7.76)
def test_grid_labels_inline_usa(proj):
top = 49.3457868 # north lat
left = -124.7844079 # west long
@@ -334,7 +329,7 @@ def test_grid_labels_inline_usa(proj):
@pytest.mark.natural_earth
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.mpl_image_compare(filename='gridliner_labels_bbox_style.png',
- tolerance=grid_label_tol)
+ tolerance=41.5)
def test_gridliner_labels_bbox_style():
top = 49.3457868 # north lat
left = -124.7844079 # west long
@@ -521,7 +516,7 @@ def test_gridliner_save_tight_bbox():
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename='gridliner_labels_title_adjust.png',
- tolerance=grid_label_tol)
+ tolerance=61.3)
def test_gridliner_title_adjust():
# Test that title do not overlap labels
projs = [ccrs.Mercator(), ccrs.AlbersEqualArea(), ccrs.LambertConformal(),
diff --git a/lib/cartopy/tests/mpl/test_mpl_integration.py b/lib/cartopy/tests/mpl/test_mpl_integration.py
index f1aeccdf..78866085 100644
--- a/lib/cartopy/tests/mpl/test_mpl_integration.py
+++ b/lib/cartopy/tests/mpl/test_mpl_integration.py
@@ -1016,7 +1016,7 @@ def test_streamplot():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare()
+@pytest.mark.mpl_image_compare(tolerance=3.96)
def test_annotate():
""" test a variety of annotate options on multiple projections
diff --git a/lib/cartopy/tests/mpl/test_ticks.py b/lib/cartopy/tests/mpl/test_ticks.py
index f75ad2d2..bc0ba0b7 100644
--- a/lib/cartopy/tests/mpl/test_ticks.py
+++ b/lib/cartopy/tests/mpl/test_ticks.py
@@ -10,7 +10,8 @@ from cartopy.mpl.ticker import LatitudeFormatter, LongitudeFormatter
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='xticks_no_transform.png')
+@pytest.mark.mpl_image_compare(filename='xticks_no_transform.png',
+ tolerance=6.71)
def test_set_xticks_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines('110m')
@@ -21,7 +22,8 @@ def test_set_xticks_no_transform():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='xticks_cylindrical.png')
+@pytest.mark.mpl_image_compare(filename='xticks_cylindrical.png',
+ tolerance=7.13)
def test_set_xticks_cylindrical():
ax = plt.axes(projection=ccrs.Mercator(min_latitude=-85, max_latitude=85))
ax.coastlines('110m')
@@ -40,7 +42,8 @@ def test_set_xticks_non_cylindrical():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='yticks_no_transform.png')
+@pytest.mark.mpl_image_compare(filename='yticks_no_transform.png',
+ tolerance=3.75)
def test_set_yticks_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines('110m')
@@ -51,7 +54,8 @@ def test_set_yticks_no_transform():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='yticks_cylindrical.png')
+@pytest.mark.mpl_image_compare(filename='yticks_cylindrical.png',
+ tolerance=4.37)
def test_set_yticks_cylindrical():
ax = plt.axes(projection=ccrs.Mercator(min_latitude=-85, max_latitude=85))
ax.coastlines('110m')
@@ -72,7 +76,7 @@ def test_set_yticks_non_cylindrical():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='xyticks.png')
+@pytest.mark.mpl_image_compare(filename='xyticks.png', tolerance=7.19)
def test_set_xyticks():
fig = plt.figure(figsize=(10, 10))
projections = (ccrs.PlateCarree(),
--
2.50.0

View file

@ -0,0 +1,46 @@
From 21375d8f3488af5d405f5dbba7340cb20a22432b Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 21 Feb 2018 23:47:09 -0500
Subject: [PATCH 2/7] Skip doctest that uses the network.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/io/shapereader.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/lib/cartopy/io/shapereader.py b/lib/cartopy/io/shapereader.py
index f857b38..fae9367 100644
--- a/lib/cartopy/io/shapereader.py
+++ b/lib/cartopy/io/shapereader.py
@@ -24,19 +24,20 @@ geometry representation of shapely:
>>> filename = natural_earth(resolution='110m',
... category='physical',
... name='geography_regions_points')
- >>> reader = shapereader.Reader(filename)
- >>> len(reader)
+ ... # doctest: +SKIP
+ >>> reader = shapereader.Reader(filename) # doctest: +SKIP
+ >>> len(reader) # doctest: +SKIP
3
- >>> records = list(reader.records())
- >>> print(type(records[0]))
+ >>> records = list(reader.records()) # doctest: +SKIP
+ >>> print(type(records[0])) # doctest: +SKIP
<class 'cartopy.io.shapereader.Record'>
- >>> print(sorted(records[0].attributes.keys()))
+ >>> print(sorted(records[0].attributes.keys())) # doctest: +SKIP
['comment', 'featurecla', 'lat_y', 'long_x', 'min_zoom', 'name', \
'name_alt', 'region', 'scalerank', 'subregion']
- >>> print(records[0].attributes['name'])
+ >>> print(records[0].attributes['name']) # doctest: +SKIP
Niagara Falls
- >>> geoms = list(reader.geometries())
- >>> print(type(geoms[0]))
+ >>> geoms = list(reader.geometries()) # doctest: +SKIP
+ >>> print(type(geoms[0])) # doctest: +SKIP
<class 'shapely.geometry.point.Point'>
"""
--
2.14.3

View file

@ -0,0 +1,36 @@
From 4c3cc0ec55edb54de25174e1c534cd7c03281954 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 23 Feb 2018 02:09:01 -0500
Subject: [PATCH 3/7] Add ne_ prefix to NaturalEarth cache files.
This prefix is used in the zip files provided by NaturalEarth, so if you
download anything manually, you need to rename all the files for Cartopy
to find them. This change makes that renaming no longer necessary, at
the expense of a few extra re-downloads.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/io/shapereader.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/cartopy/io/shapereader.py b/lib/cartopy/io/shapereader.py
index fae9367..68471be 100644
--- a/lib/cartopy/io/shapereader.py
+++ b/lib/cartopy/io/shapereader.py
@@ -346,11 +346,11 @@ class NEShpDownloader(Downloader):
>>> ne_dnldr = NEShpDownloader.default_downloader()
>>> print(ne_dnldr.target_path_template)
{config[data_dir]}/shapefiles/natural_earth/{category}/\
-{resolution}_{name}.shp
+ne_{resolution}_{name}.shp
"""
default_spec = ('shapefiles', 'natural_earth', '{category}',
- '{resolution}_{name}.shp')
+ 'ne_{resolution}_{name}.shp')
ne_path_template = os.path.join('{config[data_dir]}', *default_spec)
pre_path_template = os.path.join('{config[pre_existing_data_dir]}',
*default_spec)
--
2.14.3

View file

@ -0,0 +1,71 @@
From 9618c40af668c27dedd83fcc101a99f9573c1b09 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 26 Feb 2018 02:42:50 -0500
Subject: [PATCH 4/7] Increase tolerance for new FreeType.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/tests/mpl/test_gridliner.py | 10 +++++++++-
lib/cartopy/tests/mpl/test_ticks.py | 5 +++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py
index 9fbeba7..3412b2f 100644
--- a/lib/cartopy/tests/mpl/test_gridliner.py
+++ b/lib/cartopy/tests/mpl/test_gridliner.py
@@ -17,7 +17,10 @@
from __future__ import (absolute_import, division, print_function)
+from distutils.version import LooseVersion
+
from matplotlib.backends.backend_agg import FigureCanvasAgg
+import matplotlib.ft2font
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
try:
@@ -111,10 +114,15 @@ elif MPL_VERSION >= '1.5':
grid_label_image = 'gridliner_labels_1.5'
else:
grid_label_image = 'gridliner_labels_pre_mpl_1.5'
+if (MPL_VERSION >= '1.5' and
+ LooseVersion(matplotlib.ft2font.__freetype_version__) >= '2.7'):
+ grid_label_tolerance = 20.3
+else:
+ grid_label_tolerance = 0
@pytest.mark.natural_earth
-@ImageTesting([grid_label_image])
+@ImageTesting([grid_label_image], tolerance=grid_label_tolerance)
def test_grid_labels():
plt.figure(figsize=(8, 10))
diff --git a/lib/cartopy/tests/mpl/test_ticks.py b/lib/cartopy/tests/mpl/test_ticks.py
index 1397f19..33e2b09 100644
--- a/lib/cartopy/tests/mpl/test_ticks.py
+++ b/lib/cartopy/tests/mpl/test_ticks.py
@@ -17,8 +17,10 @@
from __future__ import (absolute_import, division, print_function)
+from distutils.version import LooseVersion
import math
+import matplotlib.ft2font
import matplotlib.pyplot as plt
import matplotlib.ticker
import pytest
@@ -59,6 +61,9 @@ elif '2.0.0' <= MPL_VERSION < '2.0.1':
ticks_tolerance = 9
else:
ticks_tolerance = 0.5
+if (MPL_VERSION >= '1.5' and
+ LooseVersion(matplotlib.ft2font.__freetype_version__) >= '2.7'):
+ ticks_tolerance = max(ticks_tolerance, 6.67)
@pytest.mark.natural_earth
--
2.14.3

View file

@ -0,0 +1,47 @@
From ad04b17fb9751816753d2416ccad05236b41cf1e Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 27 Feb 2018 20:38:49 -0500
Subject: [PATCH 5/7] Normalize grid coordinates used for interpolation.
Most coordinates are in metres and thus fairly large. This can cause
precision issues in Qhull as it calculates distances via squares and
square roots, at least on non-x86_64 architectures.
This is equivalent to the `rescale=True` argument in SciPy, but doing it
ourselves means a) we don't need to bump requirements to 0.14 and b)
re-scaling is not done for every scalar/vector property.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/vector_transform.py | 10 ++++++----
7 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/cartopy/vector_transform.py b/lib/cartopy/vector_transform.py
index 1fe17a1..c684703 100644
--- a/lib/cartopy/vector_transform.py
+++ b/lib/cartopy/vector_transform.py
@@ -56,15 +56,17 @@ def _interpolate_to_grid(nx, ny, x, y, *scalars, **kwargs):
target_extent = kwargs.get('target_extent', None)
if target_extent is None:
target_extent = (x.min(), x.max(), y.min(), y.max())
- points = np.array([x.ravel(), y.ravel()]).T
x0, x1, y0, y1 = target_extent
- x_grid, y_grid = np.meshgrid(np.linspace(x0, x1, nx),
- np.linspace(y0, y1, ny))
+ xr = x1 - x0
+ yr = y1 - y0
+ points = np.column_stack([(x.ravel() - x0) / xr, (y.ravel() - y0) / yr])
+ x_grid, y_grid = np.meshgrid(np.linspace(0, 1, nx),
+ np.linspace(0, 1, ny))
s_grid_tuple = tuple()
for s in scalars:
s_grid_tuple += (griddata(points, s.ravel(), (x_grid, y_grid),
method='linear'),)
- return (x_grid, y_grid) + s_grid_tuple
+ return (x_grid * xr + x0, y_grid * yr + y0) + s_grid_tuple
def vector_scalar_to_grid(src_crs, target_proj, regrid_shape, x, y, u, v,
--
2.14.3

View file

@ -0,0 +1,82 @@
From 49e10df68f0c59f81aa5ec07ead5941db349da6d Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 27 Feb 2018 02:14:00 -0500
Subject: [PATCH 6/7] Increase some tolerances for 32-bit systems.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py | 2 +-
lib/cartopy/tests/mpl/test_examples.py | 2 +-
lib/cartopy/tests/mpl/test_features.py | 2 +-
lib/cartopy/tests/mpl/test_images.py | 2 +-
lib/cartopy/tests/mpl/test_img_transform.py | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py b/lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py
index b6fb853..ca7e235 100644
--- a/lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py
+++ b/lib/cartopy/tests/crs/test_lambert_azimuthal_equal_area.py
@@ -35,7 +35,7 @@ class TestLambertAzimuthalEqualArea(object):
decimal=4)
assert_almost_equal(np.array(crs.y_limits),
[-12727770.598700099, 12727770.598700099],
- decimal=4)
+ decimal=1)
def test_eccentric_globe(self):
globe = ccrs.Globe(semimajor_axis=1000, semiminor_axis=500,
diff --git a/lib/cartopy/tests/mpl/test_examples.py b/lib/cartopy/tests/mpl/test_examples.py
index db689e0..69d4f5a 100644
--- a/lib/cartopy/tests/mpl/test_examples.py
+++ b/lib/cartopy/tests/mpl/test_examples.py
@@ -43,7 +43,7 @@ class ExampleImageTesting(ImageTesting):
@pytest.mark.natural_earth
@ExampleImageTesting(['global_map'],
- tolerance=4 if MPL_VERSION < '2' else 0)
+ tolerance=4 if MPL_VERSION < '2' else 0.05)
def test_global_map():
import cartopy.examples.global_map as c
c.main()
diff --git a/lib/cartopy/tests/mpl/test_features.py b/lib/cartopy/tests/mpl/test_features.py
index 250e3db..f36c344 100644
--- a/lib/cartopy/tests/mpl/test_features.py
+++ b/lib/cartopy/tests/mpl/test_features.py
@@ -54,7 +54,7 @@ def test_natural_earth_custom():
@ImageTesting(['gshhs_coastlines'],
- tolerance=1.7 if MPL_VERSION < '2' else 0)
+ tolerance=1.7 if MPL_VERSION < '2' else 0.07)
def test_gshhs():
ax = plt.axes(projection=ccrs.Mollweide())
ax.set_extent([138, 142, 32, 42], ccrs.Geodetic())
diff --git a/lib/cartopy/tests/mpl/test_images.py b/lib/cartopy/tests/mpl/test_images.py
index 105ee80..119ba7c 100644
--- a/lib/cartopy/tests/mpl/test_images.py
+++ b/lib/cartopy/tests/mpl/test_images.py
@@ -155,7 +155,7 @@ def test_pil_Image():
@ImageTesting(['imshow_natural_earth_ortho'],
- tolerance=4.2 if MPL_VERSION < '2' else 0)
+ tolerance=4.2 if MPL_VERSION < '2' else 0.05)
def test_background_img():
ax = plt.axes(projection=ccrs.Orthographic())
ax.background_img(name='ne_shaded', resolution='low')
diff --git a/lib/cartopy/tests/mpl/test_img_transform.py b/lib/cartopy/tests/mpl/test_img_transform.py
index 3b53c0a..dfea25a 100644
--- a/lib/cartopy/tests/mpl/test_img_transform.py
+++ b/lib/cartopy/tests/mpl/test_img_transform.py
@@ -98,7 +98,7 @@ elif '2.0.1' <= MPL_VERSION:
# Bug in latest Matplotlib that we don't consider correct.
regrid_tolerance = 4.75
else:
- regrid_tolerance = 0
+ regrid_tolerance = 0.03
@pytest.mark.natural_earth
--
2.14.3

View file

@ -0,0 +1,44 @@
From 9792ed5ef9d7db4b0ef8aefb70b11eccc0bdfbcb Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 28 Feb 2018 00:35:24 -0500
Subject: [PATCH 7/7] Increase tolerance for non-x86 systems.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/tests/mpl/test_mpl_integration.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/cartopy/tests/mpl/test_mpl_integration.py b/lib/cartopy/tests/mpl/test_mpl_integration.py
index 681c9bc..1ce5152 100644
--- a/lib/cartopy/tests/mpl/test_mpl_integration.py
+++ b/lib/cartopy/tests/mpl/test_mpl_integration.py
@@ -502,7 +502,7 @@ def test_quiver_regrid_with_extent():
@pytest.mark.natural_earth
-@ImageTesting(['barbs_plate_carree'])
+@ImageTesting(['barbs_plate_carree'], tolerance=0.57)
def test_barbs():
x = np.arange(-60, 45, 5)
y = np.arange(30, 75, 5)
@@ -524,7 +524,7 @@ def test_barbs():
@pytest.mark.natural_earth
-@ImageTesting(['barbs_regrid'])
+@ImageTesting(['barbs_regrid'], tolerance=1.16)
def test_barbs_regrid():
x = np.arange(-60, 42.5, 2.5)
y = np.arange(30, 72.5, 2.5)
@@ -542,7 +542,7 @@ def test_barbs_regrid():
@pytest.mark.natural_earth
-@ImageTesting(['barbs_regrid_with_extent'])
+@ImageTesting(['barbs_regrid_with_extent'], tolerance=0.52)
def test_barbs_regrid_with_extent():
x = np.arange(-60, 42.5, 2.5)
y = np.arange(30, 72.5, 2.5)
--
2.14.3

View file

@ -1,3 +0,0 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 1.11.0.

101
changelog
View file

@ -1,101 +0,0 @@
* Thu Oct 21 2021 Sandro Mani <manisandro@gmail.com> - 0.19.0-4
- Rebuild (geos)
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.19.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.19.0-2
- Rebuilt for Python 3.10
* Thu Apr 22 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.19.0-1
- Update to latest version (#1952194)
* Tue Mar 23 2021 Sandro Mani <manisandro@gmail.com> - 0.19.0~rc1-3
- Rebuild (geos)
* Tue Mar 23 2021 Sandro Mani <manisandro@gmail.com> - 0.19.0~rc1-2
- Bundle proj 7, as cartopy does not build against proj8
* Sat Mar 13 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.19.0~rc1-1
- Update to latest version (#1938248)
* Sun Mar 07 2021 Sandro Mani <manisandro@gmail.com> - 0.18.0-7
- Rebuild (proj)
* Sat Feb 13 2021 Sandro Mani <manisandro@gmail.com> - 0.18.0-6
- Rebuild (geos)
* Sat Jan 30 2021 Jos de Kloe <josdekloe@gmail.com> 0.18.0-5
- Add a patch to fix build failures caused by np.float deprecation
- Modify patch to add more tolerance to image comparisons
- skip test_grid_labels, since it seems to suffer from a bug that is
not yet solved upstream
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Nov 11 13:06:18 CET 2020 Sandro Mani <manisandro@gmail.com> - 0.18.0-4
- Rebuild (proj, gdal)
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.18.0-2
- Rebuilt for Python 3.9
* Mon May 18 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.18.0-1
- Update to latest version
* Fri May 01 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.18.0~rc1-1
- Update to latest release candidate
* Mon Apr 13 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.18.0~b2-1
- Update to latest beta
* Mon Feb 10 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.18.0~b1-1
- Update to latest beta
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.17.0-7
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri May 31 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.17.0-5
- Fix build against FreeType 2.10.0
* Tue Feb 12 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.17.0-4
- Rebuilt for updated Proj
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Dec 06 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.17.0-2
- Remove pytest bytecode
* Sat Nov 17 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.17.0-1
- Update to latest version
- Remove workaround for unpackaged Natural Earth data
- Drop Python 2 subpackage
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jul 11 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-5
- Add explicit gcc-c++ BR
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.16.0-4
- Rebuilt for Python 3.7
* Wed Feb 28 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-3
- Drop patch for old versions of Matplotlib.
- Use python2- prefix for dependencies.
* Sun Feb 25 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-2
- Enable testing with now-packaged Natural Earth data.
* Fri Feb 23 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-1
- Initial package.

View file

@ -1,52 +1,138 @@
%global srcname cartopy
%global Srcname Cartopy
# Some tests use the network.
%bcond_with network
# Natural Earth data may not packaged be yet.
%global test_natural_earth 1
Name: python-%{srcname}
Version: 0.25.0
Release: %autorelease
Version: 0.16.0
Release: 2%{?dist}
Summary: Cartographic Python library with Matplotlib visualisations
License: BSD-3-Clause
URL: https://scitools.org.uk/cartopy/docs/latest/
Source0: %pypi_source %{srcname}
License: LGPLv3
URL: http://scitools.org.uk/cartopy/docs/latest/
Source0: https://files.pythonhosted.org/packages/source/C/%{Srcname}/%{Srcname}-%{version}.tar.gz
# Set location of Fedora-provided pre-existing data.
Source1: siteconfig.py
# Fedora specific.
Patch: 0001-Reduce-numpy-build-dependency.patch
# https://github.com/SciTools/cartopy/pull/1032
Patch0001: 0001-Merge-pull-request-1032-from-QuLogic-test-updates.patch
# Probably won't go upstream.
Patch0002: 0002-Skip-doctest-that-uses-the-network.patch
# https://github.com/SciTools/cartopy/pull/1037
Patch0003: 0003-Add-ne_-prefix-to-NaturalEarth-cache-files.patch
# Might not go upstream in current form.
Patch: 0002-Increase-tolerance-for-new-FreeType.patch
Patch0004: 0004-Increase-tolerance-for-new-FreeType.patch
# https://github.com/SciTools/cartopy/pull/1042
Patch0005: 0005-Normalize-grid-coordinates-used-for-interpolation.patch
Source5: %{Srcname}-norm-images.tar.xz
# Might not go upstream.
Patch0006: 0006-Increase-some-tolerances-for-32-bit-systems.patch
# Due to https://github.com/matplotlib/matplotlib/issues/7797; not necessary
# with Matplotlib 2.1.0.
Patch0007: 0007-Increase-tolerance-for-non-x86-systems.patch
# See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch: %{ix86}
BuildRequires: geos-devel >= 3.3.3
BuildRequires: proj-devel >= 4.9.0
BuildRequires: gcc-c++
BuildRequires: proj-data-uk
BuildRequires: python3-devel
%global _description %{expand:
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
%global _description \
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
}
%description %{_description}
%package -n python3-%{srcname}
%package -n python2-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{srcname}}
BuildRequires: python2-devel
BuildRequires: python2-setuptools >= 0.7.2
BuildRequires: python2-Cython >= 0.15.1
BuildRequires: python2-six >= 1.3.0
BuildRequires: python2-numpy >= 1.6
BuildRequires: python-shapely >= 1.5.6
BuildRequires: python2-pyshp >= 1.1.4
# OWS requirements
BuildRequires: python-OWSLib >= 0.8.11
BuildRequires: python2-pillow >= 1.7.8
# Plotting requirements
BuildRequires: python2-matplotlib >= 1.3.0
BuildRequires: gdal-python >= 1.10.0
BuildRequires: python2-pillow >= 1.7.8
BuildRequires: python2-scipy >= 0.10
# Testing requirements
BuildRequires: python2-mock >= 1.0.1
BuildRequires: python2-pytest >= 3.0.0
%if %{fedora} < 28
# For old matplotlib
BuildRequires: python2-nose
%endif
Requires: python-%{srcname}-common = %{version}-%{release}
Recommends: python3dist(cartopy[ows]) = %{version}-%{release}
Recommends: python3dist(cartopy[plotting]) = %{version}-%{release}
Recommends: python3dist(cartopy[speedups]) = %{version}-%{release}
Requires: python2-six >= 1.3.0
Requires: python2-numpy >= 1.6
Requires: python-shapely >= 1.5.6
Requires: python2-pyshp >= 1.1.4
Requires: python2-setuptools >= 0.7.2
# OWS requirements
Recommends: python-OWSLib >= 0.8.11
Recommends: python2-pillow >= 1.7.8
# Plotting requirements
Recommends: python2-matplotlib >= 1.3.0
Recommends: gdal-python >= 1.10.0
Recommends: python2-pillow >= 1.7.8
Recommends: python2-scipy >= 0.10
%description -n python2-%{srcname} %{_description}
%package -n python3-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{srcname}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython >= 0.15.1
BuildRequires: python3-six >= 1.3.0
BuildRequires: python3-numpy >= 1.6
BuildRequires: python3-shapely >= 1.5.6
BuildRequires: python3-pyshp >= 1.1.4
# OWS requirements
BuildRequires: python3-OWSLib >= 0.8.11
BuildRequires: python3-pillow >= 1.7.8
# Plotting requirements
BuildRequires: python3-matplotlib >= 1.3.0
BuildRequires: gdal-python3 >= 1.10.0
BuildRequires: python3-pillow >= 1.7.8
BuildRequires: python3-scipy >= 0.10
# Testing requirements
BuildRequires: python3-mock >= 1.0.1
BuildRequires: python3-pytest >= 3.0.0
%if %{fedora} < 28
# For old matplotlib
BuildRequires: python3-nose
%endif
Requires: python-%{srcname}-common = %{version}-%{release}
Requires: python3-setuptools >= 0.7.2
Requires: python3-six >= 1.3.0
Requires: python3-numpy >= 1.6
Requires: python3-shapely >= 1.5.6
Requires: python3-pyshp >= 1.1.4
# OWS requirements
Recommends: python3-OWSLib >= 0.8.11
Recommends: python3-pillow >= 1.7.8
# Plotting requirements
Recommends: python3-matplotlib >= 1.3.0
Recommends: gdal-python3 >= 1.10.0
Recommends: python3-pillow >= 1.7.8
Recommends: python3-scipy >= 0.10
%description -n python3-%{srcname} %{_description}
@ -55,8 +141,10 @@ Recommends: python3dist(cartopy[speedups]) = %{version}-%{release}
Summary: Data files for %{srcname}
BuildArch: noarch
%if 0%{?test_natural_earth}
BuildRequires: natural-earth-map-data-110m
BuildRequires: natural-earth-map-data-50m
%endif
Recommends: natural-earth-map-data-110m
Suggests: natural-earth-map-data-50m
@ -66,31 +154,29 @@ Suggests: natural-earth-map-data-10m
Data files for %{srcname}.
%pyproject_extras_subpkg -n python3-cartopy ows plotting speedups
%prep
%autosetup -n %{srcname}-%{version} -p1
%autosetup -n %{Srcname}-%{version} -p1
cp -a %SOURCE1 lib/cartopy/
%setup -q -n %{Srcname}-%{version} -D -T -a 5
sed -i -e 's/, "pytest-cov", "coveralls"//g' pyproject.toml
# Remove generated Cython sources
rm lib/cartopy/trace.cpp
%generate_buildrequires
%pyproject_buildrequires -r -x ows,plotting,speedups,test
# Remove bundled egg-info
rm -rf %{srcname}.egg-info
%build
export FORCE_CYTHON=1 SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_wheel
%py2_build
# Purge generated Cython files.
rm -f lib/cartopy/trace.cpp lib/cartopy/trace.pyd
rm -f lib/cartopy/_crs.c lib/cartopy/_crs.pyd
rm -f lib/cartopy/geodesic/_geodesic.c lib/cartopy/geodesic/_geodesic.pyd
%py3_build
%install
%pyproject_install
%pyproject_save_files -l %{srcname}
%py3_install
%py2_install
mkdir -p %{buildroot}%{_datadir}/cartopy/shapefiles/natural_earth/
for theme in physical cultural; do
@ -100,22 +186,29 @@ done
%check
MPLBACKEND=Agg \
%{pytest} -n auto --doctest-modules --mpl --mpl-generate-summary=html --pyargs cartopy \
%if %{with network}
%{nil}
%else
-m "not network"
%endif
PYTHONPATH="%{buildroot}%{python2_sitearch}" MPLBACKEND=Agg \
pytest-2 --doctest-modules --pyargs cartopy -m "not network%{!?test_natural_earth: and not natural_earth}"
PYTHONPATH="%{buildroot}%{python3_sitearch}" MPLBACKEND=Agg \
pytest-3 --doctest-modules --pyargs cartopy -m "not network%{!?test_natural_earth: and not natural_earth}"
%files -n python-%{srcname}-common
%doc README.md
%doc README.rst
%license COPYING.LESSER lib/cartopy/data/LICENSE
%{_datadir}/cartopy/
%files -n python3-%{srcname} -f %{pyproject_files}
%{_bindir}/cartopy_feature_download
%files -n python2-%{srcname}
%{python2_sitearch}/cartopy
%{python2_sitearch}/%{Srcname}-%{version}-py?.?.egg-info
%files -n python3-%{srcname}
%{python3_sitearch}/cartopy
%{python3_sitearch}/%{Srcname}-%{version}-py?.?.egg-info
%changelog
%autochangelog
* Sun Feb 25 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-2
- Enable testing with now-packaged Natural Earth data.
* Fri Feb 23 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-1
- Initial package.

View file

@ -1,7 +1,9 @@
from pathlib import Path
from __future__ import (absolute_import, division, print_function)
import os
def update_config(conf):
# This works when installed and when in buildroot.
conf['pre_existing_data_dir'] = str(
Path(__file__).parents[4] / 'share/cartopy')
conf['pre_existing_data_dir'] = os.path.join(os.path.dirname(__file__),
'../../../../share/cartopy')

View file

@ -1 +1,2 @@
SHA512 (cartopy-0.25.0.tar.gz) = 6e0576f87dbd154d7dec3c2bbec520d1602874e6b416ca6e461745ceb319dc0f38a53267ad0b1f73bcd0d81674151324c07b7a799fb0a3ad590d1a27c98b3ae7
SHA512 (Cartopy-0.16.0.tar.gz) = aaef27eda5a31b49361a014156ac6f6cf92b7ea84356f342afc1b7f818162537ea6447cf1af4799196482bc811aba8cb3db3044d8a2fa501c327fee079205c44
SHA512 (Cartopy-norm-images.tar.xz) = bfea8ab2045e89acd2e4cff45fecee5baf6efdc41b90cf160c931e90c0e41b35ea553ccf8d36e9ae9009157a99c7eb4a0054e6301948d40b045ce0a880105f40