cartopy

County boarders in Cartopy

≡放荡痞女 提交于 2019-12-07 16:24:49
问题 How do you plot US county borders in Cartopy? It's very straight forward to plot state and country boundaries ax.add_feature(cfeature.BORDERS.with_scale('50m')) ax.add_feature(cfeature.STATES.with_scale('50m')) But I can't seem to find a similar method to add county boundaries. This was one of the nice things about Basemap. 回答1: Given cartopy's ability to draw shapefiles, this question essentially boils down to "where can I find US county outlines?". A similar question was asked on the

central longitude for NorthPolarStereo

喜欢而已 提交于 2019-12-07 09:28:18
问题 I'd like to plot a polar stereographic plot of the Northern Hemisphere with 180 at the bottom of the plot so I can emphasize the Pacific region. I'm using the latest cartopy from git, and can make a polar stereographic plot no problem, but I can't work out how to change which longitude is at the bottom of the plot. I tried setting the longitude extent to [-180, 180] but this doesn't help, and the NorthPolarStereo() doesn't accept any keyword arguments like central_longitude. Is this possible

Cartopy behavior when plotting projected data

☆樱花仙子☆ 提交于 2019-12-07 05:36:11
问题 I am using cartopy to draw my maps. Its a great tool! For some of my data I have the problem that the data is not properly mapped around 0deg or the dateline. See the example below. I know the same feature from matplotlib.basemap, where it can be solved by using the add_cyclic routine. I wondered if somebody can recommend how to best fix this problem in cartopy. Thanks! Alex 回答1: When plotting global data like this you will always need to add a cyclic point to your input data and coordinate.

Cartopy: axis label - workaround

做~自己de王妃 提交于 2019-12-07 05:35:20
问题 I am looking for a workaround to add x and y axis ticks and labels to a Cartopy map in Lambert projection. The solution I have come up with is just an approximation which will yield worse results for larger maps: It involves transforming desired tick locations to map projection using the transform_points method. For this I use the median longitude (or latitude) of my y axis (or x axis) together with the desired latitudes (or longitudes) tick positions to compute map projection coordinates.

Make colorbar legend in Matplotlib/Cartopy

好久不见. 提交于 2019-12-07 02:48:52
问题 I've made a geographical heatmap using cartopy and matplotlib, of the number of users of my app, but am having trouble adding a colorbar legend: import cartopy.crs as ccrs import cartopy.io.shapereader as shpreader import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np cmap = mpl.cm.Blues # Countries is a dictionary of {"country_name": number of users}, for example countries = {"United States": 100, "Canada": 50, "China": 10} max_users = float(max(countries.values()))

Custom markers using Python (matplotlib)

不羁岁月 提交于 2019-12-06 21:09:44
I would like to know how I can generate the marker for the black colored line shown in this picture. (Source: NCEP & NOAA) It's the marker for a storm or hurricane in standard weather maps. I can probably generate an image file of the marker symbol. But, I am not aware of how I can tell matplotlib to use the image as a marker. The marker looks like a 6 . If this is the case, you can use a 6 as a marker as follows: import matplotlib.pyplot as plt x = [1,2,3,4] y = [2,3,1,4] plt.scatter(x,y, s= 100,marker="$6$") plt.show() If this is not an option, you may define your custom marker using a path.

cartopy - AlbersEqualArea limit region using lon and lat

心不动则不痛 提交于 2019-12-06 14:23:59
I have data which is -100o - 30o lon and 0o - 80o lat. I would like to use a projection to only show this region. In my head I would like to show a plot like this: However, when I try the AlbersEqualArea projection as follows: plt.figure(figsize=(5.12985642927, 3)) ax = plt.axes(projection=ccrs.AlbersEqualArea(central_longitude=-35, central_latitude=40, standard_parallels=(0, 80))) ax.set_extent([lon180[0], lon180[-1], lat[0], lat[-1]], ccrs.Geodetic()) I get a map showing: What is the best way to show the area that I have data for? Cheers, Ray If you want to have a non-rectangular boundary

Plotting Natural Earth features on a custom projection

淺唱寂寞╮ 提交于 2019-12-06 03:07:16
I am trying to make some plots of sea ice data. The data is delivered in the EASE-North grid, an example file (HDF4) can be downloaded at: ftp://n4ftl01u.ecs.nasa.gov/SAN/OTHR/NISE.004/2013.09.30/ I created a custom projection class for the EASE-Grid, it seems to be working (the coastlines align well with the data). When i try to add a Natural Earth feature, it returns an empty Matplotlib figure. import gdal import cartopy # projection class class EASE_North(cartopy.crs.Projection): def __init__(self): # see: http://www.spatialreference.org/ref/epsg/3408/ proj4_params = {'proj': 'laea', 'lat_0

Geodesic buffering in python

前提是你 提交于 2019-12-06 02:49:41
问题 Given land polygons as a Shapely MultiPolygon , I want to find the (Multi-)Polygon that represents the e.g. 12 nautical mile buffer around the coastlines. Using the Shapely buffer method does not work since it uses euclidean calculations. Can somebody tell me how to calculate geodesic buffers in python? 回答1: This is not a shapely problem, since shapely explicitly tells in its documentation that the library is for planar computation only. Nevertheless, in order to answer your question, you

County boarders in Cartopy

旧时模样 提交于 2019-12-05 23:35:22
How do you plot US county borders in Cartopy? It's very straight forward to plot state and country boundaries ax.add_feature(cfeature.BORDERS.with_scale('50m')) ax.add_feature(cfeature.STATES.with_scale('50m')) But I can't seem to find a similar method to add county boundaries. This was one of the nice things about Basemap. Given cartopy's ability to draw shapefiles, this question essentially boils down to "where can I find US county outlines?". A similar question was asked on the Natural Earth forum at http://www.naturalearthdata.com/forums/topic/u-s-county-shape-file/ . It pointed to a