obs: 35 milhões de observações 1870-1976
In [ ]:
import os
import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset
from mpl_toolkits.basemap import Basemap
def make_basemap(projection='robin', figsize=(10, 5), resolution='c'):
fig, ax = plt.subplots(figsize=figsize)
m = Basemap(projection=projection, resolution=resolution,
lon_0=0, ax=ax)
m.drawcoastlines()
m.fillcontinents(color='0.95')
parallels = np.arange(-60, 90, 30.)
meridians = np.arange(-360, 360, 60.)
m.drawparallels(parallels, labels=[1, 0, 0, 0])
m.drawmeridians(meridians, labels=[0, 0, 1, 0])
return fig, m
In [ ]:
# nc3tonc4 -o --complevel=9 "http://iridl.ldeo.columbia.edu/SOURCES/.HELLERMAN/dods" winds_hellermanAndRosenstein.nc
filename = '../../data/winds_hellermanAndRosenstein.nc'
if os.path.isfile(filename):
nc = Dataset(filename)
else:
nc = Dataset("http://iridl.ldeo.columbia.edu/SOURCES/.HELLERMAN/dods")
lon = nc.variables['X'][:]
lat = nc.variables['Y'][:]
time = nc.variables['T'][:]
taux = nc.variables['taux'][:].mean(axis=0) / 10
tauy = nc.variables['tauy'][:].mean(axis=0) / 10
lon, lat = np.meshgrid(lon, lat)
tau = np.sqrt(taux**2 + tauy**2)
In [ ]:
fig, m = make_basemap(projection='robin', figsize=(14, 8), resolution='c')
cs = m.pcolormesh(lon, lat, tau, cmap=plt.cm.rainbow, latlon=True)
fig.colorbar(cs, extend='both', orientation='horizontal', shrink=0.65, pad=0.05)
Q = m.quiver(lon[cut], lat[cut], taux[cut], tauy[cut], latlon=True)
qk = m.ax.quiverkey(Q, 0.05, 0.05, 0.1, r'1 N m$^{-2}$', labelpos='N')