You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method background_img() currently displays background images at a lower resolution compared to the original files.
The issue is similar to #1708 and in fact I managed to solve it by modifing the source file adding the regrid_shape argument, set to 5000.
Below I report a test case and the output images, with and without the regrid_shape argument.
I think that it would be beneficial to add regrid_shape as optional argument to background_img().
Code to reproduce
import cartopy.crs as ccrs
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import os
import subprocess
import json
def get_bkg_image(url, fname):
command = ["curl", "-o", fname, url]
subprocess.run(command, check=True)
def write_json(fname):
# Data to be written
imgdict ={"TEST": {
"__comment__": "",
"__source__": "",
"__projection__": "PlateCarree",
"high": fname
}
}
# Serializing json
json_object = json.dumps(imgdict, indent=4)
# Writing to sample.json
with open("images.json", "w") as outfile:
outfile.write(json_object)
if __name__=='__main__':
# Download background image
url = "https://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73826/world.topo.bathy.200410.3x5400x2700.jpg"
get_bkg_image(url, 'image.jpg')
# Write images.json
write_json('image.jpg')
# setup environment
os.environ["CARTOPY_USER_BACKGROUNDS"] = os.getcwd()
# setup projection and background_img
proj = ccrs.Stereographic(central_latitude=90.0, central_longitude=0.0)
ax = plt.axes(projection=proj)
ax.background_img(name='TEST', resolution='high', extent = ([-180, 180, 45, 90]))
ax.set_extent([-180, 180, 90, 60], ccrs.PlateCarree())
Description
The method
background_img()
currently displays background images at a lower resolution compared to the original files.The issue is similar to #1708 and in fact I managed to solve it by modifing the source file adding the
regrid_shape
argument, set to 5000.Below I report a test case and the output images, with and without the regrid_shape argument.
I think that it would be beneficial to add
regrid_shape
as optional argument tobackground_img()
.Code to reproduce
Full environment definition
Operating system
Ubuntu 18.04.4 LTS on WSL
Cartopy version
0.23.0
conda list
pip list
The text was updated successfully, but these errors were encountered: