cartopy icon indicating copy to clipboard operation
cartopy copied to clipboard

Feature: add etopo plotting to stock_img

Open smartlixx opened this issue 3 years ago • 12 comments

Rationale

Close #1734

Implications

None as far as I can see.

Example

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

fig = plt.figure(figsize=[4, 6])
ax1 = fig.add_subplot(2, 1, 1, projection=ccrs.PlateCarree())
ax2 = fig.add_subplot(2, 1, 2, projection=ccrs.Orthographic())

ax1.stock_img(name='etopo')
ax1.coastlines()
ax2.stock_img(name='etopo')
ax2.coastlines()

plt.show()

The output is Cartopy_etopo1

smartlixx avatar Mar 13 '21 15:03 smartlixx

Currently the PR is showing an empty etopo1.jpg committed? Any reason that needs to be included?

dopplershift avatar Mar 15 '21 22:03 dopplershift

The file etopo1.jpg is not empty. its size is 1.28M (64 dpi). it is the picture of the bathymetry data to plot. I took it from Basemao repo, because the original file downloaded from NOAA is about 2M (96 dpi). This file definitely will increase the size of cartopy. Alternatively, we can download it on the fly from NOAA website. Please let me know your opinion.

smartlixx avatar Mar 16 '21 00:03 smartlixx

I think grabbing it from the source is better whenever possible, that way we get any updates they have. It also looks like there are multiple "versions" of etopo, focusing on ice, or other features too? It looks like the original data is 300+MB! I didn't see the downsampled version immediately on NOAA's site, do you have a link to that?

greglucas avatar Mar 20 '21 14:03 greglucas

I think grabbing it from the source is better whenever possible, that way we get any updates they have. It also looks like there are multiple "versions" of etopo, focusing on ice, or other features too? It looks like the original data is 300+MB! I didn't see the downsampled version immediately on NOAA's site, do you have a link to that?

When you click on the thumbnail on https://www.ngdc.noaa.gov/mgg/global/, you will get to the downsampled version of etopo1: https://www.ngdc.noaa.gov/mgg/image/color_etopo1_ice_low.jpg.

Yes, there are several versions of this dataset, depending on using the ice top or the ice bottom for altitude. The above link should suffice for our purpose. If we choose to grab it on the fly, its size is about 2M.

smartlixx avatar Mar 21 '21 03:03 smartlixx

Now I have modified the code to download the etopo1 image from NOAA website, and delete the etopo1.jpg file from the commit.

smartlixx avatar Mar 29 '21 08:03 smartlixx

Can you rebase your commits to "squash" together the original commit adding the file and the one deleting it? Otherwise, there will be a copy of the 1.3MB file sitting in the history for this repo.

dopplershift avatar Mar 31 '21 01:03 dopplershift

Can you rebase your commits to "squash" together the original commit adding the file and the one deleting it? Otherwise, there will be a copy of the 1.3MB file sitting in the history for this repo.

Thanks. I squashed all the commits into one.

The test failure message below seems not to be related with this PR.

FAILED lib/cartopy/tests/mpl/test_ticks.py::test_set_xticks_no_transform - Fi...

smartlixx avatar Mar 31 '21 02:03 smartlixx

this PR appears to be reviwed and have passing tests, but there are conflicts between it and master

@smartlixx please may i suggest that you rebase this PR branch with respect to upstream/master

i would hope that reviewers would then be able to re-assess and potentially merge this onto master

@dopplershift @QuLogic is this reasonable from your points of view?

marqh avatar Oct 14 '21 13:10 marqh

this PR appears to be reviwed and have passing tests, but there are conflicts between it and master

@smartlixx please may i suggest that you rebase this PR branch with respect to upstream/master

i would hope that reviewers would then be able to re-assess and potentially merge this onto master

@dopplershift @QuLogic is this reasonable from your points of view?

Yes, it is done. Please review and let me know your thoughts. @QuLogic @dopplershift

smartlixx avatar Oct 15 '21 10:10 smartlixx

Looks good to me, just one minor suggestion.

Thanks for your comments. I have updated the PR to incorporate the new changes since my last commit, and the PR has passed all the test. Hopefully it can be accepted (quite a long time has passed). Or if it is OK, I can also combine this PR with #2230.

As a side comment/follow-up PR, would this make sense to have as a RasterSource feature artist? So, make it usable outside of the stock_img function, and have stock_img add the RasterSource features instead.

I can see there is a RasterSource class in io/__init__.py

https://github.com/SciTools/cartopy/blob/a6c083530b3b85029c425d343fba4b67d2d2421d/lib/cartopy/io/init.py#L310-L365

This may be a good starting point, but it's beyond my hands at this moment.

smartlixx avatar Aug 06 '23 13:08 smartlixx

Hi, I’m just checking on the status of this one. It looks like it was ready to go but unfortunately now has conflicts with the main branch again. @smartlixx do you have the bandwidth to rebase this again?

rcomer avatar Feb 19 '24 16:02 rcomer

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Mar 27 '24 10:03 CLAassistant