Пример #1
0
def mixing_ratio(full_output, **kwargs):
    """Returns plot of mixing ratios 

    Parameters
    ----------
    full_output : class
        picaso.atmsetup.ATMSETUP
    **kwargs : dict 
        Any key word argument for bokeh.figure() 
    """
    #set plot defaults
    molecules = full_output['weights'].keys()
    pressure = full_output['layer']['pressure']

    kwargs['plot_height'] = kwargs.get('plot_height', 300)
    kwargs['plot_width'] = kwargs.get('plot_width', 400)
    kwargs['title'] = kwargs.get('title', 'Mixing Ratios')
    kwargs['y_axis_label'] = kwargs.get('y_axis_label', 'Pressure(Bars)')
    kwargs['x_axis_label'] = kwargs.get('x_axis_label', 'Mixing Ratio(v/v)')
    kwargs['y_axis_type'] = kwargs.get('y_axis_type', 'log')
    kwargs['x_axis_type'] = kwargs.get('x_axis_type', 'log')
    kwargs['y_range'] = kwargs.get(
        'y_range', [np.max(pressure), np.min(pressure)])
    kwargs['x_range'] = kwargs.get('x_range', [1e-20, 1e2])

    fig = figure(**kwargs)
    if len(molecules) < 3: ncol = 5
    else: ncol = len(molecules)
    cols = colfun1(ncol)
    legend_it = []
    for mol, c in zip(molecules, cols):
        ind = np.where(mol == np.array(molecules))[0][0]
        f = fig.line(full_output['layer']['mixingratios'][mol],
                     pressure,
                     color=c,
                     line_width=3,
                     muted_color=c,
                     muted_alpha=0.2)
        legend_it.append((mol, [f]))

    legend = Legend(items=legend_it, location=(0, -20))
    legend.click_policy = "mute"
    fig.add_layout(legend, 'left')

    return fig
Пример #2
0
def flux_at_top(full_output,
                plot_bb=True,
                R=None,
                pressures=[1e-1, 1e-2, 1e-3],
                ng=None,
                nt=None,
                **kwargs):
    """
    Routine to plot the OLR with overlaying black bodies. 

    Flux units are CGS = erg/s/cm^3 
    
    Parameters
    ----------

    full_output : dict 
        full dictionary output with {'wavenumber','thermal','full_output'}
    plot_bb : bool , optional 
        Default is to plot black bodies for three pressures specified by `pressures`
    R : float 
        New constant R to bin to 
    pressures : list, optional 
        Default is a list of three pressures (in bars) =  [1e-1,1e-2,1e-3]
    ng : int    
        Used for 3D calculations to select point on the sphere (equivalent to longitude point)
    nt : int    
        Used for 3D calculations to select point on the sphere (equivalent to latitude point)
    **kwargs : dict 
        Any key word argument for bokeh.figure() 
    """
    if ((ng == None) & (nt == None)):
        pressure_all = full_output['full_output']['layer']['pressure']
        temperature_all = full_output['full_output']['layer']['temperature']
    else:
        pressure_all = full_output['full_output']['layer']['pressure'][:, ng,
                                                                       nt]
        temperature_all = full_output['full_output']['layer'][
            'temperature'][:, ng, nt]

    if not isinstance(pressures, (np.ndarray, list)):
        raise Exception(
            'check pressure input. It must be list or array. You can still input a single value as `pressures = [1e-3]`'
        )

    kwargs['plot_height'] = kwargs.get('plot_height', 300)
    kwargs['plot_width'] = kwargs.get('plot_width', 400)
    kwargs['title'] = kwargs.get('title', 'Outgoing Thermal Radiation')
    kwargs['y_axis_label'] = kwargs.get('y_axis_label', 'Flux (erg/s/cm^3)')
    kwargs['x_axis_label'] = kwargs.get('x_axis_label', 'Wavelength [μm]')
    kwargs['y_axis_type'] = kwargs.get('y_axis_type', 'log')
    kwargs['x_axis_type'] = kwargs.get('x_axis_type', 'log')

    fig = figure(**kwargs)
    if len(pressures) < 3: ncol = 5
    else: ncol = len(pressures)
    cols = colfun1(ncol)

    wno = full_output['wavenumber']
    if isinstance(R, (int, float)):
        wno, thermal = mean_regrid(wno, full_output['thermal'], R=R)
    else:
        thermal = full_output['thermal']
    fig.line(1e4 / wno, thermal, color='black', line_width=4)

    for p, c in zip(pressures, cols):
        ip = find_nearest_1d(pressure_all, p)
        t = temperature_all[ip]
        intensity = blackbody(t, 1 / wno)[0]
        flux = np.pi * intensity
        fig.line(1e4 / wno,
                 flux,
                 color=c,
                 alpha=0.5,
                 legend_label=str(int(t)) + ' K at ' + str(p) + ' bars',
                 line_width=4)

    return fig
Пример #3
0
def cloud(full_output):
    """
    Plotting the cloud input from ``picaso``. 

    The plot itselfs creates maps of the wavelength dependent single scattering albedo 
    and cloud opacity as a function of altitude. 


    Parameters
    ----------
    full_output

    Returns
    -------
    A row of two bokeh plots with the single scattering and optical depth map
    """
    cols = colfun1(200)
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    dat01 = full_output['layer']['cloud']

    #PLOT W0
    scat01 = np.flip(dat01['w0'], 0)  #[0:10,:]
    xr, yr = scat01.shape
    f01a = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavelength (micron)',
                  y_axis_label='Pressure (bar)',
                  title="Single Scattering Albedo",
                  plot_width=300,
                  plot_height=300)

    f01a.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(
        color_mapper=color_mapper,  #ticker=LogTicker(),
        label_standoff=12,
        border_line_color=None,
        location=(0, 0))

    f01a.add_layout(color_bar, 'left')

    #PLOT OPD
    scat01 = np.flip(dat01['opd'] + 1e-60, 0)

    xr, yr = scat01.shape
    cols = colfun2(200)[::-1]
    color_mapper = LogColorMapper(palette=cols, low=1e-3, high=10)

    f01 = figure(x_range=[0, yr],
                 y_range=[0, xr],
                 x_axis_label='Wavelength (micron)',
                 y_axis_label='Pressure (bar)',
                 title="Cloud Optical Depth Per Layer",
                 plot_width=300,
                 plot_height=300)

    f01.image(image=[scat01],
              color_mapper=color_mapper,
              x=0,
              y=0,
              dh=xr,
              dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=LogTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01.add_layout(color_bar, 'left')

    #PLOT G0
    scat01 = np.flip(dat01['g0'] + 1e-60, 0)

    xr, yr = scat01.shape
    cols = colfun3(200)[::-1]
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    f01b = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavelength (micron)',
                  y_axis_label='Pressure (bar)',
                  title="Assymetry Parameter",
                  plot_width=300,
                  plot_height=300)

    f01b.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=BasicTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01b.add_layout(color_bar, 'left')

    #CHANGE X AND Y AXIS TO BE PHYSICAL UNITS
    #indexes for pressure plot
    pressure = [
        "{:.1E}".format(i) for i in full_output['layer']['pressure'][::-1]
    ]  #flip since we are also flipping matrices
    wave = ["{:.2F}".format(i) for i in 1e4 / full_output['wavenumber']]
    nwave = len(wave)
    npres = len(pressure)
    iwave = np.array(range(nwave))
    ipres = np.array(range(npres))
    #set how many we actually want to put on the figure
    #hard code ten on each..
    iwave = iwave[::int(nwave / 10)]
    ipres = ipres[::int(npres / 10)]
    pressure = pressure[::int(npres / 10)]
    wave = wave[::int(nwave / 10)]
    #create dictionary for tick marks
    ptick = {int(i): j for i, j in zip(ipres, pressure)}
    wtick = {int(i): j for i, j in zip(iwave, wave)}
    for i in [f01a, f01, f01b]:
        i.xaxis.ticker = iwave
        i.yaxis.ticker = ipres
        i.xaxis.major_label_overrides = wtick
        i.yaxis.major_label_overrides = ptick

    return row(f01a, f01, f01b)
