Exemplo n.º 1
0
def hood_canal_curtain(file, img_file, varname, n=1, clim=None):  # Hood Canal
    if var == 'U':
        hood_canal_U_curtain(file, img_file, n, clim)
    else:
        x, y = utils.high_res_hood_canal_xy(n=n)

        (data, coords) = rompy.extract(file,
                                       varname=varname,
                                       extraction_type='profile',
                                       x=x,
                                       y=y)

        title = '%s %s Hood Canal %s %s' % (
            extract_utils.run_title(file),
            os.path.basename(file), var_title_map[var],
            extract_utils.file_time(file).strftime(title_time_fmt))

        plot_utils.plot_parker(coords=coords,
                               data=data,
                               varname=varname,
                               region='Hood Canal',
                               filename=img_file,
                               n=n,
                               x_axis_offset=utils.offset_region(coords),
                               clim=clim,
                               cmap='banas_hsv_cm',
                               labeled_contour_gap=2,
                               title=title,
                               resolution=inset_coastline_resolution,
                               caxis_label=clabel_map[varname])
Exemplo n.º 2
0
def hood_canal_curtain(file,img_file,varname,n=1,clim=None): # Hood Canal
	if var == 'U':
		hood_canal_U_curtain(file,img_file,n,clim)
	else:
		x,y = utils.high_res_hood_canal_xy(n=n)
		
		(data, coords) = rompy.extract(file, varname=varname, extraction_type='profile', x=x, y=y)
		
		title = '%s %s Hood Canal %s %s' % (extract_utils.run_title(file), os.path.basename(file), var_title_map[var], extract_utils.file_time(file).strftime(title_time_fmt))
		
		plot_utils.plot_parker(coords=coords, data=data, varname=varname, region='Hood Canal', filename=img_file, n=n,  x_axis_offset=utils.offset_region(coords), clim=clim, cmap='banas_hsv_cm',labeled_contour_gap=2, title=title, resolution=inset_coastline_resolution, caxis_label=clabel_map[varname])
Exemplo n.º 3
0
def hood_canal_U_curtain(file,
                         img_file,
                         n=1,
                         clim=None):  # velocity in Hood Canal
    x, y = utils.high_res_hood_canal_xy(n=n)
    (u, coords) = rompy.extract(file,
                                varname='u',
                                extraction_type='profile',
                                x=x,
                                y=y)
    (v, coords) = rompy.extract(file,
                                varname='v',
                                extraction_type='profile',
                                x=x,
                                y=y)
    data = np.zeros(u.shape)

    for i in range(u.shape[1]):
        if i == u.shape[1] - 1:
            x_vec = np.array([x[i] - x[i - 1], y[i] - y[i - 1]])
        else:
            x_vec = np.array([x[i + 1] - x[i], y[i + 1] - y[i]])
        for j in range(u.shape[0]):
            u_vec = np.array([u[j, i], v[j, i]])
            data[j, i] = np.dot(x_vec, u_vec) / (np.sqrt(np.dot(x_vec, x_vec)))

    data = np.ma.array(data, mask=np.abs(data) > 100)

    title = '%s %s Hood Canal %s %s' % (
        extract_utils.run_title(file),
        os.path.basename(file), var_title_map['U'],
        extract_utils.file_time(file).strftime(title_time_fmt))

    hood_U_clim = (np.array(clim) / 2.0).tolist()

    plot_utils.plot_parker(coords=coords,
                           data=data,
                           varname='U',
                           region='Hood Canal',
                           filename=img_file,
                           n=n,
                           clim=clim,
                           x_axis_offset=utils.offset_region(coords),
                           cmap='red_blue',
                           title=title,
                           resolution=inset_coastline_resolution,
                           caxis_label=clabel_map['U'])
Exemplo n.º 4
0
def hood_canal_U_curtain(file,img_file,n=1,clim=None): # velocity in Hood Canal
	x,y = utils.high_res_hood_canal_xy(n=n)
	(u, coords) = rompy.extract(file,varname='u',extraction_type='profile',x=x,y=y)
	(v, coords) = rompy.extract(file,varname='v',extraction_type='profile',x=x,y=y)
	data = np.zeros(u.shape)

	for i in range(u.shape[1]):
		if i == u.shape[1]-1:
			x_vec = np.array([x[i] - x[i-1], y[i] - y[i-1]])
		else:
			x_vec = np.array([x[i+1] - x[i], y[i+1] - y[i]])
		for j in range(u.shape[0]):
			u_vec = np.array([u[j,i], v[j,i]])
			data[j,i] = np.dot(x_vec,u_vec)/(np.sqrt(np.dot(x_vec,x_vec)))
	
	data = np.ma.array(data, mask=np.abs(data) > 100)
	
	title = '%s %s Hood Canal %s %s' % (extract_utils.run_title(file), os.path.basename(file), var_title_map['U'], extract_utils.file_time(file).strftime(title_time_fmt))
	
	hood_U_clim = (np.array(clim)/2.0).tolist()
	
	plot_utils.plot_parker(coords=coords,data=data,varname='U', region='Hood Canal', filename=img_file, n=n, clim=clim, x_axis_offset=utils.offset_region(coords), cmap='red_blue', title=title, resolution=inset_coastline_resolution, caxis_label=clabel_map['U'])
Exemplo n.º 5
0
    plot_utils.plot_mickett(
        coords=coords,
        data=data,
        varname='Temperature',
        region='Main Basin',
        filename='/Users/lederer/tmp/rompy.mickett_main_temp.png',
        n=n,
        x_axis_offset=utils.offset_region(coords),
        clim=[0, 20],
        cmap='banas_hsv_cm',
        labeled_contour_gap=2)

if map8:  # Hood Canal
    print('map8')
    n = 10
    x, y = utils.high_res_hood_canal_xy(n=n)
    # Salinity
    (data, coords) = rompy.extract('ocean_his_0001.nc',
                                   varname='salt',
                                   extraction_type='profile',
                                   x=x,
                                   y=y)

    plot_utils.plot_mickett(
        coords=coords,
        data=data,
        varname='Salinity',
        region='Hood Canal',
        filename='/Users/lederer/tmp/rompy.mickett_hood_salt.png',
        n=n,
        x_axis_offset=utils.offset_region(coords),
Exemplo n.º 6
0
	x,y = utils.high_res_main_basin_xy(n=n)
	
	# Salinity
	(data, coords) = rompy.extract('ocean_his_0001.nc', varname='salt', extraction_type='profile', x=x, y=y)
	
	plot_utils.plot_mickett(coords=coords, data=data, varname='Salinity', region='Main Basin', filename='/Users/lederer/tmp/rompy.mickett_main_salt.png', n=n, x_axis_offset=utils.offset_region(coords), clim=[0,20,32,32], cmap='banas_hsv_cm', labeled_contour_gap=2)
	
	# Temperature
	(data, coords) = rompy.extract('ocean_his_0001.nc',varname='temp',extraction_type='profile',x=x,y=y)
	
	plot_utils.plot_mickett(coords=coords, data=data, varname='Temperature', region='Main Basin', filename='/Users/lederer/tmp/rompy.mickett_main_temp.png', n=n,  x_axis_offset=utils.offset_region(coords), clim=[0,20], cmap='banas_hsv_cm', labeled_contour_gap=2)

if map8: # Hood Canal
	print('map8')
	n=10
	x,y = utils.high_res_hood_canal_xy(n=n)
	# Salinity
	(data, coords) = rompy.extract('ocean_his_0001.nc', varname='salt', extraction_type='profile', x=x, y=y)
	
	plot_utils.plot_mickett(coords=coords, data=data, varname='Salinity', region='Hood Canal', filename='/Users/lederer/tmp/rompy.mickett_hood_salt.png', n=n,  x_axis_offset=utils.offset_region(coords), clim=[0,20,32,32], cmap='banas_hsv_cm')
	
	# Temperature
	(data, coords) = rompy.extract('ocean_his_0001.nc', varname='temp', extraction_type='profile', x=x, y=y)
	
	plot_utils.plot_mickett(coords=coords, data=data, varname='Temperature', region='Hood Canal', filename='/Users/lederer/tmp/rompy.mickett_hood_temp.png', n=n, x_axis_offset=utils.offset_region(coords), clim=[0,20], cmap='banas_hsv_cm')

if map9: # velocity in Hood Canal
	print('map9')
	n=20
	x,y = utils.high_res_hood_canal_xy(n=n)
	(u, coords) = rompy.extract('ocean_his_0001.nc',varname='u',extraction_type='profile',x=x,y=y)