cartopy

Python 3.4 crashes when producing some – but not all – Cartopy maps with segmentation fault 11

∥☆過路亽.° 提交于 2019-12-01 19:14:34
I have installed the Python mapping tool Cartopy on a Mac running El Capitan 10.11.6 with Python 3.4. I can use Cartopy to successfully plot some maps but, in some cases, the Python kernel dies with Segmentation Fault 11. I wanted a setup that I could remove easily from my computer should the need arise. Therefore, I installed Python 3.4 and the necessary dependencies using fink: $ fink install python34 $ fink install gdal2 $ fink install gdal2-dev $ fink install proj $ fink install libproj9 I then created a virtual environment using pyvenv (but also tried virtualenv and venv) and activated it

Cartopy: order of rendering layers with scatter data

蓝咒 提交于 2019-12-01 04:47:25
I am trying to plot position of several points (scatter plot) on a map using Cartopy (see code below). When I try to render the plot, data-points are rendered behind LAND-layer. But I want to plot my scatter-data over LAND-layer... What I am doing wrong? Cartopy: ver. 0.12.x, Matplotlib: ver.1.4.2 import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature ax = plt.axes(projection=ccrs.PlateCarree()) ax.set_extent([125, 150, 35, 63]) ax.stock_img() ax.add_feature(cfeature.LAND) #If I comment this => all ok, but I need ax.add_feature(cfeature.LAKES) ax.add

Cartopy: order of rendering layers with scatter data

倾然丶 夕夏残阳落幕 提交于 2019-12-01 03:01:43
问题 I am trying to plot position of several points (scatter plot) on a map using Cartopy (see code below). When I try to render the plot, data-points are rendered behind LAND-layer. But I want to plot my scatter-data over LAND-layer... What I am doing wrong? Cartopy: ver. 0.12.x, Matplotlib: ver.1.4.2 import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature ax = plt.axes(projection=ccrs.PlateCarree()) ax.set_extent([125, 150, 35, 63]) ax.stock_img() ax.add

Why the annotate worked unexpected here in cartopy?

蹲街弑〆低调 提交于 2019-11-30 13:24:42
问题 Code first: import cartopy.crs as ccrs import matplotlib.pyplot as plt ax = plt.axes(projection=ccrs.Mercator()) ax.set_extent([72, 135, 18, 53]) ax.annotate('hello', xy=(100, 49), xycoords='data', transform=ccrs.PlateCarree(), zorder=12) plt.show() The result is not the expected one, and I have other doubts about my approach. So my questions are: If I want to plot a map looks like the web map (eg. google map). The map area maybe is as large as China, mostly not global. After googling around,

3D CartoPy similar to Matplotlib-Basemap

ε祈祈猫儿з 提交于 2019-11-30 09:56:42
I'm new to Python with a question about Cartopy being able to be used in a 3D plot. Below is an example using matplotlibBasemap . import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.basemap import Basemap m = Basemap(projection='merc', llcrnrlat=52.0,urcrnrlat=58.0, llcrnrlon=19.0,urcrnrlon=40.0, rsphere=6371200.,resolution='h',area_thresh=10) fig = plt.figure() ax = Axes3D(fig) ax.add_collection3d(m.drawcoastlines(linewidth=0.25)) ax.add_collection3d(m.drawcountries(linewidth=0.35)) ax.add_collection3d(m.drawrivers(color='blue')) ax.set_xlabel('X') ax.set

Why the annotate worked unexpected here in cartopy?

五迷三道 提交于 2019-11-30 09:40:28
Code first: import cartopy.crs as ccrs import matplotlib.pyplot as plt ax = plt.axes(projection=ccrs.Mercator()) ax.set_extent([72, 135, 18, 53]) ax.annotate('hello', xy=(100, 49), xycoords='data', transform=ccrs.PlateCarree(), zorder=12) plt.show() The result is not the expected one, and I have other doubts about my approach. So my questions are: If I want to plot a map looks like the web map (eg. google map). The map area maybe is as large as China, mostly not global. After googling around, those sites use a "web mercator" projection mostly. So I suppost I should use plt.axes(projection=ccrs

Correct placement of colorbar relative to geo axes (cartopy)

北城余情 提交于 2019-11-29 05:43:55
Using Cartopy, I would like to have full control of where my colorbar goes. Usually I do this by getting the current axes position as basis and then create new axes for the colorbar. This works well for standard matplotlib axes but not when using Cartopy and geo_axes, because this will distort the axes. So, my question is: how do I get the exact position of my geo_axes? Here is a code example based on the Cartopy docs http://scitools.org.uk/cartopy/docs/latest/matplotlib/advanced_plotting.html : import cartopy.crs as ccrs import matplotlib.pyplot as plt import os from netCDF4 import Dataset as

Location of stored offline data for cartopy

社会主义新天地 提交于 2019-11-29 04:28:35
Where is offline data stored in cartopy? Is it stored in the data folder under site-packages? Is there any way to trigger the downloading of all available data? I would like to copy this over to a Linux machine that is not connected to the internet. I'm currently working from a Windows machine that is connected to the internet, so I'm hoping to download the data from there. Thanks. Take a look at the config docs in http://scitools.org.uk/cartopy/docs/latest/cartopy.html . Essentially, the data is downloaded to the data_dir item in that config. For me that looks like: >>> import cartopy.config

Draw a map of a specific country with cartopy?

风流意气都作罢 提交于 2019-11-28 21:41:53
I have tried this example here, which works fine. But how do I focus on another country, i.e. show only germany? source for this example http://scitools.org.uk/cartopy/docs/latest/examples/hurricane_katrina.html exampl of us map http://scitools.org.uk/cartopy/docs/latest/_images/hurricane_katrina_01_00.png I've tried some coordinates on the extend() method, but I didn't manage to get to look it like the US map. Or do I have to modify the shape file? Using the Global Administrative Areas dataset at http://www.gadm.org/country , just download the Germany dataset and use cartopy's shapereader (in

Why does pcolor with masked arrays fill undesired quadrangles when projected in cartopy coordinates?

别等时光非礼了梦想. 提交于 2019-11-28 14:21:01
This is a followup question to preventing spurious horizontal lines for ungridded pcolor(mesh) data and why does pcolor with masked array still fill quadrangles connecting to masked points, and how do I stop this? . In regular coordinates, when I mask both the coordinates and the data, I can plot a pcolor for coordinates that wrap around, such as longitudes, in two parts, and now I succeed to not get undesired quadrangles when in regular coordinates. However, when I transform it to map coordinates, this solution fails: #!/usr/bin/env python3.6 from numpy import array, ma from matplotlib.pyplot