cartopy

python xarray tick label size issue

纵饮孤独 提交于 2019-12-11 13:44:13
问题 I am new for xarray and cartopy. I want to ask how can I increase/decrease labelsize on x-/y- ticks. Following is my code. fig = plt.figure(figsize=(18,8)) ax = plt.axes(projection =ccrs.PlateCarree()) ax.add_feature(cartopy.feature.LAND,facecolor='wheat') ax.add_feature(cartopy.feature.OCEAN) ax.add_feature(cartopy.feature.STATES, linestyle='-',lw=1.0,edgecolor='white') ax.add_feature(cartopy.feature.BORDERS, linestyle='-',lw=2.5,edgecolor='white') gp = ds.isel(time=0).gpm.plot.pcolormesh(

Download data from Natural Earth and OpenStreetMap for Cartopy

二次信任 提交于 2019-12-11 07:36:01
问题 I'm trying to use cartopy to plot several maps and I want to use them offline. Cartopy has a data directory, import cartopy.config cartopy.config {'data_dir': '/home/user/.local/share/cartopy', 'downloaders': {('shapefiles', 'gshhs'): <cartopy.io.shapereader.GSHHSShpDownloader at 0x7f3ee33ee7d0>, ('shapefiles', 'natural_earth'): <cartopy.io.shapereader.NEShpDownloader at 0x7f3ee33ee710>}, 'pre_existing_data_dir': '', 'repo_data_dir': '/home/user/bin/virtualenvs/mobi/local/lib/python2.7/site

Cartopy pcolormesh with re-normalized colorbar

亡梦爱人 提交于 2019-12-11 06:43:42
问题 I'm trying to plot global Aerosol Optical Depths (AOD), and the values are typically around 0.2, but in some regions can reach 1.2 or more. Ideally I want to plot these high values, without losing the detail of the smaller values. A log scale color bar isn't really appropriate either, so I've tried to use two linear ranges as described in the docs: import matplotlib.pyplot as plt import matplotlib.colors as colors import numpy as np import cartopy.crs as ccrs class MidpointNormalize(colors

How do I match the projection of my cartopy map with that of a shapefile?

送分小仙女□ 提交于 2019-12-11 05:54:35
问题 I am trying to synthesise the projections of a coastlines() map with that of a shapefile, whose .prj file says: GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984", SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] My attempt is: import matplotlib.pyplot as plt import cartopy.crs as ccrs from cartopy.io import shapereader # set up a map with coastlines around Auckland: plt.figure(figsize=(10, 10)) platecarree = ccrs.PlateCarree(globe=ccrs.Globe

Geopandas world map in Polar Stereographic projection with coloured oceans

旧时模样 提交于 2019-12-11 04:19:41
问题 Adding a further requirement to this question, I also need to have the oceans in blue (or any other colour). For the 'PlateCarree' projection I can simply do this crs = ccrs.PlateCarree() crs_proj4 = crs.proj4_init world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")) w = world.to_crs(crs_proj4) g = w.plot(facecolor='sandybrown', edgecolor='black') And now adding the ocean colour g.set_facecolor('#A8C5DD') If I now want to use a polar stereographic peojection ccrs

How to plot the field of view of an Earth-Observation satellite when close to the poles using basemap?

老子叫甜甜 提交于 2019-12-10 18:46:42
问题 I am trying to draw the maximum (theoretical) field of view of a satellite along its orbit. I am using Basemap, on which I want to plot different positions along the orbit (with scatter), and I would like to add the whole field of view using the tissot method (or equivalent). The code below works fine until the latitude reaches about 75 degrees North, on a 300km altitude orbit. Beyond which the code outputs a ValueError: "ValueError: undefined inverse geodesic (may be an antipodal point)"

Cartopy examples produce a Segmentation fault

末鹿安然 提交于 2019-12-10 18:22:13
问题 Cartopy can't draw virtually anything. Even a simple example results in a segfault. Segmentation fault is all Python 3.7.0 says before crashing. So does Python 3.6.6 . The faulty line appear to be ax.coastlines() . ax.gridlines() gives the same silent segfault as well. matplotlib is 2.2.3 . Cartopy is the most recent by the date, 0.16.0 , installed with pip . All the requirements ( six , pyshp , setuptools , shapely , numpy ) are met. Reinstalling with pip doesn't help. Installing the same

3D CartoPy similar to Matplotlib-Basemap

前提是你 提交于 2019-12-08 23:36:01
问题 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

Get projected coordinates from geometric coordinates

倖福魔咒の 提交于 2019-12-08 11:50:34
问题 I have a map figure rendered with Cartopy and Matplotlib. I have a specific geometric coordinate (in lat/lon) and I would like to know the pixel coordinate closest to this geometric coordinate's projection (if it is visible), for instance to draw a graphic over the coordinate on the map. (Note I don't want to draw with Matplotlib; I'm exporting the figure as a bitmap image and drawing in a different part of the pipeline.) This documentation suggests it might be something like this: import

cartopy - AlbersEqualArea limit region using lon and lat

 ̄綄美尐妖づ 提交于 2019-12-08 01:01:41
问题 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