3
votes

I am trying to make a plot of sea ice concentration over the North Pole using a Polar Stereographic Projection with Basemap. The map returned has all the formatting done to the projection but doesn't have any data. I'm able to make a plot with a cylindrical projection using the same data, but when I change the projection over to 'npstere' it is blank. I've tried different datasets but the map is blank no matter what dataset I use.

Here is the map produced (screenshot, the saved plot is just blank)

Blank_map

Here is my code, I am using Python3.5, Matplotlib 2.2.2, and Basemap 1.0.7

# load packages
%matplotlib inline
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

# load data
icedata = xr.open_dataset('IceData/G10010_SIBT1850_v1.1_JF.nc', decode_times=False)
seaice_1850 = icedata.seaice_conc_JF[0]

# make map projection
map_fig = Basemap(projection='npstere', boundinglat=50 ,lon_0=0)

# get lat/lon formatted
lon_1d = icedata.longitude.values
lat_1d = icedata.latitude.values
lon_2d, lat_2d = np.meshgrid(lon_1d, lat_1d)

# plot data over map
map_fig.pcolormesh(lon_2d, lat_2d, seaice_1850, cmap='jet')

# make it pretty
map_fig.drawcoastlines()
map_fig.drawparallels(np.arange(-80.,81.,10.))
map_fig.drawmeridians(np.arange(-180.,181.,20.))
plt.colorbar()
plt.show()
1
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ? - Patol75
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong. - Sarah Thunberg

1 Answers

0
votes

Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.