From 635b42dabd5acaabc695934e1b22b00173a08c36 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Tue, 30 Aug 2022 21:57:11 -0600 Subject: [PATCH 1/3] DOC: What's new for v0.21 release --- docs/source/whatsnew/index.rst | 1 + docs/source/whatsnew/v0.21.rst | 133 +++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 docs/source/whatsnew/v0.21.rst diff --git a/docs/source/whatsnew/index.rst b/docs/source/whatsnew/index.rst index 3900f5611..092470fa9 100644 --- a/docs/source/whatsnew/index.rst +++ b/docs/source/whatsnew/index.rst @@ -14,6 +14,7 @@ Versions .. toctree:: :maxdepth: 2 + v0.21 v0.20 v0.19 v0.18 diff --git a/docs/source/whatsnew/v0.21.rst b/docs/source/whatsnew/v0.21.rst new file mode 100644 index 000000000..359c913ef --- /dev/null +++ b/docs/source/whatsnew/v0.21.rst @@ -0,0 +1,133 @@ +Version 0.21 (September XXX, 2022) +================================== + +For a full list of included Pull Requests and closed Issues, please see the +`0.21 milestone `_. + +Features +-------- + +* The requirement to install with a local PROJ installation has been removed. + The previous C PROJ library calls have been replaced by pyproj. + (:pull:`2069`) + +* Many test improvements, including moving to pytest-mpl for image comparisons + and parametrizing many tests where possible. + (:pull:`1887`, :pull:`1891`, :pull:`1900`) + +* The UTF8 degree symbol is now used for latitude and longitude labels. + (:pull:`1885`) + +* Clément fixed an issue that would ignore the alpha channel when + reprojecting RGBA images. (:pull:`1906`) + + .. plot:: + :width: 400pt + + import matplotlib.pyplot as plt + import numpy as np + import cartopy.crs as ccrs + + dy, dx = (4, 10) + rgba = np.linspace(0, 255*31, dx*dy*4, dtype=np.uint8).reshape((dy, dx, 4)) + rgba[:, :, 3] = np.linspace(0, 255, dx, dtype=np.uint8).reshape(1, dx) + + fig = plt.figure(figsize=(10, 5)) + ax = plt.axes(projection=ccrs.Orthographic(central_latitude=45)) + ax.imshow(rgba, transform=ccrs.PlateCarree()) + + plt.show() + +* Filled features no longer set the edgecolor by default. The edgecolor can + still be explicitly set when adding the feature + ``ax.add_feature(LAND, edgecolor='k')``. (:pull:`1933`) + +* The **approx** keyword to TransverseMercator, OSGB, and OSNI projections + now defaults to False. (:pull:`1957`) + +* ``geoaxes.add_geometries()`` now accepts both a list of geometries and a + single geometry. (:pull:`1999`) + +* Better handling of non-ndarray inputs like ``xarray.DataArray``. + (:pull:`2050`) + +* Alan Brammer added the ability to pass CRS's for the text and xy coordinates + used in ``ax.annotate()``. (:pull:`2065`) + + .. plot:: + :width: 400pt + + import matplotlib.pyplot as plt + import numpy as np + import cartopy.crs as ccrs + + map_projection = ccrs.InterruptedGoodeHomolosine() + + fig = plt.figure(figsize=(10, 5)) + ax = fig.add_subplot(1, 1, 1, projection=map_projection) + ax.set_global() + ax.coastlines() + arrowprops = {'facecolor': 'red', + 'arrowstyle': "-|>", + 'connectionstyle': "arc3,rad=-0.2", + } + platecarree = ccrs.PlateCarree() + mpltransform = platecarree._as_mpl_transform(ax) + + ax.annotate('mpl xycoords', (-45, 43), xycoords=mpltransform, + size=5) + + # Add annotation with xycoords as projection + ax.annotate('crs xycoords', (-75, 13), xycoords=platecarree, + size=5) + + # set up coordinates in map projection space + map_coords = map_projection.transform_point(-175, -35, platecarree) + # Dont specifiy any args, default xycoords='data', transform=map projection + ax.annotate('default crs', map_coords, size=5) + + # data in map projection using default transform, with + # text positioned in platecaree transform + ax.annotate('mixed crs transforms', map_coords, xycoords='data', + xytext=(-175, -55), + textcoords=platecarree, + size=5, + arrowprops=arrowprops, + ) + + # Add annotation with point and text via transform + ax.annotate('crs transform', (-75, -20), xytext=(0, -55), + transform=platecarree, + arrowprops=arrowprops, + ) + + # Add annotation with point via transform and text non transformed + ax.annotate('offset textcoords', (-149.8, 61.22), transform=platecarree, + xytext=(-35, 10), textcoords='offset points', + size=5, + ha='right', + arrowprops=arrowprops, + ) + + plt.show() + +Deprecations +------------ + +* Passing **map_projection** as a keyword when manually creating a GeoAxes + object is deprecated, use **projection** instead. + +Removals +-------- + +The following functions and classes have been removed after being deprecated +multiple versions prior. See the previous What's New notes for replacements. + +* ``geoaxes.outline_patch()`` +* ``geoaxes.background_patch()`` +* ``geoaxes.natural_earth_shp()`` +* The argument ``secant_latitudes`` to the LambertConformal projection. +* ``img_tiles.StamenTerrain`` +* ``srtm.SRTM3_retrieve``, ``srtm.srtm``, ``srtm.srtm_composite``, and + ``srtm.fill_gaps`` +* ``clip_path.clip_path`` From 9f1850e0f58a97ace698585b1ff7b5c593542f43 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Fri, 2 Sep 2022 08:04:41 -0600 Subject: [PATCH 2/3] DOC: Add %s format string to extlinks --- docs/source/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 68ab32a50..4ce7e7456 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -371,10 +371,10 @@ ############ extlinks extension ############ extlinks = {'issues': ('https://github.com/SciTools/cartopy/labels/%s', - 'issues labeled with '), + 'issues labeled with %s'), 'issue': ('https://github.com/SciTools/cartopy/issues/%s', - 'Issue #'), - 'pull': ('https://github.com/SciTools/cartopy/pull/%s', 'PR #'), + 'Issue #%s'), + 'pull': ('https://github.com/SciTools/cartopy/pull/%s', 'PR #%s'), } From ad1ec1a4b901556a2111d6f87dbd09d9b4f920a2 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Thu, 8 Sep 2022 15:53:08 -0600 Subject: [PATCH 3/3] DEP: Pin to shapely versions less than 2 Shapely v2+ changes the C API access, so pin to earlier versions until this is fixed. --- .circleci/config.yml | 2 +- .github/workflows/ci-testing.yml | 4 ++-- .github/workflows/release.yml | 2 +- INSTALL | 4 ++-- docs/source/whatsnew/v0.21.rst | 7 +++++-- environment.yml | 4 ++-- requirements/default.txt | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c2fff434..476a13c84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,7 +45,7 @@ deps-run: &deps-install pyshp \ scipy \ setuptools_scm \ - shapely \ + 'shapely<2' \ $EXTRA_PACKAGES \ --file docs/doc-requirements.txt conda list -n test-environment diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 54f987f6b..8ff698b72 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -35,7 +35,7 @@ jobs: - name: Latest packages if: steps.minimum-packages.conclusion == 'skipped' run: | - echo "PACKAGES=cython fiona matplotlib-base numpy pyproj pykdtree scipy shapely" >> $GITHUB_ENV + echo "PACKAGES=cython fiona matplotlib-base numpy pyproj pykdtree scipy shapely<2" >> $GITHUB_ENV - name: Coverage packages id: coverage @@ -49,7 +49,7 @@ jobs: - name: Install dependencies run: | PACKAGES="$PACKAGES owslib pep8 pillow pyshp pytest pytest-mpl!=0.16.0" - PACKAGES="$PACKAGES pytest-xdist setuptools_scm shapely" + PACKAGES="$PACKAGES pytest-xdist setuptools_scm shapely<2" conda install $PACKAGES conda info -a conda list diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32f4f87c7..5a4b0f594 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: run: | PACKAGES="cython fiona matplotlib-base numpy pyproj pykdtree scipy" PACKAGES="$PACKAGES owslib pep8 pillow pyshp pytest" - PACKAGES="$PACKAGES pytest-xdist setuptools_scm shapely" + PACKAGES="$PACKAGES pytest-xdist setuptools_scm shapely<2" conda install $PACKAGES - name: Create sdist diff --git a/INSTALL b/INSTALL index 4b6346d71..2562b4209 100644 --- a/INSTALL +++ b/INSTALL @@ -85,7 +85,7 @@ For macOS, the required dependencies can be installed in the following way:: pip3 install --upgrade pyshp # shapely needs to be built from source to link to geos. If it is already # installed, uninstall it by: pip3 uninstall shapely - pip3 install shapely --no-binary shapely + pip3 install "shapely<2" --no-binary shapely Still on macOS, make sure you have installed pkg-config and set the `PKG_CONFIG_PATH` environment variable as follows:: @@ -117,7 +117,7 @@ Further information about the required dependencies can be found here: GEOS is an API of spatial predicates and functions for processing geometry written in C++. -**Shapely** 1.6.4 or later (https://github.com/Toblerity/Shapely) +**Shapely** between 1.6.4 and 1.8.4 (https://github.com/Toblerity/Shapely) Python package for the manipulation and analysis of planar geometric objects. diff --git a/docs/source/whatsnew/v0.21.rst b/docs/source/whatsnew/v0.21.rst index 359c913ef..cb0a3c372 100644 --- a/docs/source/whatsnew/v0.21.rst +++ b/docs/source/whatsnew/v0.21.rst @@ -1,5 +1,8 @@ -Version 0.21 (September XXX, 2022) -================================== +Version 0.21 (September 9, 2022) +================================ + +Cartopy v0.21 is not compatible with Shapely 2.0, so this release +has an upper pin on Shapely to avoid installing newer versions. For a full list of included Pull Requests and closed Issues, please see the `0.21 milestone `_. diff --git a/environment.yml b/environment.yml index 2d5798a78..3490886f3 100644 --- a/environment.yml +++ b/environment.yml @@ -4,13 +4,13 @@ # conda activate cartopy-dev # pip install -e . # -name: cartopy-dev +name: cartopy-dev2 channels: - conda-forge dependencies: - cython>=0.28.5 - numpy>=1.18 - - shapely>=1.6.4 + - shapely>=1.6.4,<2 - geos>=3.7.2 - pyshp>=2.1 - pyproj>=3.0.0 diff --git a/requirements/default.txt b/requirements/default.txt index 861450c3c..45c3493cf 100644 --- a/requirements/default.txt +++ b/requirements/default.txt @@ -1,5 +1,5 @@ numpy>=1.18 matplotlib>=3.1 -shapely>=1.6.4 +shapely>=1.6.4,<2 pyshp>=2.1 pyproj>=3.0.0