m = Basemap(projection='robin', resolution='c', lat_0=0, lon_0=0)
m.drawcoastlines()
m.drawcountries()
lons, lats = nc.variables['lon'][:], nc.variables['lat'][:]
lons, lats = numpy.meshgrid(lons, lats)
x, y = m(lons, lats)
nc_vars = numpy.array(nc.variables[var_name])
nc_new = maskoceans(lons, lats, nc_vars[(len(tmax) - 1), :, :])
cs = m.contourf(x, y, nc_new, numpy.arange(0.0, 1.0, 0.1), cmap=plt.cm.RdBu)
cb = m.colorbar(cs, 'bottom', size='5%', pad='2%')
cb.set_label('Land cover percentage ' + var_name + ' in ' + os.path.
    basename(path_nc))
plt.show()
plot_map('perc_crops.nc', 'LU_Corn.nc')
Plotting oceans in maps using basemap and python