Пример #4
0
def plot_cld_input(nwno,
                   nlayer,
                   filename=None,
                   df=None,
                   pressure=None,
                   wavelength=None,
                   **pd_kwargs):
    """
    This function was created to investigate CLD input file for PICASO. 

    The plot itselfs creates maps of the wavelength dependent single scattering albedo 
    and cloud opacity and assymetry parameter as a function of altitude. 


    Parameters
    ----------
    nwno : int 
        Number of wavenumber points. For runs from Ackerman & Marley, this will always be 196. 
    nlayer : int 
        Should be one less than the number of levels in your pressure temperature grid. Cloud 
        opacity is assigned for slabs. 
    file : str , optional
        (Optional)Path to cloud input file
    df : str 
        (Optional)Dataframe of cloud input file
    wavelength : array , optional
        (Optional) this allows you to reset the tick marks to wavelengths instead of indicies 
    pressure : array, optional 
        (Optional) this allows you to reset the tick marks to pressure instead of indicies  
    pd_kwargs : kwargs
        Pandas key word arguments for `pandas.read_csv`

    Returns
    -------
    Three bokeh plots with the single scattering, optical depth, and assymetry maps
    """
    if (pressure is not None):
        pressure_label = 'Pressure (units by user)'
    else:
        pressure_label = 'Pressure Grid, TOA ->'
    if (wavelength is not None):
        wavelength_label = 'Wavelength (units by user)'
    else:
        wavelength_label = 'Wavenumber Grid'
    cols = colfun1(200)
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    if not isinstance(filename, type(None)):
        dat01 = pd.read_csv(filename, **pd_kwargs)
    elif not isinstance(df, type(None)):
        dat01 = df

    #PLOT W0
    scat01 = np.flip(np.reshape(dat01['w0'].values, (nlayer, nwno)), 0)
    xr, yr = scat01.shape
    f01a = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label=wavelength_label,
                  y_axis_label=pressure_label,
                  title="Single Scattering Albedo",
                  plot_width=300,
                  plot_height=300)

    f01a.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(
        color_mapper=color_mapper,  #ticker=LogTicker(),
        label_standoff=12,
        border_line_color=None,
        location=(0, 0))

    f01a.add_layout(color_bar, 'left')

    #PLOT OPD
    scat01 = np.flip(np.reshape(dat01['opd'].values, (nlayer, nwno)), 0)

    xr, yr = scat01.shape
    cols = colfun2(200)[::-1]
    color_mapper = LogColorMapper(palette=cols, low=1e-3, high=10)

    f01 = figure(x_range=[0, yr],
                 y_range=[0, xr],
                 x_axis_label=wavelength_label,
                 y_axis_label=pressure_label,
                 title="Cloud Optical Depth Per Layer",
                 plot_width=300,
                 plot_height=300)

    f01.image(image=[scat01],
              color_mapper=color_mapper,
              x=0,
              y=0,
              dh=xr,
              dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=LogTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01.add_layout(color_bar, 'left')

    #PLOT G0
    scat01 = np.flip(np.reshape(dat01['g0'].values, (nlayer, nwno)), 0)

    xr, yr = scat01.shape
    cols = colfun3(200)[::-1]
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    f01b = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label=wavelength_label,
                  y_axis_label=pressure_label,
                  title="Assymetry Parameter",
                  plot_width=300,
                  plot_height=300)

    f01b.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=BasicTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01b.add_layout(color_bar, 'left')

    #CHANGE X AND Y AXIS TO BE PHYSICAL UNITS
    #indexes for pressure plot
    if (pressure is not None):
        pressure = ["{:.1E}".format(i) for i in pressure[::-1]
                    ]  #flip since we are also flipping matrices
        npres = len(pressure)
        ipres = np.array(range(npres))
        #set how many we actually want to put on the figure
        #hard code ten on each..
        ipres = ipres[::int(npres / 10)]
        pressure = pressure[::int(npres / 10)]
        #create dictionary for tick marks
        ptick = {int(i): j for i, j in zip(ipres, pressure)}
        for i in [f01a, f01, f01b]:
            i.yaxis.ticker = ipres
            i.yaxis.major_label_overrides = ptick
    if (wavelength is not None):
        wave = ["{:.2F}".format(i) for i in wavelength]
        nwave = len(wave)
        iwave = np.array(range(nwave))
        iwave = iwave[::int(nwave / 10)]
        wave = wave[::int(nwave / 10)]
        wtick = {int(i): j for i, j in zip(iwave, wave)}
        for i in [f01a, f01, f01b]:
            i.xaxis.ticker = iwave
            i.xaxis.major_label_overrides = wtick

    return row(f01a, f01, f01b)
