#!/usr/bin/env python # coding: utf-8 # # Load my Hurricane Sandy model results # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt import numpy as np import netCDF4 # In[2]: nc = netCDF4.Dataset('http://jetstream.signell.us/thredds/dodsC/local/Sandy_ocean_his.nc') get_ipython().run_line_magic('time', "temp = nc['temp'][1,:,:,:]") # In[3]: nc = netCDF4.Dataset('Sandy_ocean_his.nc') get_ipython().run_line_magic('time', "temp = nc['temp'][-1,:,:,:]") # In[4]: import cartopy.crs as ccrs from cartopy.feature import NaturalEarthFeature, COLORS from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER # In[5]: LAND = NaturalEarthFeature('physical', 'land', '10m', edgecolor='face', facecolor=COLORS['land']) # In[6]: nc['temp'].shape # In[7]: lon = nc['lon_rho'][:] lat = nc['lat_rho'][:] crs = ccrs.PlateCarree() fig, ax = plt.subplots(figsize=(10,8),subplot_kw=dict(projection=ccrs.Mercator())) ax.set_extent([lon.min(), lon.max(), lat.min(), lat.max()]) ax.add_feature(LAND) ax.coastlines(resolution='10m') gl = ax.gridlines(draw_labels=True) gl.xlabels_top = gl.ylabels_right = False gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER p = ax.pcolormesh(lon, lat, nc['Hwave'][50,:,:], transform = crs); plt.colorbar(p); # In[ ]: