Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cartopy feature download #4304

Merged
merged 12 commits into from
Sep 6, 2021
Merged

cartopy feature download #4304

merged 12 commits into from
Sep 6, 2021

Conversation

bjlittle
Copy link
Member

@bjlittle bjlittle commented Sep 1, 2021

🚀 Pull Request

Description

This PR fixes the broken ABF fileformat documentation URL link.

Closes #4302


Consult Iris pull request check list

Copy link
Member

@rcomer rcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just waiting for the CI to do its thing.

Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.
I wondered whether the link should live in docs/src/common_links.inc,
but I think that is unhelpful because it is needed in code-docstrings, not just docs (rst).

@rcomer
Copy link
Member

rcomer commented Sep 1, 2021

Looks like the Natural Earth server is having issues again 😞

@bjlittle
Copy link
Member Author

bjlittle commented Sep 2, 2021

Well... this PR took an unexpected diversion 🤣

Apart from various link barfs, we were also hitting issues during CI where cartopy downloads of certain resources were failing when running tests.

After a bit of investigation, I discovered that the cirrus-ci cache for cartopy wasn't fully populated (as expected) with all the shapefiles that we require during testing. This was the result of a race condition between parallel jobs, and unluckily for us, a CI job that doesn't download all the required Natural Earth resources pushed an incomplete cache first i.e., the partial cache was repeatedly forcing cartopy to download the missing resources everytime during testing, hence exposing us to service outages.

There is a fix now merged in cartopy, see PR SciTools/cartopy#1833 (nice one @rcomer ❤️), but this won't be available any time soon i.e., v0.19.0.post1+, whenever that is.

As a compromise, I've taken the approach to extend and wrap the cartopy/tools/feature_download.py command-line tool within iris to download cartopy assets that populate the cache, but using the more stable AWS endpoint.

This is actually a pretty handy little general utility, and whatsmore, as with cartopy it won't be bundled with iris when it is packaged.

I know that populating the cartopy cache is a pain-point for many users, particularly when pre-caching for offline usage, or when attempting to develop behind a firewall with no internet access e.g., on a secure HPC, so this may somewhat help ease the burden i.e., you can use the utility to download a cartopy cache, then lift and shift it to your installation, or be confident that you have all the resource you need before working offline.

@rcomer
Copy link
Member

rcomer commented Sep 2, 2021

@bjlittle maybe update the title? I’m not sure I’m qualified to review this anymore.

@rcomer rcomer removed their assignment Sep 2, 2021
.cirrus.yml Outdated Show resolved Hide resolved
.cirrus.yml Show resolved Hide resolved
@bjlittle bjlittle changed the title Fix broken ABF link cartopy feature download Sep 2, 2021
@rcomer
Copy link
Member

rcomer commented Sep 3, 2021

This is actually a pretty handy little general utility, and whatsmore, as with cartopy it won't be bundled with iris when it is packaged.

I know that populating the cartopy cache is a pain-point for many users, particularly when pre-caching for offline usage, or when attempting to develop behind a firewall with no internet access e.g., on a secure HPC, so this may somewhat help ease the burden i.e., you can use the utility to download a cartopy cache, then lift and shift it to your installation, or be confident that you have all the resource you need before working offline.

I'm confused here: if the script isn't bundled with Iris, how do the users take advantage of it?

@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

@rcomer Glad you asked 😄

I've followed the same pattern as cartopy, as a starting point i.e., cartopy/tools/feature_download.py is not bundled within cartopy as a package. So really, it's a development tool.

If we're serious about packaging this with iris, then we could easily make an entry-point for it, then it would indeed be accessible to users via the command line on install 🥳

I didn't want to do that work up front, only for people to object... I rather discuss it, have agreement, then do it.

@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

@SciTools/iris-devs So since we're on topic... what would you/we prefer?

I have an opinion on this, but I like to hear the wisdom of the crowd first...

@rcomer
Copy link
Member

rcomer commented Sep 3, 2021

@bjlittle my opinion is to punt that question to a new Issue: the scope on this PR has creeped swerved far enough, and fixing the CI should be the first priority!

@trexfeathers
Copy link
Contributor

@bjlittle my opinion is to punt that question to a new Issue: the scope on this PR has creeped swerved far enough, and fixing the CI should be the first priority!

That's way better than what I was about to write. PR's that solve multiple problems are an anti-pattern, and as @rcomer eludes, this isn't exactly a small add-on.

@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

Totally happy to follow this up with a GH discussion 👍

Anyone fancy reviewing and merging?

I'm keen to unblock CI

@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

Note that SciTools/cartopy#1602 renames tools/feature_download.py to be tools/cartopy_feature_download.py and also makes it a pucker command line script (finally) 🥳

That PR was merged in May 2021 and didn't make the cut for the April release of cartopy 0.19.0.post1... but it will be available in the next release of cartopy, as will SciTools/cartopy#1833

@pp-mo
Copy link
Member

pp-mo commented Sep 3, 2021

@rcomer @trexfeathers
I'm good with this as it is. I reviewed the code and its CLI and I think it works OK.
I do also agree that including this as an installed script is another step, and we don't want to get into that yet
- assuming that is what everyone else meant by "punt that question to a new Issue" / "PR's that solve multiple problems" ??

Going to merge unless someone objects...

@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

Once this PR is merge, I'll make an associated issue to discuss follow-up work.

This is all in a state of flux, and we may insist on a minimum pin for cartopy within iris moving forwards to make our lives easier 🤔 ... but that's to decide at a later date.

Copy link
Member

@jamesp jamesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest we pause on this and consider putting changes into cartopy instead of iris

@bjlittle bjlittle marked this pull request as draft September 3, 2021 12:35
@rcomer
Copy link
Member

rcomer commented Sep 3, 2021

Oh look 👀 conda-forge/cartopy-feedstock#116

@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

That's only a fix to 0.19.0.post1, and not older versions of cartopy

@rcomer
Copy link
Member

rcomer commented Sep 3, 2021

@bjlittle but it would get our CI moving?

.cirrus.yml Outdated Show resolved Hide resolved
@bjlittle bjlittle marked this pull request as ready for review September 3, 2021 15:03
@bjlittle
Copy link
Member Author

bjlittle commented Sep 3, 2021

@jamesp ... and finally, this is good to go 🤞

@jamesp jamesp merged commit f34305c into SciTools:main Sep 6, 2021
tkknight added a commit to tkknight/iris that referenced this pull request Sep 6, 2021
* main:
  [pre-commit.ci] pre-commit autoupdate (SciTools#4299)
  Updated environment lockfiles (SciTools#4298)
  cartopy feature download (SciTools#4304)
  reset whatsnew latest (SciTools#4288)
  Updated environment lockfiles (SciTools#4289)
  Update cube.py (SciTools#4287)
  Missing whatsnew entries for 3.1 release. (SciTools#4283)
  Update CF standard name table to v77 (SciTools#4282)
  Added AtmosphereSigmaFactory (SciTools#4052)
  Updated environment lockfiles (SciTools#4281)
@bjlittle bjlittle deleted the fix-abf-link branch September 8, 2021 08:02
pp-mo pushed a commit to pp-mo/iris that referenced this pull request Sep 15, 2021
* Fix broken ABF link

* add cartopy downloader utility

* update netcdf4-python link

* explicitly specify features to download for ci

* added whatsnew entry

* update utility help

* utility tidy

* tidy utility

* copy with cartopy script rename

* update whatsnew to clarify as dev tool

* push fix to cartopy

* use cartopy master
bjlittle added a commit that referenced this pull request Sep 16, 2021
* Finalise whatsnew and version string.

* cartopy feature download (#4304)

* Fix broken ABF link

* add cartopy downloader utility

* update netcdf4-python link

* explicitly specify features to download for ci

* added whatsnew entry

* update utility help

* utility tidy

* tidy utility

* copy with cartopy script rename

* update whatsnew to clarify as dev tool

* push fix to cartopy

* use cartopy master

* Fix typo

* Update copyright.rst

* Update conf.py

* Review changes.

Co-authored-by: Bill Little <bill.james.little@gmail.com>
Co-authored-by: Bill Little <bill.little@metoffice.gov.uk>
tkknight added a commit to tkknight/iris that referenced this pull request Sep 19, 2021
* main: (71 commits)
  Skip TestConstrainedLoad if data missing (SciTools#4319)
  Add 'Good First Issue' label to reasons an issue doesn't go stale (SciTools#4317)
  Gallery: simplify quiver example (SciTools#4120)
  Improve styling in a minor way in docs (SciTools#4314)
  bump version (SciTools#4310)
  Made clear we only test on Linux. (SciTools#4309)
  Updated environment lockfiles (SciTools#4308)
  Include Discussions in Getting Involved. (SciTools#4307)
  Fixed text to show as link. (SciTools#4305)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4299)
  Updated environment lockfiles (SciTools#4298)
  cartopy feature download (SciTools#4304)
  Mesh Loading (AVD-1813) (SciTools#4262)
  reset whatsnew latest (SciTools#4288)
  Updated environment lockfiles (SciTools#4289)
  Update cube.py (SciTools#4287)
  Integrated whatsnew for v3.1 release (rc0) (SciTools#4285)
  Version changes and final whatsnew tweaks for 3v1rc0. (SciTools#4284)
  Missing whatsnew entries for 3.1 release. (SciTools#4283)
  Update CF standard name table to v77 (SciTools#4282)
  ...
tkknight added a commit to tkknight/iris that referenced this pull request Sep 22, 2021
* main: (94 commits)
  added support for make html-noapi and html-quick for the docs build (SciTools#4333)
  Refactor some netcdf save code (SciTools#4301)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4329)
  Update to loading docs to cover absence of 'or' for constraints (SciTools#4321)
  update latest.rst.template (SciTools#4323)
  stable cartopy feature download (SciTools#4328)
  Skip TestConstrainedLoad if data missing (SciTools#4319)
  Add 'Good First Issue' label to reasons an issue doesn't go stale (SciTools#4317)
  Gallery: simplify quiver example (SciTools#4120)
  Improve styling in a minor way in docs (SciTools#4314)
  bump version (SciTools#4310)
  Made clear we only test on Linux. (SciTools#4309)
  Updated environment lockfiles (SciTools#4308)
  Include Discussions in Getting Involved. (SciTools#4307)
  Fixed text to show as link. (SciTools#4305)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4299)
  Updated environment lockfiles (SciTools#4298)
  cartopy feature download (SciTools#4304)
  Mesh Loading (AVD-1813) (SciTools#4262)
  reset whatsnew latest (SciTools#4288)
  ...
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.

ABF file format reference
5 participants