diff --git a/.coveragerc b/.coveragerc index dca8943f1..5db96e16b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,7 +4,7 @@ [run] branch = True -omit = +omit = lib/cartopy/examples/* lib/cartopy/sphinxext/* lib/cartopy/tests/* diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..ddf9436fb --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# style: start of pre-commit and whitespace fixes +16aba40dd09fb95c85fac1a0bee0f795b9f8b5fe diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d5a555de4..a3417deeb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -16,7 +16,7 @@ Getting started 1. Fork the Cartopy repository, create your new fix/feature branch, and start committing code. We broadly follow the [gitwash guidelines](https://matthew-brett.github.io/pydagogue/gitwash/git_development.html). 1. Remember to add appropriate documentation and tests to supplement any new or changed functionality. -1. If you're not already on it (and would like to be), please add yourself to the +1. If you're not already on it (and would like to be), please add yourself to the contributors list (docs/source/contributors.rst) @@ -29,4 +29,3 @@ Submitting changes 1. Push your branch to your fork of cartopy. 1. Submit your pull request. 1. Sit back and wait for the core Cartopy development team to review your code. - diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9b36be1bd..ca7fbb587 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -17,7 +17,7 @@ questions on StackOverflow can be found at https://stackoverflow.com/questions/t ``` -#### Traceback +#### Traceback ``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4e4f692f6..2e4e46d4b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -29,6 +29,6 @@ request could be broken into smaller parts before submitting. * If this is a new feature, please provide an example of its use in the description. We may want to make a follow-on pull request to put the example in the gallery! - * Ensure there is a suitable item in the cartopy test suite for the change you are proposing. + * Ensure there is a suitable item in the cartopy test suite for the change you are proposing. --> diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..069f973a8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +ci: + autofix_prs: false + autoupdate_schedule: 'quarterly' +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-added-large-files + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 diff --git a/docs/doc-requirements.txt b/docs/doc-requirements.txt index e43a2dd5c..7837bb928 100644 --- a/docs/doc-requirements.txt +++ b/docs/doc-requirements.txt @@ -1,4 +1,4 @@ sphinx<6 sphinx-gallery beautifulsoup4 -pydata-sphinx-theme \ No newline at end of file +pydata-sphinx-theme diff --git a/docs/source/_static/version_switch.js b/docs/source/_static/version_switch.js index b4278b6b3..1f7d00ecc 100644 --- a/docs/source/_static/version_switch.js +++ b/docs/source/_static/version_switch.js @@ -75,7 +75,7 @@ var select = build_select(version, release); var index_li = $('li.right:contains("index")'); - index_li.append('| '); + index_li.append('| '); index_li.before('
  • ' + select + '
  • '); $('.version_switcher select').bind('change', on_switch); }); diff --git a/docs/source/_templates/autosummary/class_without_inherited.rst b/docs/source/_templates/autosummary/class_without_inherited.rst index 7eee00e04..a5c117823 100644 --- a/docs/source/_templates/autosummary/class_without_inherited.rst +++ b/docs/source/_templates/autosummary/class_without_inherited.rst @@ -5,4 +5,4 @@ .. autoclass:: {{ objname }} :members: - :no-inherited-members: \ No newline at end of file + :no-inherited-members: diff --git a/docs/source/citation.rst b/docs/source/citation.rst index 6dc396f2b..9aac32f57 100644 --- a/docs/source/citation.rst +++ b/docs/source/citation.rst @@ -15,7 +15,7 @@ Latest release DOI through Zenodo ************ -BibTeX entry +BibTeX entry ************ For example:: @@ -26,7 +26,7 @@ For example:: year = {2010 - 2015}, address = {Exeter, Devon }, url = {https://scitools.org.uk/cartopy} - } + } ******************* diff --git a/docs/source/conf.py b/docs/source/conf.py index 0df0a8d52..f8d0bf3e5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -391,4 +391,3 @@ napoleon_use_ivar = False napoleon_use_param = True napoleon_use_rtype = False - diff --git a/docs/source/copyright.rst b/docs/source/copyright.rst index d4d9737cc..4e91e1a41 100644 --- a/docs/source/copyright.rst +++ b/docs/source/copyright.rst @@ -51,4 +51,3 @@ repository are licensed under the UK's Open Government Licence: Any email enquiries regarding the use and re-use of this information resource should be sent to: psi@nationalarchives.gsi.gov.uk. - diff --git a/docs/source/developer_interfaces.rst b/docs/source/developer_interfaces.rst index 95e75ab88..d3de80369 100644 --- a/docs/source/developer_interfaces.rst +++ b/docs/source/developer_interfaces.rst @@ -65,4 +65,3 @@ interactive visualisation. Generally the SlippyImageArtist is a developer's interface, with users often creating a :class:`SlippyImageArtist` instance through the GeoAxes' :meth:`~cartopy.mpl.geoaxes.GeoAxes.add_raster` method. - diff --git a/docs/source/matplotlib/advanced_plotting.rst b/docs/source/matplotlib/advanced_plotting.rst index c1cd40397..f3a0d1f84 100644 --- a/docs/source/matplotlib/advanced_plotting.rst +++ b/docs/source/matplotlib/advanced_plotting.rst @@ -60,7 +60,7 @@ Images ax = plt.axes(projection=ccrs.PlateCarree()) plt.title('Hurricane Miriam from the Aqua/MODIS satellite\n' '2012 09/26/2012 20:50 UTC') - + ax.use_sticky_edges = False # set a margin around the data ax.set_xmargin(0.05) diff --git a/docs/source/matplotlib/feature_interface.rst b/docs/source/matplotlib/feature_interface.rst index 4a4df4c73..598cb623e 100644 --- a/docs/source/matplotlib/feature_interface.rst +++ b/docs/source/matplotlib/feature_interface.rst @@ -32,7 +32,7 @@ Name Description United States at this scale). Natural Earth have first-order admin boundaries for most countries at the 1:10,000,000 scale; these may be - accessed with ``cartopy.feature.STATES.with_scale('10m')`` + accessed with ``cartopy.feature.STATES.with_scale('10m')`` ======================= ================================================================ .. note:: diff --git a/docs/source/matplotlib/intro.rst b/docs/source/matplotlib/intro.rst index d4871bfda..9313f109c 100644 --- a/docs/source/matplotlib/intro.rst +++ b/docs/source/matplotlib/intro.rst @@ -34,10 +34,10 @@ and then adding some coastlines to the axes: A list of the available projections to be used with Matplotlib can be found on the :ref:`cartopy_projections` page. -The line ``plt.axes(projection=ccrs.PlateCarree())`` sets up a +The line ``plt.axes(projection=ccrs.PlateCarree())`` sets up a :class:`~cartopy.mpl.geoaxes.GeoAxes` instance -which exposes a variety of other map related methods, in the case of the -previous example, we used the +which exposes a variety of other map related methods, in the case of the +previous example, we used the :meth:`~cartopy.mpl.geoaxes.GeoAxes.coastlines` method to add coastlines to the map. @@ -68,8 +68,8 @@ Adding data to the map Once you have the map just the way you want it, data can be added to it in exactly the same way as with normal Matplotlib axes. By default, the coordinate system of any data added to a GeoAxes is -the same as the coordinate system of the GeoAxes itself, to control which coordinate system -that the given data is in, you can add the ``transform`` keyword with an appropriate +the same as the coordinate system of the GeoAxes itself, to control which coordinate system +that the given data is in, you can add the ``transform`` keyword with an appropriate :class:`cartopy.crs.CRS` instance: diff --git a/docs/source/reference/config.rst b/docs/source/reference/config.rst index caf77ad88..ecf25ef95 100644 --- a/docs/source/reference/config.rst +++ b/docs/source/reference/config.rst @@ -51,4 +51,4 @@ The top level cartopy module contains the :attr:`~cartopy.config` dictionary whi ``downloaders`` A dictionary mapping standard "specifications" to the appropriate :class:`~cartopy.io.Downloader`. For further documentation and an - example see :func:`cartopy.io.Downloader.from_config`. \ No newline at end of file + example see :func:`cartopy.io.Downloader.from_config`. diff --git a/docs/source/reference/crs.rst b/docs/source/reference/crs.rst index dab83bdbf..9ae2f0587 100644 --- a/docs/source/reference/crs.rst +++ b/docs/source/reference/crs.rst @@ -44,4 +44,4 @@ List of projections .. toctree:: :maxdepth: 2 - projections \ No newline at end of file + projections diff --git a/docs/source/reference/feature.rst b/docs/source/reference/feature.rst index f4b712800..cae25eeae 100644 --- a/docs/source/reference/feature.rst +++ b/docs/source/reference/feature.rst @@ -42,4 +42,4 @@ Feature classes Scaler ShapelyFeature WFSFeature - nightshade.Nightshade \ No newline at end of file + nightshade.Nightshade diff --git a/docs/source/reference/index.rst b/docs/source/reference/index.rst index 730053f00..973027ecc 100644 --- a/docs/source/reference/index.rst +++ b/docs/source/reference/index.rst @@ -20,4 +20,4 @@ see the :ref:`getting started guide `. matplotlib feature transformations - config \ No newline at end of file + config diff --git a/docs/source/reference/matplotlib.rst b/docs/source/reference/matplotlib.rst index 59dce628f..b113914ab 100644 --- a/docs/source/reference/matplotlib.rst +++ b/docs/source/reference/matplotlib.rst @@ -38,7 +38,7 @@ location information to the plots. .. autosummary:: :toctree: generated/ :template: autosummary/class_without_inherited.rst - + gridliner.Gridliner ticker.LongitudeFormatter ticker.LatitudeFormatter @@ -72,4 +72,4 @@ between GEOS, Shapely, and Matplotlib paths. patch.geos_to_path patch.path_segments - patch.path_to_geos \ No newline at end of file + patch.path_to_geos diff --git a/docs/source/reference/transformations.rst b/docs/source/reference/transformations.rst index 1d2960beb..db027ff92 100644 --- a/docs/source/reference/transformations.rst +++ b/docs/source/reference/transformations.rst @@ -45,4 +45,4 @@ LinearRing/LineString projection trace.Interpolator trace.CartesianInterpolator trace.SphericalInterpolator - trace.LineAccumulator \ No newline at end of file + trace.LineAccumulator diff --git a/docs/source/tutorials/using_the_shapereader.rst b/docs/source/tutorials/using_the_shapereader.rst index 1eb6443b3..26389e4cd 100644 --- a/docs/source/tutorials/using_the_shapereader.rst +++ b/docs/source/tutorials/using_the_shapereader.rst @@ -3,7 +3,7 @@ Using the cartopy shapereader ============================= -Cartopy provides an object oriented shapefile reader based on top of the +Cartopy provides an object oriented shapefile reader based on top of the `pyshp`_ module to provide easy, programmatic, access to standard vector datasets. Cartopy's wrapping of pyshp has the benefit of being pure python, and is therefore @@ -120,7 +120,7 @@ Which we can print with Democratic Republic of the Congo, Egypt, Ethiopia, Nigeria - * **SHP.2**: Using the countries shapefile, find the most populated country grouped + * **SHP.2**: Using the countries shapefile, find the most populated country grouped by the first letter of the "name_long". Hint: :func:`itertools.groupby` can help with the grouping. @@ -174,4 +174,3 @@ Which we can print with W Western Sahara Y Yemen Z Zimbabwe - diff --git a/docs/source/whatsnew/v0.10.rst b/docs/source/whatsnew/v0.10.rst index 95d270f69..81fcc51e7 100644 --- a/docs/source/whatsnew/v0.10.rst +++ b/docs/source/whatsnew/v0.10.rst @@ -28,4 +28,4 @@ capabilities, including: .. figure:: ../gallery/vector_data/images/sphx_glr_barbs_001.png :target: ../gallery/vector_data/barbs.html :align: center - :scale: 70 \ No newline at end of file + :scale: 70 diff --git a/docs/source/whatsnew/v0.11.rst b/docs/source/whatsnew/v0.11.rst index 262be113f..09a048309 100644 --- a/docs/source/whatsnew/v0.11.rst +++ b/docs/source/whatsnew/v0.11.rst @@ -54,4 +54,4 @@ Version 0.11 (June 19, 2014) .. figure:: ../gallery/gridlines_and_labels/images/sphx_glr_tick_labels_001.png :target: ../gallery/gridlines_and_labels/tick_labels.html :align: center - :scale: 70 \ No newline at end of file + :scale: 70 diff --git a/docs/source/whatsnew/v0.12.rst b/docs/source/whatsnew/v0.12.rst index 9631f9cf3..ad326c3b9 100644 --- a/docs/source/whatsnew/v0.12.rst +++ b/docs/source/whatsnew/v0.12.rst @@ -131,4 +131,4 @@ Deprecations returned, rather than a single image and its associated extent. * The ``secant_latitudes`` keyword in :class:`cartopy.crs.LambertConformal` has - been deprecated in favour of ``standard_parallels``. \ No newline at end of file + been deprecated in favour of ``standard_parallels``. diff --git a/docs/source/whatsnew/v0.15.rst b/docs/source/whatsnew/v0.15.rst index 049181daa..8cda9e13b 100644 --- a/docs/source/whatsnew/v0.15.rst +++ b/docs/source/whatsnew/v0.15.rst @@ -39,4 +39,4 @@ Features .. figure:: ../gallery/web_services/images/sphx_glr_wmts_time_001.png :target: ../gallery/web_services/wmts_time.html :align: center - :scale: 70 \ No newline at end of file + :scale: 70 diff --git a/docs/source/whatsnew/v0.16.rst b/docs/source/whatsnew/v0.16.rst index 83d27113a..22e9877b0 100644 --- a/docs/source/whatsnew/v0.16.rst +++ b/docs/source/whatsnew/v0.16.rst @@ -82,4 +82,4 @@ Features time. (:pull:`990`) * Mahé Perrette and Ryan May collaborated to improve the - :class:`~cartopy.crs.Stereographic` projection. (:pull:`929`) \ No newline at end of file + :class:`~cartopy.crs.Stereographic` projection. (:pull:`929`) diff --git a/docs/source/whatsnew/v0.17.rst b/docs/source/whatsnew/v0.17.rst index fe8453757..eb32ff67b 100644 --- a/docs/source/whatsnew/v0.17.rst +++ b/docs/source/whatsnew/v0.17.rst @@ -155,4 +155,4 @@ Deprecations Incompatible Changes -------------------- -* Support for Matplotlib < 1.5.1 and NumPy < 1.10 has been removed. \ No newline at end of file +* Support for Matplotlib < 1.5.1 and NumPy < 1.10 has been removed. diff --git a/docs/source/whatsnew/v0.18.rst b/docs/source/whatsnew/v0.18.rst index f262b07b6..9b35a17c6 100644 --- a/docs/source/whatsnew/v0.18.rst +++ b/docs/source/whatsnew/v0.18.rst @@ -114,4 +114,4 @@ Deprecations Instead, use :attr:`cartopy.mpl.gridliner.Gridliner.top_labels`, :attr:`cartopy.mpl.gridliner.Gridliner.bottom_labels`, :attr:`cartopy.mpl.gridliner.Gridliner.left_labels`, or - :attr:`cartopy.mpl.gridliner.Gridliner.right_labels`. \ No newline at end of file + :attr:`cartopy.mpl.gridliner.Gridliner.right_labels`. diff --git a/docs/source/whatsnew/v0.19.rst b/docs/source/whatsnew/v0.19.rst index 334c9f7c2..195a6f900 100644 --- a/docs/source/whatsnew/v0.19.rst +++ b/docs/source/whatsnew/v0.19.rst @@ -52,7 +52,7 @@ Features * Luke Davis fixed the label padding for gridliners to use points which makes the rendered screen image appear the same as the printed image now. (:pull:`1556`) - + * Daryl Herzmann added the ability to make Hexbin plots. (:pull:`1542`) .. plot:: @@ -75,4 +75,4 @@ Features * Kyle Penner fixed image plotting when a 2D alpha array is input. (:pull:`1543`) * Elliott Sales de Andrade and Hugo van Kemenade removed Python 2 support. - (:pull:`1516`, :pull:`1517`, :pull:`1540`, :pull:`1544`, and :pull:`1547`) \ No newline at end of file + (:pull:`1516`, :pull:`1517`, :pull:`1540`, :pull:`1544`, and :pull:`1547`) diff --git a/docs/source/whatsnew/v0.21.rst b/docs/source/whatsnew/v0.21.rst index cb0a3c372..d6db0a93f 100644 --- a/docs/source/whatsnew/v0.21.rst +++ b/docs/source/whatsnew/v0.21.rst @@ -125,7 +125,7 @@ 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()`` diff --git a/docs/source/whatsnew/v0.7.rst b/docs/source/whatsnew/v0.7.rst index dba848e12..47d9a5f7c 100644 --- a/docs/source/whatsnew/v0.7.rst +++ b/docs/source/whatsnew/v0.7.rst @@ -8,4 +8,3 @@ Version 0.7 (March 21, 2013) This is a quick release which targets two very specific requirements. The goals outlined in the development plan at ``v0.6`` still remain the primary target for ``v0.8`` and beyond. - diff --git a/examples/gridlines_and_labels/README.txt b/examples/gridlines_and_labels/README.txt index 9ffc2e236..fad4577d7 100644 --- a/examples/gridlines_and_labels/README.txt +++ b/examples/gridlines_and_labels/README.txt @@ -2,4 +2,3 @@ Gridlines and labels ==================== - diff --git a/examples/lines_and_polygons/README.txt b/examples/lines_and_polygons/README.txt index 55c79b33a..31be1adf9 100644 --- a/examples/lines_and_polygons/README.txt +++ b/examples/lines_and_polygons/README.txt @@ -2,4 +2,3 @@ Lines and polygons ================== - diff --git a/examples/miscellanea/README.txt b/examples/miscellanea/README.txt index 064e5ef2a..411ff4af0 100644 --- a/examples/miscellanea/README.txt +++ b/examples/miscellanea/README.txt @@ -2,4 +2,3 @@ Miscellanea =========== - diff --git a/examples/scalar_data/README.txt b/examples/scalar_data/README.txt index 4abd77077..c8e8aa678 100644 --- a/examples/scalar_data/README.txt +++ b/examples/scalar_data/README.txt @@ -2,4 +2,3 @@ Scalar data =========== - diff --git a/examples/vector_data/README.txt b/examples/vector_data/README.txt index 3dd508fd1..30b524cb1 100644 --- a/examples/vector_data/README.txt +++ b/examples/vector_data/README.txt @@ -2,4 +2,3 @@ Vector data =========== - diff --git a/examples/web_services/README.txt b/examples/web_services/README.txt index eb6f16b25..ee2548771 100644 --- a/examples/web_services/README.txt +++ b/examples/web_services/README.txt @@ -2,4 +2,3 @@ Web services ============ - diff --git a/lib/cartopy/data/shapefiles/gshhs/README.TXT b/lib/cartopy/data/shapefiles/gshhs/README.TXT index c8f711d8d..adb56693f 100644 --- a/lib/cartopy/data/shapefiles/gshhs/README.TXT +++ b/lib/cartopy/data/shapefiles/gshhs/README.TXT @@ -29,9 +29,9 @@ data as shapefiles. -------------------------------------------------------------------- Global Self-consistent Hierarchical High-resolution Shorelines version 2.0 July 15, 2009 - + Distributed under the Gnu Public License - + This is the README file for the GSHHS Data distribution. To read the data you should get the gshhs supplement to GMT, the Generic Mapping Tools (gmt.soest.hawaii.edu). GSHHS appear in GMT in a diff --git a/lib/cartopy/mpl/geoaxes.py b/lib/cartopy/mpl/geoaxes.py index ed9d82995..cf2056b55 100644 --- a/lib/cartopy/mpl/geoaxes.py +++ b/lib/cartopy/mpl/geoaxes.py @@ -47,29 +47,20 @@ assert mpl.__version__ >= '3.1', \ 'Cartopy is only supported with Matplotlib 3.1 or greater.' +# A nested mapping from path, source CRS, and target projection to the +# resulting transformed paths: +# {path: {(source_crs, target_projection): list_of_paths}} +# Provides a significant performance boost for contours which, at +# matplotlib 1.2.0 called transform_path_non_affine twice unnecessarily. _PATH_TRANSFORM_CACHE = weakref.WeakKeyDictionary() -""" -A nested mapping from path, source CRS, and target projection to the -resulting transformed paths:: - - {path: {(source_crs, target_projection): list_of_paths}} - -Provides a significant performance boost for contours which, at -matplotlib 1.2.0 called transform_path_non_affine twice unnecessarily. - -""" +# A dictionary of pre-loaded images for large background images, kept as a +# dictionary so that large images are loaded only once. _BACKG_IMG_CACHE = {} -""" -A dictionary of pre-loaded images for large background images, kept as a -dictionary so that large images are loaded only once. -""" +# A dictionary of background images in the directory specified by the +# CARTOPY_USER_BACKGROUNDS environment variable. _USER_BG_IMGS = {} -""" -A dictionary of background images in the directory specified by the -CARTOPY_USER_BACKGROUNDS environment variable. -""" # XXX call this InterCRSTransform diff --git a/lib/cartopy/trace.pyx b/lib/cartopy/trace.pyx index f2d6634e1..68b679488 100644 --- a/lib/cartopy/trace.pyx +++ b/lib/cartopy/trace.pyx @@ -625,7 +625,7 @@ class _Testing: cdef GEOSGeometry *g_domain = geos_from_shapely(domain) cdef const GEOSPreparedGeometry *gp_domain gp_domain = GEOSPrepare_r(handle, g_domain) - + state = get_state(interpolator.project(l_start), gp_domain, handle) cdef bool p_start_inside_domain = state == POINT_IN diff --git a/setup.cfg b/setup.cfg index 582e1aebd..2fda28171 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,4 +7,4 @@ exclude = \ [tool:pytest] addopts = --mpl testpaths = lib -python_files = test_*.py \ No newline at end of file +python_files = test_*.py diff --git a/setup.py b/setup.py index 5101b0705..54da9f03a 100644 --- a/setup.py +++ b/setup.py @@ -33,10 +33,6 @@ from setuptools import Extension, find_packages, setup -""" -Distribution definition for Cartopy. - -""" # The existence of a PKG-INFO directory is enough to tell us whether this is a # source installation or not (sdist).