I'm migrating from basemap to Cartopy and would like to plot ocean bottom topography with high resolution for a limited area. In basemap I was using ETOPO1_Ice_g_gmt4.grd and transforming it to map coordinates based on documentation I had found somewhere. I don't know how to do that for Cartopy. Can anyone help? Cheers, Sünnje
Update: Code in Basemap
map = Basemap(projection = 'merc', llcrnrlat = 67.2, urcrnrlat = 69.5,\
llcrnrlon = 8, urcrnrlon = 16.5, lat_ts = 67.5,)
topoFile = nc.NetCDFFile('/home/sunnje/data/ETOPO1_Ice_g_gmt4.grd','r')
topoLons = topoFile.variables['x'][:]
topoLats = topoFile.variables['y'][:]
topoZ = topoFile.variables['z'][:]
# transform to nx x ny regularly spaced 1km native projection grid
nx = int((map.xmax - map.xmin)/1000.)+1
ny = int((map.ymax - map.ymin)/1000.)+1
topodat = map.transform_scalar(topoZ,topoLons,topoLats,nx,ny)
tyi = np.linspace(map.ymin,map.ymax,topodat.shape[0])
txi = np.linspace(map.xmin,map.xmax,topodat.shape[1])
ttxi, ttyi = np.meshgrid(txi,tyi)
cm = map.contour(ttxi, ttyi, topodat)
First, here is a demo code and its output map using cartopy. It uses the projection and map's extent that you specified.
To modify the code to plot your data, just change (xs,ys,zs) to (ttxi, ttyi, topodat).