cartopy

Drawing circles with Cartopy in NorthPolarStereo projection

北城余情 提交于 2019-12-24 10:49:08
问题 I would like to draw circles in Cartopy in NorthPolarStereo projections, providing the center and radius in lat,lon units. Similar and excellent questions and answers are available for Basemap here, and for Cartopy in Ortographic projection here. However, I would like to use the NorthPolarStereo in Cartopy. Trying the latter approach, just changing the projection makes the circle fixed in the North Pole, ignoring the coordinates you give for its center. Any ideas on how to draw circles in

Match projection of shapefile in cartopy

谁说胖子不能爱 提交于 2019-12-24 08:20:05
问题 I am trying to make a Choropleth map using matplotlib and cartopy for which I obviously need to plot a shapefile first. However, I did not manage to do so, even though a similar question has been asked here and here. I suspect either the projection or the bounds to be misspecified. My shapefile has the projection PROJCS["WGS_1984_UTM_Zone_32Nz", GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_84",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Degree",0.017453292519943295]],

Cartopy coastlines hidden by inset_axes use of Axes.pie

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 07:04:25
问题 I am producing a map of the world with pie charts in individual model grid boxes. I make the map and coastlines using cartopy. The pie charts I produce using inset_axes. Unfortunately the pie charts hide the coastlines and I'd like to see them clearly. Minimum working example: import cartopy.crs as ccrs import numpy as np import cartopy.feature as feature import matplotlib.pyplot as plt def plot_pie_inset(dataframe_pie,ilat_pie,ilon_pie,axis_main,width_local,alpha_local): ax_sub= inset_axes

Change the background colour of a projected Matplotlib axis

给你一囗甜甜゛ 提交于 2019-12-24 03:48:24
问题 I'm trying to create a figure using Cartopy that requires a projected axis to be drawn over an unprojected axis. Here is a simple as possible version of the code that substitutes content on the axes for background colour: import matplotlib.pyplot as plt import cartopy.crs as ccrs #Setup figure fig = plt.figure() #Unprojected axis ax1 = fig.add_subplot(111, axisbg='b') #Projected axis ax2 = fig.add_subplot(111, axisbg='None', projection=ccrs.Mercator()) plt.show() Which instead of leaving the

Mask Ocean or Land from data using Cartopy

青春壹個敷衍的年華 提交于 2019-12-23 03:14:12
问题 I would like to mask the Land area from Sea Surface Temperature Data over the globe. I am using Cartopy to plot the data. import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs from netCDF4 import Dataset f = Dataset('sst.mnmean.nc') sst = f.variables['sst'][0,:,:] lats = f.variables['lat'][:] lons = f.variables['lon'][:] ax = plt.axes(projection=ccrs.PlateCarree()) ax.coastlines() plot = ax.contourf(lons, lats, sst, 60, transform=ccrs.PlateCarree()) cb = plt.colorbar

Mask Ocean or Land from data using Cartopy

∥☆過路亽.° 提交于 2019-12-23 03:14:06
问题 I would like to mask the Land area from Sea Surface Temperature Data over the globe. I am using Cartopy to plot the data. import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs from netCDF4 import Dataset f = Dataset('sst.mnmean.nc') sst = f.variables['sst'][0,:,:] lats = f.variables['lat'][:] lons = f.variables['lon'][:] ax = plt.axes(projection=ccrs.PlateCarree()) ax.coastlines() plot = ax.contourf(lons, lats, sst, 60, transform=ccrs.PlateCarree()) cb = plt.colorbar

Custom markers using Python (matplotlib)

倾然丶 夕夏残阳落幕 提交于 2019-12-23 00:50:18
问题 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. 回答1: 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

Plotting Natural Earth features on a custom projection

戏子无情 提交于 2019-12-22 10:29:37
问题 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 _

Adding gridlines using Cartopy

空扰寡人 提交于 2019-12-22 09:25:59
问题 I'm trying to add gridlines to a map I made using Cartopy, however, when I use the example code from the cartopy documentation, it doesn't display what I want and I can't figure out how to manipulate it to do so. def plotMap(): proj = ccrs.Mercator(central_longitude=180, min_latitude=15, max_latitude=55) fig, ax = plt.subplots(subplot_kw=dict(projection=proj), figsize=(12,12)) ax.set_extent([255 ,115, 0, 60], crs=ccrs.PlateCarree()) ax.add_feature(cfeature.LAND, facecolor='0.3') ax.add

how to import conda packages into google colab?

跟風遠走 提交于 2019-12-21 20:05:16
问题 Hi I was able to install packages in google colab with pip, using: !pip install.... but i am not able to install any package from conda-forge. I tried: !conda install -c conda-forge cartopy thanks in advance! 回答1: One way to get it is to just Unzip the conda package to a directory directly. Get you required conda package from anaconda.org , download it. Decompress them and copy them into the library path Here's an example to install faiss from anaconda using this way. https://gist.github.com