cartopy

Plotting country labels with cartopy

Plotting country labels with cartopy Question: I am trying to create a map overview using cartopy, but for some reason cannot figure out how to plot the names of the countries shown on the map. My function looks like this: import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature from cartopy.mpl.gridliner import …

Total answers: 1

Plotting tiles of nighttime lights from multiple h5 files into one big map

Plotting tiles of nighttime lights from multiple h5 files into one big map Question: I am trying to create a map of nighttime lights for Europe. Data source is NASA and I am using their VNP46A1 data for 2022/03/27 (you can find the exact files in my Dropbox, too). For downloading the data, I select …

Total answers: 3

Changing `ylim` on `cartopy` with different `central_longitude`

Changing `ylim` on `cartopy` with different `central_longitude` Question: I want to create a map on Mercator projection from -60S to 60N but with -160W as the central longitude. import matplotlib.pyplot as plt import cartopy.crs as ccrs fig = plt.figure() ax = fig.add_subplot(1,1,1, projection=ccrs.PlateCarree(central_longitude=0) ) ax.set_extent([-180,180,-60,60]) ax.coastlines(resolution=’110m’) ax.gridlines(draw_labels=True) Returns the expected result for central_longitude=0 But if …

Total answers: 1

Add element to matplotlib/cartopy map a posteriori

Add element to matplotlib/cartopy map a posteriori Question: I am using the following code to obtain an empty version of a map. import matplotlib.pyplot as plt import cartopy.feature as cfeature import cartopy.crs as ccrs cstm=[31.69347, -116.88353, 31.96507, -116.57810] def map_canvas(cstm, land = True, land_color=’darkgreen’): fig, mppng = plt.subplots(subplot_kw=dict(projection=ccrs.PlateCarre())) mppng.set_extent([min(cstm[1], cstm[3]), max(cstm[1], cstm[3]), min(cstm[0], cstm[2]), max(cstm[0], …

Total answers: 1

Trouble plotting quivers from netcdf file

Trouble plotting quivers from netcdf file Question: I am trying to plot wind quivers from a NetCDF file, however, I can only plot one line of quivers, straight across the base map, as seen in the image. The code is below. Thank you very much for any help 🙂 data is here, please replace with …

Total answers: 1

Cartopy python Package (PEP 517) wheel building

Cartopy python Package (PEP 517) wheel building Question: I am trying to make a program with tropycal but it shows a wheel building error for a package dependency. Called Cartopy. Pip3 Error: ERROR: Could not build wheels for cartopy which use PEP 517 and cannot be installed directly. I tried a solution from another StackOverflow …

Total answers: 2

Create a land mask from latitude and longitude arrays

Create a land mask from latitude and longitude arrays Question: Given latitude and longitude arrays, I’m tryin to genereate a land_mask, an array of the same size that tells whether a coordinate is land or not. lon=np.random.uniform(0,150,size=[1000,1000]) lat=np.random.uniform(-90,90,size=[1000,1000]) from global_land_mask import globe land_mask=globe.is_land(lat,lon) This is a very efficient method to create land mask if all …

Total answers: 1

How to restrict plot area in imshow plot?

How to restrict plot area in imshow plot? Question: Given: – 1- Data data (the entire data is to plotted). 2- A geostationary projection map_proj=crss.Geostationary(central_longitude=82.4) over which the data is to be plotted. 3- An area bounded within the geostationary projection where data is to be plotted by plt.imshow method. I want the data to …

Total answers: 1

Add rectangle to map made with Cartopy python to select subspace

Add rectangle to map made with Cartopy python to select subspace Question: 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.PlateCarree()) ax.coastlines(resolution=’50m’, linewidth=.5, color=’black’) # add map plt.show() and I would lie to add a rectagle to indicate a subspace. …

Total answers: 2