From 2b0fb8dc703719ab3bc4a7ed608cf6eac8302460 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Feb 22 2020 06:38:10 +0000 Subject: Update to latest release candidate. --- diff --git a/.gitignore b/.gitignore index 465f763..0376a4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /contextily-0.99.0.tar.gz +/contextily-1.0~rc2.tar.gz diff --git a/52.patch b/52.patch deleted file mode 100644 index b269f1b..0000000 --- a/52.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 5dd83276826313fe4fd06745ac1fce3811b40cd7 Mon Sep 17 00:00:00 2001 -From: Dani Arribas-Bel -Date: Fri, 18 Jan 2019 10:34:27 -0400 -Subject: [PATCH] Merge pull request #52 from jorisvandenbossche/searchsorted - -COMPAT: use numpy searchsorted -Signed-off-by: Elliott Sales de Andrade ---- - README.md | 1 - - contextily/tile.py | 17 ++++++++--------- - requirements.txt | 1 - - 3 files changed, 8 insertions(+), 11 deletions(-) - -diff --git a/README.md b/README.md -index 3672151..4c233a4 100644 ---- a/README.md -+++ b/README.md -@@ -24,7 +24,6 @@ the internet into geospatial raster files. Bounding boxes can be passed in both - * `cartopy` - * `mercantile` - * `numpy` --* `pandas` - * `pillow` - * `rasterio` - * `six` -diff --git a/contextily/tile.py b/contextily/tile.py -index bffeb84..67d081d 100644 ---- a/contextily/tile.py -+++ b/contextily/tile.py -@@ -7,7 +7,6 @@ from six.moves.urllib.request import urlopen - import six - from PIL import Image - import numpy as np --import pandas as pd - import rasterio as rio - from rasterio.transform import from_origin - from . import tile_providers as sources -@@ -196,14 +195,14 @@ def bb2wdw(bb, rtr): - ((row_start, row_stop), (col_start, col_stop)) - ''' - rbb = rtr.bounds -- xi = pd.Series(np.linspace(rbb.left, rbb.right, rtr.shape[1])) -- yi = pd.Series(np.linspace(rbb.bottom, rbb.top, rtr.shape[0])) -- -- window = ((rtr.shape[0] - yi.searchsorted(bb[3])[0], -- rtr.shape[0] - yi.searchsorted(bb[1])[0]), -- (xi.searchsorted(bb[0])[0], -- xi.searchsorted(bb[2])[0]) -- ) -+ xi = np.linspace(rbb.left, rbb.right, rtr.shape[1]) -+ yi = np.linspace(rbb.bottom, rbb.top, rtr.shape[0]) -+ -+ window = ((rtr.shape[0] - yi.searchsorted(bb[3]), -+ rtr.shape[0] - yi.searchsorted(bb[1])), -+ (xi.searchsorted(bb[0]), -+ xi.searchsorted(bb[2])) -+ ) - return window - - def _sm2ll(x, y): -diff --git a/requirements.txt b/requirements.txt -index 7c02b09..62aa9f0 100644 ---- a/requirements.txt -+++ b/requirements.txt -@@ -1,7 +1,6 @@ - cartopy - geopy - mercantile --pandas - pillow - pytest - rasterio --- -2.21.1 - diff --git a/dc6746f4499bd46750e96da6b534d23f13e7be65.patch b/dc6746f4499bd46750e96da6b534d23f13e7be65.patch new file mode 100644 index 0000000..56d1d63 --- /dev/null +++ b/dc6746f4499bd46750e96da6b534d23f13e7be65.patch @@ -0,0 +1,86 @@ +From dc6746f4499bd46750e96da6b534d23f13e7be65 Mon Sep 17 00:00:00 2001 +From: Andy Eschbacher +Date: Sat, 7 Sep 2019 06:31:10 -0400 +Subject: [PATCH] updates example to work with renamed function (#98) + +* updates example to work with renamed function + +* Change test for add_basemap to accommodate errors after apparent change in stament tiles + +* Replace assert for assert_array_almost_equal in test_warp_tiles +--- + examples/plot_map.py | 3 +-- + tests/test_ctx.py | 29 +++++++++++++++-------------- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/examples/plot_map.py b/examples/plot_map.py +index 67d8012..5ab0249 100644 +--- a/examples/plot_map.py ++++ b/examples/plot_map.py +@@ -46,8 +46,7 @@ + # You can also grab tile information directly from a bounding box + zoom level. + # This is demoed below: + +-zoom = ctx.calculate_zoom(loc.w, loc.s, loc.e, loc.n) +-im2, bbox = ctx.bounds2img(loc.w, loc.s, loc.e, loc.n, zoom=zoom, ll=True) ++im2, bbox = ctx.bounds2img(loc.w, loc.s, loc.e, loc.n, zoom=loc.zoom, ll=True) + ctx.plot_map(im2, bbox, ax=axs[2], title="Boulder, CO") + + plt.show() +diff --git a/tests/test_ctx.py b/tests/test_ctx.py +index d6e130b..3628dee 100644 +--- a/tests/test_ctx.py ++++ b/tests/test_ctx.py +@@ -95,12 +95,13 @@ def test_warp_tiles(): + ) + img, ext = ctx.bounds2img(w, s, e, n, zoom=4, ll=True) + wimg, wext = ctx.warp_tiles(img, ext) +- assert wext == ( +- -112.54394531249996, +- -90.07903186397023, +- 21.966726124122374, +- 41.013065787006276, +- ) ++ assert_array_almost_equal(np.array(wext), \ ++ np.array([-112.54394531249996, ++ -90.07903186397023, ++ 21.966726124122374, ++ 41.013065787006276 ++ ]) ++ ) + assert wimg[100, 100, :].tolist() == [228, 221, 184] + assert wimg[100, 200, :].tolist() == [213, 219, 177] + assert wimg[200, 100, :].tolist() == [133, 130, 109] +@@ -247,9 +248,9 @@ def test_add_basemap(): + ax_extent = (x1, x2, y1, y2) + assert ax.axis() == ax_extent + +- assert ax.images[0].get_array().sum() == 75853866 +- assert ax.images[0].get_array().shape == (256, 512, 3) +- assert_array_almost_equal(ax.images[0].get_array().mean(), 192.90635681152344) ++ assert ax.images[0].get_array().sum() == 34840247 ++ assert ax.images[0].get_array().shape == (256, 256, 3) ++ assert_array_almost_equal(ax.images[0].get_array().mean(), 177.20665995279947) + + # Test local source + f, ax = matplotlib.pyplot.subplots(1) +@@ -277,14 +278,14 @@ def test_add_basemap(): + + ax_extent = ( + -11740727.544603072, +- -11691807.846500559, +- 4852834.0517692715, ++ -11701591.786121061, ++ 4852834.051769271, + 4891969.810251278, + ) + assert_array_almost_equal(ax_extent, ax.images[0].get_extent()) +- assert ax.images[0].get_array().sum() == 723918764 +- assert ax.images[0].get_array().shape == (1024, 1280, 3) +- assert_array_almost_equal(ax.images[0].get_array().mean(), 184.10206197102863) ++ assert ax.images[0].get_array().sum() == 563185119 ++ assert ax.images[0].get_array().shape == (1024, 1024, 3) ++ assert_array_almost_equal(ax.images[0].get_array().mean(), 179.03172779083252) + + # Test on-th-fly warping + x1, x2 = -105.5, -105.00 diff --git a/python-contextily.spec b/python-contextily.spec index c9021f3..95fdebb 100644 --- a/python-contextily.spec +++ b/python-contextily.spec @@ -1,31 +1,32 @@ %global srcname contextily +%global version_ 1.0rc2 # Some tests require the network. %bcond_with network Name: python-%{srcname} -Version: 0.99.0 +Version: 1.0~rc2 Release: 1%{?dist} Summary: Context geo-tiles in Python License: BSD URL: https://github.com/darribas/contextily -Source0: %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz -# Fix break due to Pandas change; remove Pandas as dep. -Patch0001: https://github.com/darribas/contextily/pull/52.patch +Source0: %{url}/archive/v%{version_}/%{srcname}-%{version}.tar.gz +# Fix tests https://github.com/darribas/contextily/pull/98 +Patch0001: https://github.com/darribas/contextily/commit/dc6746f4499bd46750e96da6b534d23f13e7be65.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(setuptools) -BuildRequires: python3dist(cartopy) BuildRequires: python3dist(geopy) +BuildRequires: python3dist(joblib) BuildRequires: python3dist(matplotlib) BuildRequires: python3dist(mercantile) BuildRequires: python3dist(pillow) BuildRequires: python3dist(pytest) BuildRequires: python3dist(rasterio) -BuildRequires: python3dist(six) +BuildRequires: python3dist(requests) %description contextily is a small Python 3 package to retrieve and write to disk tile maps @@ -44,7 +45,7 @@ both WGS84 (EPSG:4326) and Spheric Mercator (EPSG:3857). %prep -%autosetup -n %{srcname}-%{version} -p1 +%autosetup -n %{srcname}-%{version_} -p1 # Remove bundled egg-info rm -rf %{srcname}.egg-info @@ -59,15 +60,31 @@ rm -rf %{srcname}.egg-info %if %{with network} pytest-3 %else -pytest-3 -k 'not test_bounds2raster and not test_bounds2img and not test_ll2wdw and not test_place and not test_plot_map' tests/test_ctx.py +pytest-3 \ + -k 'not test_add_basemap and \ + not test_basemap_attribution and \ + not test_bounds2img and \ + not test_bounds2raster and \ + not test_ll2wdw and \ + not test_place and \ + not test_plot_map and \ + not test_warp_img_transform and \ + not test_warp_tiles' \ + tests/test_ctx.py +pytest-3 \ + -k 'test_providers_callable or test_invalid_provider or test_provider_attribute_access' \ + tests/test_providers.py %endif %files -n python3-%{srcname} %license LICENSE.txt %doc README.md %{python3_sitelib}/%{srcname} -%{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info +%{python3_sitelib}/%{srcname}-%{version_}-py*.egg-info %changelog +* Sat Feb 22 2020 Elliott Sales de Andrade - 1.0~rc2-1 +- Update to latest release candidate + * Fri Feb 14 2020 Elliott Sales de Andrade - 0.99.0-1 - Initial package. diff --git a/sources b/sources index 1a4c8c3..fb7df41 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (contextily-0.99.0.tar.gz) = f60a02c291076e45c158fc3b61b3a51e2782c3f7deb08c2e52f19f23980a0fd92871ab00170cae30717a340fe4386d25bf64ece99c796bb5d6cf61918c331273 +SHA512 (contextily-1.0~rc2.tar.gz) = 01f573196b7c9ca89bf4d917a93612266c7bf69b9d1c52b7cc22190be3960145cb7ffd8c71be926e586498e187585eca9d581129a1c41112f4c32f3970bd12a2