Esempio n. 1
0
def daves_curtain(file, img_file, section, varname, clim=None):
    if varname == 'U':
        daves_U_curtain(file, img_file, section, varname, clim)
    else:
        x = utils.get_daves_section_var(section=section, var='lon')
        y = utils.get_daves_section_var(section=section, var='lat')

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

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

        plot_utils.plot_parker(
            coords=coords,
            data=data,
            filename=img_file,
            title=title,
            x_axis_offset=utils.offset_region(coords),
            clim=clim,
            cmap='banas_hsv_cm',
            labeled_contour_gap=2,
            caxis_label=clabel_map[varname],
            inset=inset_dict[section],
            ctd_ind=ctd_ind_dict[section],
            label=utils.get_daves_section_var(section=section, var='label'),
            label_ind=utils.get_daves_section_var(section=section,
                                                  var='label_ind'))
    return
Esempio 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])
Esempio n. 3
0
def main_basin_curtain(file, img_file, varname, n=4, clim=None):  # Main Basin
    if varname == 'U':
        main_basin_U_curtain(file, img_file, n, clim)
    else:
        x, y = utils.high_res_main_basin_xy(n=n)

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

        title = '%s %s Main Basin %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='Main Basin',
                               filename=img_file,
                               n=n,
                               x_axis_offset=utils.offset_region(coords),
                               clim=clim,
                               cmap='banas_hsv_cm',
                               labeled_contour_gap=2,
                               title=title,
                               caxis_label=clabel_map[varname])
Esempio n. 4
0
def daves_U_curtain(file, img_file, section, varname, clim):
    x = utils.get_daves_section_var(section=section, var='lon')
    y = utils.get_daves_section_var(section=section, var='lat')
    (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 %s %s %s' % (
        extract_utils.run_title(file),
        os.path.basename(file), section, var_title_map['U'],
        extract_utils.file_time(file).strftime(title_time_fmt))

    plot_utils.plot_parker(coords=coords,
                           data=data,
                           filename=img_file,
                           title=title,
                           x_axis_offset=utils.offset_region(coords),
                           clim=clim,
                           cmap='red_blue',
                           labeled_contour_gap=2,
                           caxis_label=clabel_map[varname],
                           inset=inset_dict[section],
                           ctd_ind=ctd_ind_dict[section],
                           label=utils.get_daves_section_var(section=section,
                                                             var='label'),
                           label_ind=utils.get_daves_section_var(
                               section=section, var='label_ind'))

    return
Esempio n. 5
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'])
Esempio n. 6
0
def surface_map(file, img_file=None, varname='salt', clim=None):
    (data, coords) = rompy.extract(file,
                                   varname=varname,
                                   extraction_type='surface')
    #	plot_utils.plot_surface(coords['xm'],coords['ym'],data)

    title = '%s %s %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_map(coords['xm'],
                        coords['ym'],
                        data,
                        filename=img_file,
                        clim=clim,
                        title=title,
                        caxis_label=clabel_map[varname])
def main_basin_U_curtain(file,img_file,n=1,clim=None): # velocity in Main Basin
	x,y = utils.high_res_main_basin_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 Main Basin %s %s' % (extract_utils.run_title(file), os.path.basename(file), var_title_map['U'], extract_utils.file_time(file).strftime(title_time_fmt))
	
	plot_utils.plot_parker(coords=coords,data=data,varname='U', region=' Main Basin', 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'])
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])
def surface_map(file,img_file=None,varname='salt',clim=None):
	(data, coords) = rompy.extract(file,varname=varname,extraction_type='surface')
#	plot_utils.plot_surface(coords['xm'],coords['ym'],data)
	
	
	title = '%s %s %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_map(coords['xm'],coords['ym'],data,filename=img_file, clim=clim, title=title, resolution=whole_domain_coastline_res, caxis_label=clabel_map[varname])
Esempio n. 10
0
def daves_curtain(file,img_file,section,varname,clim=None):
	if varname == 'U':
		daves_U_curtain(file,img_file,section,varname,clim)
	else:
		x = utils.get_daves_section_var(section=section,var='lon')
		y = utils.get_daves_section_var(section=section,var='lat')
		
		(data, coords) = rompy.extract(file, varname=varname, extraction_type='profile', x=x, y=y)
		
		title = '%s %s %s %s %s' % (extract_utils.run_title(file), os.path.basename(file), section, var_title_map[var], extract_utils.file_time(file).strftime(title_time_fmt))
		
		plot_utils.plot_parker(
			coords=coords,
			data=data,
			filename=img_file,
			title=title,
			x_axis_offset=utils.offset_region(coords),
			clim=clim,
			cmap='banas_hsv_cm',
			labeled_contour_gap=2,
			caxis_label=clabel_map[varname],
			inset=inset_dict[section],
			ctd_ind=ctd_ind_dict[section],
			label=utils.get_daves_section_var(section=section,var='label'),
			label_ind=utils.get_daves_section_var(section=section,var='label_ind')
			)
	return
Esempio n. 11
0
def main_basin_curtain(file,img_file,varname,n=4,clim=None): # Main Basin
	if varname == 'U':
		main_basin_U_curtain(file,img_file,n,clim)
	else:
		x,y = utils.high_res_main_basin_xy(n=n)
		
		(data, coords) = rompy.extract(file, varname=varname, 	extraction_type='profile', x=x, y=y)
		
		title = '%s %s Main Basin %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='Main Basin', filename=img_file, n=n, x_axis_offset=utils.offset_region(coords), clim=clim,cmap='banas_hsv_cm',labeled_contour_gap=2, title=title, caxis_label=clabel_map[varname])
Esempio n. 12
0
def daves_U_curtain(file,img_file,section,varname,clim):
	x = utils.get_daves_section_var(section=section,var='lon')
	y = utils.get_daves_section_var(section=section,var='lat')
	(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 %s %s %s' % (extract_utils.run_title(file), os.path.basename(file), section, var_title_map['U'], extract_utils.file_time(file).strftime(title_time_fmt))

	plot_utils.plot_parker(
		coords=coords,
		data=data,
		filename=img_file,
		title=title,
		x_axis_offset=utils.offset_region(coords),
		clim=clim,
		cmap='red_blue',
		labeled_contour_gap=2,
		caxis_label=clabel_map[varname],
		inset=inset_dict[section],
		ctd_ind=ctd_ind_dict[section],
		label=utils.get_daves_section_var(section=section,var='label'),
		label_ind=utils.get_daves_section_var(section=section,var='label_ind')
		)

	return