Пример #5
0
def all_optics(out):
    """
    Maps of the wavelength dependent single scattering albedo 
    and cloud opacity and asymmetry parameter as a function of altitude. 

    Parameters
    ----------
    out : dict 
        Dictionary output from pyeddy run 

    Returns
    -------
    Three bokeh plots with the single scattering, optical depth, and assymetry maps
    """
    #get into DataFrame format
    dat01 = pyeddy.picaso_format(out['opd_per_layer'],
                      out['asymmetry'],out['single_scattering'])

    nwno=len(out['wave'])
    nlayer=len(out['pressure'])
    pressure=out['pressure']

    pressure_label = 'Pressure (Bars)'

    wavelength_label = 'Wavelength (um)'
    wavelength = out['wave']

    cols = colfun1(200)
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    #PLOT W0
    scat01 = np.flip(np.reshape(dat01['w0'].values,(nlayer,nwno)),0)
    xr, yr = scat01.shape
    f01a = figure(x_range=[0, yr], y_range=[0,xr],
                           x_axis_label=wavelength_label, y_axis_label=pressure_label,
                           title="Single Scattering Albedo",
                          plot_width=300, plot_height=300)


    f01a.image(image=[scat01],  color_mapper=color_mapper, x=0,y=0,dh=xr,dw =yr )

    color_bar = ColorBar(color_mapper=color_mapper, #ticker=LogTicker(),
                       label_standoff=12, border_line_color=None, location=(0,0))

    f01a.add_layout(color_bar, 'left')


    #PLOT OPD
    scat01 = np.flip(np.reshape(dat01['opd'].values,(nlayer,nwno)),0)

    xr, yr = scat01.shape
    cols = colfun2(200)[::-1]
    color_mapper = LogColorMapper(palette=cols, low=1e-3, high=10)


    f01 = figure(x_range=[0, yr], y_range=[0,xr],
                           x_axis_label=wavelength_label, y_axis_label=pressure_label,
                           title="Cloud Optical Depth Per Layer",
                          plot_width=320, plot_height=300)

    f01.image(image=[scat01],  color_mapper=color_mapper, x=0,y=0,dh=xr,dw =yr )

    color_bar = ColorBar(color_mapper=color_mapper, ticker=LogTicker(),
                       label_standoff=12, border_line_color=None, location=(0,0))
    f01.add_layout(color_bar, 'left')

    #PLOT G0
    scat01 = np.flip(np.reshape(dat01['g0'].values,(nlayer,nwno)),0)

    xr, yr = scat01.shape
    cols = colfun3(200)[::-1]
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)


    f01b = figure(x_range=[0, yr], y_range=[0,xr],
                           x_axis_label=wavelength_label, y_axis_label=pressure_label,
                           title="Assymetry Parameter",
                          plot_width=300, plot_height=300)

    f01b.image(image=[scat01],  color_mapper=color_mapper, x=0,y=0,dh=xr,dw =yr )

    color_bar = ColorBar(color_mapper=color_mapper, ticker=BasicTicker(),
                       label_standoff=12, border_line_color=None, location=(0,0))
    f01b.add_layout(color_bar, 'left')

    #CHANGE X AND Y AXIS TO BE PHYSICAL UNITS 
    #indexes for pressure plot 
    if (pressure is not None):
        pressure = ["{:.1E}".format(i) for i in pressure[::-1]] #flip since we are also flipping matrices
        npres = len(pressure)
        ipres = np.array(range(npres))
        #set how many we actually want to put on the figure 
        #hard code ten on each.. 
        ipres = ipres[::int(npres/10)]
        pressure = pressure[::int(npres/10)]
        #create dictionary for tick marks 
        ptick = {int(i):j for i,j in zip(ipres,pressure)}
        for i in [f01a, f01, f01b]:
            i.yaxis.ticker = ipres
            i.yaxis.major_label_overrides = ptick
    if (wavelength is not None):
        wave = ["{:.2F}".format(i) for i in wavelength]
        nwave = len(wave)
        iwave = np.array(range(nwave))
        iwave = iwave[::int(nwave/10)]
        wave = wave[::int(nwave/10)]
        wtick = {int(i):j for i,j in zip(iwave,wave)}
        for i in [f01a, f01, f01b]:
            i.xaxis.ticker = iwave
            i.xaxis.major_label_overrides = wtick       

    return row(f01a, f01,f01b)
Пример #6
0
def cloud(full_output):
    """
	Plotting the cloud input from ``picaso``. 

	The plot itselfs creates maps of the wavelength dependent single scattering albedo 
	and cloud opacity as a function of altitude. 


	Parameters
	----------
	full_output

	Returns
	-------
	A row of two bokeh plots with the single scattering and optical depth map
	"""
    cols = colfun1(200)
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    dat01 = full_output['layer']['cloud']

    #PLOT W0
    scat01 = np.flip(dat01['w0'], 0)  #[0:10,:]
    xr, yr = scat01.shape
    f01a = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavenumber Grid',
                  y_axis_label='Pressure Grid, TOA ->',
                  title="Single Scattering Albedo",
                  plot_width=300,
                  plot_height=300)

    f01a.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(
        color_mapper=color_mapper,  #ticker=LogTicker(),
        label_standoff=12,
        border_line_color=None,
        location=(0, 0))

    f01a.add_layout(color_bar, 'left')

    #PLOT OPD
    scat01 = np.flip(dat01['opd'] + 1e-60, 0)

    xr, yr = scat01.shape
    cols = colfun2(200)[::-1]
    color_mapper = LogColorMapper(palette=cols, low=1e-3, high=10)

    f01 = figure(x_range=[0, yr],
                 y_range=[0, xr],
                 x_axis_label='Wavenumber Grid',
                 y_axis_label='Pressure Grid, TOA ->',
                 title="Cloud Optical Depth Per Layer",
                 plot_width=300,
                 plot_height=300)

    f01.image(image=[scat01],
              color_mapper=color_mapper,
              x=0,
              y=0,
              dh=xr,
              dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=LogTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01.add_layout(color_bar, 'left')

    #PLOT G0
    scat01 = np.flip(dat01['g0'] + 1e-60, 0)

    xr, yr = scat01.shape
    cols = colfun3(200)[::-1]
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    f01b = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavenumber Grid',
                  y_axis_label='Pressure Grid, TOA ->',
                  title="Assymetry Parameter",
                  plot_width=300,
                  plot_height=300)

    f01b.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=BasicTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01b.add_layout(color_bar, 'left')
    return column(row(f01a, f01, row(f01b)))
Пример #7
0
def plot_cld_input(nwno, nlayer, filename=None, df=None, **pd_kwargs):
    """
	This function was created to investigate CLD input file for PICASO. 

	The plot itselfs creates maps of the wavelength dependent single scattering albedo 
	and cloud opacity and assymetry parameter as a function of altitude. 


	Parameters
	----------
	nwno : int 
		Number of wavenumber points. For runs from Ackerman & Marley, this will always be 196. 
	nlayer : int 
		Should be one less than the number of levels in your pressure temperature grid. Cloud 
		opacity is assigned for slabs. 
	file : str 
		(Optional)Path to cloud input file
	df : str 
		(Optional)Dataframe of cloud input file
	pd_kwargs : kwargs
		Pandas key word arguments for `pandas.read_csv`

	Returns
	-------
	Three bokeh plots with the single scattering, optical depth, and assymetry maps
	"""
    cols = colfun1(200)
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    if not isinstance(filename, type(None)):
        dat01 = pd.read_csv(filename, **pd_kwargs)
    elif not isinstance(df, type(None)):
        dat01 = df

    #PLOT W0
    scat01 = np.flip(np.reshape(dat01['w0'].values, (nlayer, nwno)), 0)
    xr, yr = scat01.shape
    f01a = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavenumber Grid',
                  y_axis_label='Pressure Grid, TOA ->',
                  title="Single Scattering Albedo",
                  plot_width=300,
                  plot_height=300)

    f01a.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(
        color_mapper=color_mapper,  #ticker=LogTicker(),
        label_standoff=12,
        border_line_color=None,
        location=(0, 0))

    f01a.add_layout(color_bar, 'left')

    #PLOT OPD
    scat01 = np.flip(np.reshape(dat01['opd'].values, (nlayer, nwno)), 0)

    xr, yr = scat01.shape
    cols = colfun2(200)[::-1]
    color_mapper = LogColorMapper(palette=cols, low=1e-3, high=10)

    f01 = figure(x_range=[0, yr],
                 y_range=[0, xr],
                 x_axis_label='Wavenumber Grid',
                 y_axis_label='Pressure Grid, TOA ->',
                 title="Cloud Optical Depth Per Layer",
                 plot_width=300,
                 plot_height=300)

    f01.image(image=[scat01],
              color_mapper=color_mapper,
              x=0,
              y=0,
              dh=xr,
              dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=LogTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01.add_layout(color_bar, 'left')

    #PLOT G0
    scat01 = np.flip(np.reshape(dat01['g0'].values, (nlayer, nwno)), 0)

    xr, yr = scat01.shape
    cols = colfun3(200)[::-1]
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    f01b = figure(x_range=[0, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavenumber Grid',
                  y_axis_label='Pressure Grid, TOA ->',
                  title="Assymetry Parameter",
                  plot_width=300,
                  plot_height=300)

    f01b.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=BasicTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))
    f01b.add_layout(color_bar, 'left')
    return column(row(f01a, f01, row(f01b)))
def investigate_fsed(directory, metal, distance, fsed, plot_file='plot.html'):
    """
      This functionw as created to investigate CLD output from the grid created in Batalha+2018. 
      The CLD files are not included in the SQLite database so these file names refer to the 
      specific naming function and directory. These files are available upon request. 
      Email [email protected] 

      The plot itselfs plots maps of the wavelength dependent single scattering albedo 
      and cloud opacity for up to three different fseds at a single metallicty and distance. 
      It was created becaues there are several times when fsed does funky numerical things 
      in the upper layers of the atmosphere. 

      Parameters
      ----------
      directory : str 
            Directory which points to the fortney grid of cloud output from Ackerman Marley code 
      metal : str 
            Metallicity: Options are m0.0 m0.5  m1.0  m1.5  m1.7  m2.0
      distance : str 
            Distance to G-type star. Options are d0.5 d0.6  d0.7  d0.85 d1.0  d1.5  d2.0  d3.0  d4.0  d5.0
      fsed : list of str 
            Up to three sedimentation efficiencies. Options are f0.01 f0.03 f0.3 f1 f3 f6
      plot_file : str 
            (Optional)This is the html plotting file Default = 'plot.html'
      """
    cols = colfun1(200)
    color_mapper = LinearColorMapper(palette=cols, low=0, high=1)

    dat01 = pd.read_csv(os.path.join(
        directory, metal, distance,
        metal + 'x_rfacv0.5-nc_tint150-' + fsed[0] + '-' + distance + '.cld'),
                        header=None,
                        delim_whitespace=True)
    dat1 = pd.read_csv(os.path.join(
        directory, metal, distance,
        metal + 'x_rfacv0.5-nc_tint150-' + fsed[1] + '-' + distance + '.cld'),
                       header=None,
                       delim_whitespace=True)
    dat6 = pd.read_csv(os.path.join(
        directory, metal, distance,
        metal + 'x_rfacv0.5-nc_tint150-' + fsed[2] + '-' + distance + '.cld'),
                       header=None,
                       delim_whitespace=True)

    scat01 = np.flip(np.reshape(dat01[4], (60, 196)), 0)  #[0:10,:]
    scat1 = np.flip(np.reshape(dat1[4], (60, 196)), 0)  #[0:10,:]
    scat6 = np.flip(np.reshape(dat6[4], (60, 196)), 0)  #[0:10,:]

    xr, yr = scat01.shape

    f01a = figure(x_range=[150, yr],
                  y_range=[0, xr],
                  x_axis_label='Wavelength Grid',
                  y_axis_label='Pressure Grid, TOA ->',
                  title="Scattering Fsed = 0.01",
                  plot_width=300,
                  plot_height=300)

    f1a = figure(x_range=[150, yr],
                 y_range=[0, xr],
                 x_axis_label='Wavelength Grid',
                 y_axis_label='Pressure Grid, TOA ->',
                 title="Scattering Fsed = 0.3",
                 plot_width=300,
                 plot_height=300)

    f6a = figure(x_range=[150, yr],
                 y_range=[0, xr],
                 x_axis_label='Wavelength Grid',
                 y_axis_label='Pressure Grid, TOA ->',
                 title="Scattering Fsed = 1",
                 plot_width=300,
                 plot_height=300)

    f01a.image(image=[scat01],
               color_mapper=color_mapper,
               x=0,
               y=0,
               dh=xr,
               dw=yr)
    f1a.image(image=[scat1], color_mapper=color_mapper, x=0, y=0, dh=xr, dw=yr)
    f6a.image(image=[scat6], color_mapper=color_mapper, x=0, y=0, dh=xr, dw=yr)

    color_bar = ColorBar(
        color_mapper=color_mapper,  #ticker=LogTicker(),
        label_standoff=12,
        border_line_color=None,
        location=(0, 0))

    f01a.add_layout(color_bar, 'right')

    #PLOT OPD
    scat01 = np.flip(np.reshape(dat01[2] + 1e-60, (60, 196)), 0)
    scat1 = np.flip(np.reshape(dat1[2] + 1e-60, (60, 196)), 0)
    scat6 = np.flip(np.reshape(dat6[2] + 1e-60, (60, 196)), 0)
    xr, yr = scat01.shape
    cols = colfun2(200)[::-1]
    color_mapper = LogColorMapper(palette=cols, low=1e-3, high=10)

    f01 = figure(x_range=[150, yr],
                 y_range=[0, xr],
                 x_axis_label='Wavelength Grid',
                 y_axis_label='Pressure Grid, TOA ->',
                 title="Optical Depth Fsed = 0.01",
                 plot_width=300,
                 plot_height=300)

    f1 = figure(x_range=[150, yr],
                y_range=[0, xr],
                x_axis_label='Wavelength Grid',
                y_axis_label='Pressure Grid, TOA ->',
                title="Optical Depth Fsed = 0.3",
                plot_width=300,
                plot_height=300)

    f6 = figure(x_range=[150, yr],
                y_range=[0, xr],
                x_axis_label='Wavelength Grid',
                y_axis_label='Pressure Grid, TOA ->',
                title="Optical Depth Fsed = 1",
                plot_width=300,
                plot_height=300)

    f01.image(image=[scat01],
              color_mapper=color_mapper,
              x=0,
              y=0,
              dh=xr,
              dw=yr)
    f1.image(image=[scat1], color_mapper=color_mapper, x=0, y=0, dh=xr, dw=yr)
    f6.image(image=[scat6], color_mapper=color_mapper, x=0, y=0, dh=xr, dw=yr)

    color_bar = ColorBar(color_mapper=color_mapper,
                         ticker=LogTicker(),
                         label_standoff=12,
                         border_line_color=None,
                         location=(0, 0))

    f01.add_layout(color_bar, 'right')
    output_file(plot_file)
    show(row(column(f01a, f1a, f6a), column(f01, f1, f6)))