Skip to content

Utilise AdaptiveScalar in default NaturalEarthFeatures - #1105

Merged
QuLogic merged 5 commits into
SciTools:masterfrom
kaedonkers:autoscale-features
Mar 5, 2020
Merged

QuLogic merged 5 commits into
SciTools:masterfrom
kaedonkers:autoscale-features

Conversation

@kaedonkers

@kaedonkers kaedonkers commented Aug 9, 2018 •

Copy link
Copy Markdown
Member

Rationale

The default NaturalEarthFeatures in Cartopy (COASTLINE, OCEAN, etc) have a fixed scale at '110m'. It would be good to utilise the AdaptiveScaler to automatically scale to the extent of the plot by default.

Implications

When, for instance, ax.add_feature(OCEAN) is called the scale of the feature will automatically adjust to the extent of the axes, instead of the default '110m'. The behaviour of ax.coastlines() has also changed to have adaptive scaling by default. This functionality can be reversed using the with_scale() method when adding default NaturalEarthFeatures or specifying a scale argument with ax.coastlines() e.g. ax.coastlines('110m').

Comment thread lib/cartopy/feature.py Resolved
Comment thread lib/cartopy/feature.py Resolved
@QuLogic

QuLogic commented Oct 16, 2018

Copy link
Copy Markdown
Member

Can you rebase this to get tests working?

@dopplershift dopplershift added this to the 0.17 milestone Nov 1, 2018
@kaedonkers

Copy link
Copy Markdown
Member Author

Tests are failing because image comparison tests are now receiving different images. I'll update the PR to include the correct images.

Comment thread lib/cartopy/feature/__init__.py Resolved
Comment thread lib/cartopy/mpl/geoaxes.py Resolved
@pelson

pelson commented Nov 16, 2018

Copy link
Copy Markdown
Member

@dopplershift - this is a really important PR, but I'm actually 👎 on it going into v0.17. Let's get the autoscaling bedded in in v0.17, and then turn on the magic for v0.18. Please feel free to overrule.

@pelson pelson modified the milestones: 0.17, 0.18 Nov 16, 2018
@kaedonkers

kaedonkers commented Nov 16, 2018 •

Copy link
Copy Markdown
Member Author

@pelson I'm inclined to agree with you here and am happy to leave this behaviour for v0.18. I also have some improvements to the autoscaler in mind which I will hopefully get included in v0.18.

@dopplershift

Copy link
Copy Markdown
Contributor

Fine with me bumping from 0.17.

@greglucas

Copy link
Copy Markdown
Contributor

@kaedonkers, did you have more you wanted to put into this PR still? Do we want to try and get it ready for the 0.18 release?

@pelson

pelson commented Mar 1, 2020

Copy link
Copy Markdown
Member

It would be great to finally have this functionality on by default.

@pelson
pelson force-pushed the autoscale-features branch from 45a346f to 743c7a6 Compare March 1, 2020 06:28
Comment thread lib/cartopy/feature/__init__.py Resolved
@pelson

pelson commented Mar 1, 2020

Copy link
Copy Markdown
Member

I took the liberty of rebasing this, and addressing the review actions.

@pelson
pelson force-pushed the autoscale-features branch from 743c7a6 to 190fed1 Compare March 1, 2020 06:31
@pelson

pelson commented Mar 1, 2020

Copy link
Copy Markdown
Member

Tests are mostly failing because the image comparisons now have suitable coastline resolutions. I'll manually update all of the failing tests to use the old fixed resolution to minimise the number of image changes.

@QuLogic
QuLogic merged commit 5548b0f into SciTools:master Mar 5, 2020
@QuLogic

QuLogic commented Mar 5, 2020

Copy link
Copy Markdown
Member

Thanks @kaedonkers and @pelson!

@pelson

pelson commented Mar 5, 2020

Copy link
Copy Markdown
Member

It's great to see this in! Thanks @kaedonkers, and to @QuLogic for merging. 👍

@kaedonkers

Copy link
Copy Markdown
Member Author

Thanks @pelson for picking this us and fixing it! (It's been a laptopless week...)
And thank you @QuLogic for the merge 😁
Great to see this feature finally added!

@kaedonkers
kaedonkers deleted the autoscale-features branch March 5, 2020 13:11
trexfeathers added a commit to stephenworsley/iris that referenced this pull request Aug 24, 2020
trexfeathers added a commit to trexfeathers/test-iris-imagehash that referenced this pull request Aug 25, 2020
trexfeathers added a commit to trexfeathers/iris that referenced this pull request Aug 25, 2020
trexfeathers added a commit to SciTools/iris that referenced this pull request Sep 3, 2020
* unpin proj, move cartopy pin forward

* Explicit resolution of coastlines in tests - see SciTools/cartopy#1105.

* Removed gdal optional requirement.

* New target image for test_plot_custom_aggregation due to auto-sizing coastlines in SciTools/cartopy#1105. Twin commit: SciTools/test-iris-imagehash@9b4e50e.

* New acceptable images for various tests due to minor changes in Matplotlib 3.3. Twin commit: SciTools/test-iris-imagehash@3babde5.

* New target images for test plots affected by the gridline spacing change in SciTools/cartopy@2f5e568. Twin commit: SciTools/test-iris-imagehash@f071f2c.

* New acceptable images to allow for minute colormap range changes in Matplotlib 3.3. Twin commit: SciTools/test-iris-imagehash@9f4b04e.

* Improvement to quickplot time axis labelling and accompanying graphics test target changes. Twin commit: SciTools/test-iris-imagehash@3036a6f

* Made quickplot time axis label sensitive to MPL version (see matplotlib/matplotlib#15008).

* More target images following from 41b3b2a. Twin commit: SciTools/test-iris-imagehash@804ff68.

* More target images following from 27ea2f2. Twin commit: SciTools/test-iris-imagehash@f559a36.

* Mirroring _draw_2d_from_points() use of mpl date2num in _draw_2d_from_bounds(). Twin commit: SciTools/test-iris-imagehash@3c582dc.

* Re-instated all valid image targets for TestPlotCoordinatesGiven.test_tx.

* New target image for TestSimple.test_bounds following change to plot axis labelling. Twin commit: SciTools/test-iris-imagehash@770dc92.

* modify raster tests to handle new gdal behaviour

* modify raster tests to handle new gdal naming behaviour

* modify tests to reflect new PROJ behaviour

* modify parts of test_project to use Transverse Mercator

* revert test_project to use Robinson, add warning to docstring

* keep results consistent

Co-authored-by: Martin Yeo <martin.yeo@metoffice.gov.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants