Skip to content

Commit

Permalink
Merge pull request #74 from jimustafa/update-cartopy-dl-url
Browse files Browse the repository at this point in the history
update `cartopy` download URL
  • Loading branch information
timhoffm committed Sep 30, 2021
2 parents f5f1823 + bc4b1d2 commit 2e1d87b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,22 @@
# Released under the BSD License
# -----------------------------------------------------------------------------
import numpy as np
import cartopy.crs
import cartopy
import matplotlib as mpl
import matplotlib.pyplot as plt


CARTOPY_SOURCE_TEMPLATE = 'https://naturalearth.s3.amazonaws.com/{resolution}_{category}/ne_{resolution}_{name}.zip'


# Configures cartopy to download NaturalEarth shapefiles from S3 instead of naciscdn
# Taken from https://github.com/SciTools/cartopy/issues/1325#issuecomment-904343657
target_path_template = cartopy.io.shapereader.NEShpDownloader.default_downloader().target_path_template
downloader = cartopy.io.shapereader.NEShpDownloader(url_template=CARTOPY_SOURCE_TEMPLATE,
target_path_template=target_path_template)
cartopy.config['downloaders'][('shapefiles', 'natural_earth')] = downloader


# Polar plot
# -----------------------------------------------------------------------------
mpl.rc('axes', linewidth=4.0)
Expand Down

0 comments on commit 2e1d87b

Please sign in to comment.