In [16]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import Image
from nansat import Nansat, Domain, Nansatmap
# SST
#http://data.nodc.noaa.gov/thredds/catalog/ghrsst/L4/GLOB/UKMO/OSTIA/2012/121/catalog.html?dataset=ghrsst/L4/GLOB/UKMO/OSTIA/2012/121/20120430-UKMO-L4HRfnd-GLOB-v01-fv02-OSTIA.nc.bz2
n1 = Nansat('/files/normap/20120430-UKMO-L4HRfnd-GLOB-v01-fv02-OSTIA.nc')
# ice concentration
#http://thredds.met.no/thredds/catalog/osisaf/met.no/ice/conc/2012/04/catalog.html?dataset=osisaf/met.no/ice/conc/2012/04/ice_conc_nh_polstere-100_multi_201204301200.nc
n2 = Nansat('/files/normap/ice_conc_nh_polstere-100_multi_201204301200.nc')
# currents from GLOBCURRENT
#http://www.ifremer.fr/opendap/cerdap1/globcurrent/global_010_deg/total_hs/2012/121/20120430000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc
#n3 = Nansat('/files/normap/20120430000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc')
#n3 = Nansat('http://www.ifremer.fr/opendap/cerdap1/globcurrent/global_010_deg/total_hs/2012/121/20120430000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc')
#print n3
# ice drift
# http://thredds.met.no/thredds/catalog/osisaf/met.no/ice/drift_lr/merged/2012/04/catalog.html?dataset=osisaf/met.no/ice/drift_lr/merged/2012/04/ice_drift_nh_polstere-625_multi-oi_201204281200-201204301200.nc
n4 = Nansat('/files/normap/ice_drift_nh_polstere-625_multi-oi_201204281200-201204301200.nc')
# wind
n5 = Nansat('/files/normap/gfs.t00z.master.grbf00')
minLon = -16
maxLon = 16
minLat = 64
maxLat = 83
d = Domain(4326, '-te %f %f %f %f -tr 0.05 0.05' % (minLon, minLat, maxLon, maxLat))
n1.reproject(d)
n2.reproject(d)
#n3.reproject(d)
n4.reproject(d)
n5.reproject(d)
print 'get arrays with data'
sst = n1['analysed_sst']
ice_conc = n2['ice_conc']
#u = n3['eastward_total_current_velocity_hs000']
#v = n3['northward_total_current_velocity_hs000']
lons, lats = n3.get_geolocation_grids()
uw = n5['U']
vw = n5['V']
dx = n4['dX']
dy = n4['dY']
print 'Mask invalid data'
# mask land
watermask = n1.watermask('/files/MOD44W/')[1]
sst[watermask == 2] = np.nan
#u[watermask == 2] = np.nan
#v[watermask == 2] = np.nan
ice_conc[watermask == 2] = np.nan
dx[watermask == 2] = np.nan
dy[watermask == 2] = np.nan
# mask invalid U and V
#u[u<-10] = np.nan
#v[v<-10] = np.nan
# mask zero ice concentration
ice_conc[ice_conc <= 0] = np.nan
# mask under-ice currents
#u[ice_conc > 0] = np.nan
#v[ice_conc > 0] = np.nan
# mask invalid SST
sst[sst < 0] = np.nan
# mask invalid ice displacement
dx[ice_conc == 0] = np.nan
dy[ice_conc == 0] = np.nan
# mask wind over ice
uw[ice_conc > 0.5] = np.nan
vw[ice_conc > 0.5] = np.nan
In [20]:
print np.nanmin(sst)-273.15
print np.nanmax(sst)-273.15
print np.nanmin(dx)
print np.nanmax(dy)
print np.nanmin(uw)
print np.nanmax(vw)
In [18]:
nmap = Nansatmap(n1, resolution='l')
nmap.pcolormesh(sst-273.15, vmin=-5, vmax=13)
nmap.pcolormesh(ice_conc, cmap='bone')
nmap.quiver(-dx, -dy, step=15, width=0.0015, scale=1000)
nmap.streamplot(lons, lats, u, v, density=5, linewidth=np.hypot(u,v)*10, color='k')
stp = 50
nmap.barbs(lons[::stp, ::stp], lats[::stp, ::stp], uw[::stp, ::stp], vw[::stp, ::stp],
pivot='middle', barbcolor='w', linewidth=3)
nmap.draw_continents()
nmap.drawmeridians(np.arange(minLon, maxLon, 5), labels=[False,False,True,False])
nmap.drawparallels(np.arange(minLat, maxLat, 3), labels=[True, False, False, False])
# set size of the figure (inches)
nmap.fig.set_figheight(20)
nmap.fig.set_figwidth(15)
# save figure to a PNG file
nmap.save('h2020_scube4ocean.png')
In [2]:
uw.min()
In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import Image
from nansat import Nansat, Domain, Nansatmap
# SST
#http://data.nodc.noaa.gov/thredds/catalog/ghrsst/L4/GLOB/UKMO/OSTIA/2012/121/catalog.html?dataset=ghrsst/L4/GLOB/UKMO/OSTIA/2012/121/20120430-UKMO-L4HRfnd-GLOB-v01-fv02-OSTIA.nc.bz2
n1 = Nansat('/files/normap/20120430-UKMO-L4HRfnd-GLOB-v01-fv02-OSTIA.nc')
# ice concentration
#http://thredds.met.no/thredds/catalog/osisaf/met.no/ice/conc/2012/04/catalog.html?dataset=osisaf/met.no/ice/conc/2012/04/ice_conc_nh_polstere-100_multi_201204301200.nc
n2 = Nansat('/files/normap/ice_conc_nh_polstere-100_multi_201204301200.nc')
minLon = -40
maxLon = 80
minLat = 60
maxLat = 85
d = Domain(4326, '-te %f %f %f %f -tr 0.05 0.05' % (minLon, minLat, maxLon, maxLat))
n1.reproject(d)
n2.reproject(d)
print 'get arrays with data'
sst = n1['analysed_sst']
ice_conc = n2['ice_conc']
print 'Mask invalid data'
# mask land
watermask = n1.watermask('/files/MOD44W/')[1]
sst[watermask == 2] = np.nan
ice_conc[watermask == 2] = np.nan
# mask zero ice concentration
ice_conc[ice_conc <= 0] = np.nan
# mask invalid SST
sst[sst < 0] = np.nan
# make map canvas
nmap = Nansatmap(n1, resolution='l')
nmap.pcolormesh(sst-273.15, vmin=-5, vmax=13)
nmap.pcolormesh(ice_conc, cmap='bone')
nmap.draw_continents()
# set size of the figure (inches)
nmap.fig.set_figheight(20)
nmap.fig.set_figwidth(30)
# save figure to a PNG file
nmap.save('h2020_scube4ocean_map.png')