In [1]:
%matplotlib inline
from IPython.core.display import Image
In [2]:
import numpy as np
import matplotlib.pyplot as plt
from nansat import Nansat, Domain, Nansatmap
# access online ice concentration data (IC)
n1 = Nansat(
'http://thredds.met.no/thredds/dodsC/osisaf/met.no/ice/conc/2016/04/ice_conc_nh_polstere-100_multi_201604011200.nc',
bands=['ice_conc'])
# access online sea surface temperature data (SST)
n2 = Nansat(
'http://thredds.met.no/thredds/dodsC/myocean/siw-tac/sst-metno-arc-sst03/20160401000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc',
bands=['analysed_sst'])
# access online sea ice drift data (SID)
n3 = Nansat(
'http://thredds.met.no/thredds/dodsC/osisaf/met.no/ice/drift_lr/merged/2016/04/ice_drift_nh_polstere-625_multi-oi_201604011200-201604031200.nc',
bands=['dX', 'dY'])
# define region of interest
d = Domain('+proj=stere +lon_0=-45 +lat_0=90 +no_defs', '-te 300000 -1200000 1700000 300000 -tr 10000 10000')
# colocate datasets on the region of interest
n1.reproject(d)
n2.reproject(d)
n3.reproject(d)
# retrieve data covering only region of interest
ice_conc = n1['ice_conc']
analysed_sst = n2['analysed_sst']
dX = n3['dX']
dY = n3['dY']
In [3]:
# mask invaid data with Non-A-Number
ice_conc[ice_conc <=1 ] = np.nan
analysed_sst[analysed_sst < 0] = np.nan
# create canvas for drawing a map
nmap = Nansatmap(n2, resolution='l')
# add SST as raster layer and correspodngin colorbar
nmap.imshow(analysed_sst, vmin=270, cmap='viridis')
nmap.add_colorbar(shrink=0.5, pad=0.05)
# add ice concentration as raster layer
nmap.imshow(ice_conc, vmin=0, vmax=100, cmap='bone')
# add ice drift as vectors
nmap.quiver(dX, dY, step=5)
# decorate map with grid
nmap.drawmeridians([-20, 0, 20, 40], labels=[False, True, False, True], fontsize=6)
nmap.drawparallels([75, 80, 85], labels=[True, False, True, False], fontsize=6)
# save as graphical file
nmap.save('nmap_example5.png', dpi=300)
plt.close('all')
In [4]:
Image('nmap_example5.png')
Out[4]:
In [ ]: