Questions tagged [cartopy]
Cartopy is a Python package harnessing the power of matplotlib to deliver informative, precise and striking maps.
768
questions
0
votes
0
answers
22
views
python when loading shp with cartopy function
Im getting an error:
OSError: exception: access violation writing 0x0000000000000000
While trying to load an shp with sr.Reader() function.
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
...
0
votes
1
answer
32
views
Cartopy cannot show latitude labels in projection of EckertIII
Cartopy is not showing latitude labels in a simple plot.
What can be set to show the latitude labels?
The codes will create the figure, but the lat labels not shown.
If change the projection to ...
1
vote
2
answers
53
views
How to apply a point transformation to many points?
I have a gridded temperature dataset and a list of weather stations across the country and their latitudes and longitudes. I want to find the grid points that are nearest to the weather stations. My ...
1
vote
1
answer
23
views
ValueError when running cartopy example
I've installed cartopy with pip install cartopy matplotlib -U
Now I'm trying to run a very simple cartopy example from the gallery:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import ...
2
votes
0
answers
51
views
Why do we use crs.PlateCarree() instead of crs.Geodetic() when using Matplotlib and Cartopy to plot a map based on lat and lon?
I've been learning how to use Cartopy and Matplotlib to plot map. But I have a question regarding the argument transform. According to the Cartopy document, transform specifies "what coordinate ...
0
votes
1
answer
42
views
Cartopy - Plot 2d geodata as function of 2d longitude and latitude
I would like to plot from the following netcdf file (R90C_20P_MSG_201403250100.nc) the 2d array RFnet as function of teh 2d arrays LONGITUDE and LATITUDE.
Download of netcdf file:
https://gigamove....
0
votes
0
answers
36
views
How to only plot a specific value of a categorial dataset using pcolormesh
I am trying to plot categorial precipitation type and I have a colormap I want to use as the array either includes -0.99 (no precip) or 0.99 (precip). I want to know how to only plot when the data is ...
1
vote
0
answers
27
views
Rendering a map under the grid on x-y plane in a 3D slice plot with python
I'm currently working on combining 2D contour plots to build a 3D plot in one figure. I would like to add a map under the x-y plane grid to visualize the dataset's position. Is this possible in some ...
0
votes
0
answers
36
views
Do not plot gridlines/contourlines/coastlines outside of the canvas with cartopy
I'm plotting a map panel with cartopy in eps format. The resulting plot looks fine but has very broad margins when I insert it into my latex document. When checking the plot with adobe illustrator, it ...
-1
votes
2
answers
34
views
why the scatter plot can not be on the map created by cartopy
plt.figure(figsize = (10,10),dpi =150)
ax = plt.axes(projection=ccrs.EuroPP())
ax.coastlines(resolution='50m')
ax.set_extent([-16., 5., 49., 61.])
plt.scatter([10.,15.],[52.5,55.],marker='o',s = 100,...
0
votes
1
answer
43
views
How to add a legend to cartopy plot?
I'm currently working with some data that involves the land use type (i.e., forested, desert, water, etc.) that comes up as different colors on my cartopy maps. I want to add a legend or equivalent ...
0
votes
1
answer
48
views
Earth map generator alternative to Basemap
Since Basemap is deprecated, is there any other alternative such cartopy, geopandas, etc.. that can generate this beautiful maps (and not just the contour-type) that I got with Basemap with different ...
1
vote
1
answer
35
views
Checking if points fall into shapefile (polygons and points are in different unit)
I'm trying to create a mask following this question's answer, so that I can color areas inside my shape file only. I will post the code example here (which is pretty much the same with the code in my ...
1
vote
1
answer
79
views
Mask area outside of a shape file with Cartopy and Geopandas
I have a set of data with (lon, lat, temperature) that I have plotted with Cartopy. The minimum example that I can give is the code below (with only 30 data points)
import cartopy.crs as ccrs
import ...
1
vote
1
answer
32
views
Add rectangle to map made with Cartopy python to select subspace
I have made the following map with Cartopy:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([-80, 40, 20, 90], crs=ccrs....
2
votes
1
answer
65
views
Is Cartopy capable of plotting georeferenced data from another planet (e.g., Mars, the Moon)?
I'm working with several data sets from the Moon and Mars (topography, crustal thickness) and was wondering if Cartopy can manipulate these data given the reference ellipsoids are different. Do custom ...
-1
votes
1
answer
37
views
Cartopy: Why can't add feature LAND working?
I want to plot the average intensity of Sea Surface Temperature map using cartopy.
Here is the result:
I want to clarify that I want to fill ocean map with average intensity and the land map with ...
0
votes
0
answers
34
views
How to plot a grid using cartopy or xarray from basic grid info?
I have this grid data to plot the grid on top of another map made with xarray. But I'm not sure how to create a grid from these variables. I saw this but couldn't replicate it. Any advice is welcome.
...
0
votes
1
answer
31
views
How to convert Cartopy tiles in gray scale (2022)
I'm trying to display topography data as a background to put some flooding data I have on top. And I want to display this topography in a certain color scale (gray seems to be popular) to avoid having ...
2
votes
2
answers
415
views
Can't install Proj 8.0.0 for cartopy linux
I am trying to install Cartopy on Ubuntu and need to install proj v8.0.0 binaries for Cartopy. However when I try to apt-get install proj-bin I can only get proj v6.3.1. How do I install the latest (...
0
votes
0
answers
22
views
How to fetch shapely TopologyException point within contourf call
I'm trying to plot netCDF data using cartopy + matplotlib (contourf) call, however on some occasions the data generate invalid polygon instances through contourf and the following error is thrown (...
0
votes
1
answer
52
views
How to deal well with normal and cartopy projection on the same figure?
I want to produce this kind of figure, taken from Sallee et al. (2021) directly from Python if it is possible :
There is a Cartopy projection cartopy.crs.Robinson(central_longitude=0, globe=None) in ...
0
votes
1
answer
92
views
How to transform wind vector on Cartopy PlateCarree projection having central longitude 180
I'm new to python. I calculated the divergent wind part from netCDF4 file format 'u' wind and 'v' wind using windspharm python package and then I wanted to plot the divergent wind vector using 'quiver'...
1
vote
1
answer
42
views
Python : Cartopy and pcolormesh, do a loop
I an actually in internship, and I want to plot some temperature of the ocean surface data of a map for each months for on years (I want for 50 years but I will see later) and I want it to be focus on ...
0
votes
1
answer
28
views
Force CartoPy Map To Fill Entire GridSpec Row
I am using GridSpec and Subplots in combination with CartoPy to make a custom multi-line title region for generated plots. The code below generates the following figure, please note that for ...
1
vote
1
answer
105
views
No module named 'cartopy' + Concepts
I am working through the tutorial on this webpage here in a Jupyter notebook on a Mac: https://towardsdatascience.com/kriging-the-french-temperatures-f0389ca908dd. Near the end of the exercise, I ...
0
votes
1
answer
48
views
Customize multiple subplots with cartopy in Python
I try to customize plots in longer vertical size with subplots using cartopy, but still can't figure out how to increase height of each plots (vertical height).
import matplotlib.pyplot as plt
import ...
0
votes
0
answers
37
views
Align image with Sinusoidal projection correctly using imshow and cartopy
I'm trying to plot an image with a Sinusoidal projection using imshow but if I use the transform=ccrs.Sinusoidal(central_longitude=128) it's not working at all and using the transform=ccrs.PlateCarree(...
0
votes
2
answers
74
views
How to remove N and E symbol in Cartopy lat-lon gridliner ticks
I am trying to remove capital N and E symbols in Cartopy gridline tick-labels. Just I want to keep the numeric value with degree symbol(°), e.g., 10°,15°,20°... instead of, 10°N,15°N,20°N..., as shown ...
0
votes
0
answers
41
views
Scatter data not overlaying properly on radar data... cartopy issue
I'm trying to plot scatter data of storm reports on top of radar gridded data and I seem to be getting strange plotting issues related to mapping using cartopy. See example image attached. It appears ...
0
votes
1
answer
34
views
Cartopy contourf and coastlines but the coastlines aren't showing
I'm trying to plot precipitation data of a region downloaded from GESC Earthdata archive using cartopy's contourf and coastlines but for some reason only the cmap of data is showing and the coastlines ...
1
vote
3
answers
70
views
How to deal with the colorbar axis space in matplotlib subplots
I am plotting seven different parameters over four seasons, as shown in below image. but on last column (Post-Monsoon) sub_plots axis compromised with colorbar axis, that is really awkward!!
import ...
0
votes
1
answer
17
views
Gridlineerror with Cartopy
I used this line thousend times:
gl= ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
linewidth=1, color='gray', alpha=0.5, linestyle='--')
for different plots. Now i wanted ...
1
vote
0
answers
34
views
How to make a square array dataset on polar stereo-graphic projection from general lat-lon gridded netCDF dataset?
I would like to convert shape of dataset from general lat-lon girdded netCDF dataset to a square array on the polar stereographic projection for making training dataset for a deep learning project (...
2
votes
1
answer
104
views
How to mask data that appears in the ocean using cartopy and matplotlib
Not at all sure what I'm doing wrong besides perhaps the order that I am plotting the ocean in. I am trying to get the ocean feature in to mask the data in the ocean. I am trying to get data to not ...
1
vote
1
answer
59
views
Matplotlib with Cartopy and gridspec
I would like to create a plot with a Cartopy plot on the left-hand side and two stacked Matplotlib plots on the right-hand side. If I'd only use Matplotlib plots, the code would be as follows.
import ...
1
vote
1
answer
71
views
Matplotlib Contour/Contourf in Cartopy singularity at North Pole/ dateline
I am trying to produce heatmaps showing atmospheric attenuation values for a RF link to a satellite above the North Pole, but I have issues with the interpolation done by the Matplotlib contour/...
0
votes
0
answers
25
views
Remove black values in a modis merge image
the following image shows my actuall result of a merged modis image.
I used pyhdf.SD to open and manipulate and plot the data in a loop. It started on the right upper corner.
The plot is ok... put on ...
0
votes
1
answer
18
views
Cartopy Cimgt not retrieving tiles within PySpark notebook
Cartopy version 0.18.0. This works in a juptyer notebook:
import cartopy.io.img_tiles as cimgt
import matplotlib.pyplot as plt
extent =[-94, -84, 43, 37]
request=cimgt.GoogleTiles(desired_tile_form='...
2
votes
1
answer
76
views
Removing Edge colors in Cartopy heatmap
I am attempting to plot a heatmap showing the density of lightning using python's cartopy and matplotlib libraries.
I have roughly followed the code here Cartopy Heatmap over OpenStreetMap Background ....
1
vote
0
answers
51
views
Cartopy/Matplotlib savefig slow for lcc projections
We're in the process of migrating from Basemap to Cartoy and finding the savefig functionality to be a far too slow for our app, specifically when using the LambertConformal CRS. I ran a quick check ...
0
votes
0
answers
54
views
How to add a scale colorbar to Cartopy map?
I have created a Cartopy map plot using the following code:
lon = precip_full1.variables['longitude'][:]
lat = precip_full1.variables['latitude'][:]
precip_full1 = xr.open_dataset('era_yr1979.nc')
...
0
votes
0
answers
34
views
ax = plt.axes(projection=ccrs.Mercator()) give an error
I have the following program:
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
birddata = pd.read_csv("...
0
votes
0
answers
22
views
Adding coastlines to GOES data
I have a lot of GOES data that I'd like to plot with coastlines. I've added matplotlib axes with the proper project of each data and plotted the data. I tried to add coastlines with cartopy but they ...
0
votes
0
answers
24
views
How to combine color field and colored markers on one map?
Goal: to plot the regression coefficient as a color field and markers of certain values (in my case it is EOF analysis, so eigenvector values) in each location.
Problems:
when I add line s = df['EOF1'...
1
vote
1
answer
609
views
Trying to install cartopy, but keep getting this: Getting requirements to build wheel ... error error: subprocess-exited-with-error
I tried doing "conda install -c conda-forge cartopy in an anaconda prompt, but that does not do anything even though it says done.
In my command prompt, I try pip install cartopy and the message ...
0
votes
1
answer
79
views
Coordinate alignment off when using Metpy assign_y_x coordinates with manual CRS
I am having issues with the function that assigns y and x coordinates values for grid mapping. Essentially my end goal is to be able to extract grid values from a given set of lat/lon pairs, which ...
0
votes
0
answers
46
views
Making cartopy figure apply transform to just one axis
I have data in x, z, where x is longitude in degrees, and z is an altitude in km.
I'd like to be able to use Cartopy's "intelligent" handling of the longitude axis (namely, the ability to ...
0
votes
0
answers
18
views
Mapping a box contour. Are there any mapping alternatives to pcolor?
I have created a map that interpolates values between gridpoints, using Cartopy 'contouf'
I'm wondering if there is a way I can change the map so that it doesn't interpolate, and so instead each grid ...
1
vote
2
answers
139
views
Using a for loop to make a cartopy plot of lines from different latitude and longitude coordinates from a csv file
The goal for my code is to make a rough roadmap using the latitude and longitude of the exits on the pennsylvania turnpike drawing a line between each exit.
I am using a for loop to plot a line on the ...