Skip to content
Snippets Groups Projects
Commit 6610dd03 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Replace basemap by cartopy

parent 7ed9c874
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import netCDF4
from mpl_toolkits import basemap
import cartopy.crs as ccrs
import jumble
from matplotlib import pyplot as plt
import glob
import itertools
m = basemap.Basemap(llcrnrlon=-30, llcrnrlat=-90, urcrnrlon=60, urcrnrlat = 0)
plt.figure()
m.drawcoastlines()
m.drawmeridians(range(0,361, 15), labels = [0, 0, 0, 1])
m.drawparallels(range(-90,91, 15), labels = [1, 0, 0, 0])
ax = plt.axes(projection=ccrs.PlateCarree())
colors = itertools.cycle(['blue', 'orange', 'green', 'red', 'purple', 'brown',
'pink', 'gray', 'olive', 'cyan'])
......@@ -27,6 +24,9 @@ for filename in glob.glob("h_region_*.nc") + ["h_outermost.nc"]:
jumble.draw_bbox(f[lon][0], f[lon][-1], f[lat][0], f[lat][-1],
colors = next(colors), label = filename)
ax.set_extent((-30, 60, -90, 0), ccrs.PlateCarree())
ax.coastlines()
ax.gridlines(draw_labels = True)
plt.legend(loc = "lower left", bbox_to_anchor = (1, 0.5))
plt.subplots_adjust(right = 0.7)
plt.savefig("regions.pdf")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment