Exemplo n.º 1
0
    if desired_rvals == ['all']:
        ir_vals = np.arange(nr)
    else:
        for i in range(len(desired_rvals)):
            rval = desired_rvals[i]
            ir_vals.append(np.argmin(np.abs(rvals - rval)))

# What is given is now what is desired
desired_rvals = rvals[ir_vals]

# Get power associated with desired quantity (should really have a contigency
# where the routine exits if the desired quantity isn't present
if not (varname == 'vtot' or varname == 'btot' or varname == 'omtot'):
    desired_qv = var_indices[varname]
    iq = np.argmin(np.abs(qv - desired_qv))
    varlabel = texlabels.get(varname, 'qval = ' + varname)
    units = texunits.get(varname, 'cgs')
else:
    if varname == 'vtot':
        desired_qv_vals = [1, 2, 3]
        varlabel = r'$|\mathbf{v}|$'
        units = r'$\rm{m}\ \rm{s}^{-1}$'
    elif varname == 'btot':
        desired_qv_vals = [801, 802, 803]
        varlabel = r'$|\mathbf{B}|$'
        units = r'$\rm{G}$'
    elif varname == 'omtot':
        desired_qv_vals = [301, 302, 303]
        varlabel = r'$|\mathbf{\omega}|$'
        units = r'$\rm{s}^{-1}$'
    iq_vals = []
                field = vals[:, :, ir]

                # Make axes and plot the Mollweide projection
                ax_left = margin_x + (iplot % ncol) * (subplot_width +
                                                       margin_x)
                ax_bottom = 1. - margin_top - margin_subplot_top -\
                        subplot_height - (iplot//ncol)*(subplot_height +\
                        margin_subplot_top + margin_bottom)
                ax = fig.add_axes(
                    (ax_left, ax_bottom, subplot_width, subplot_height))

                plot_moll(field, a.costheta, fig=fig, ax=ax, clon=clon,\
                        minmax=minmax)

                # label the subplot
                varlabel = texlabels.get(varname, 0)
                if varlabel == 0:
                    varlabel = varname.replace('plus', ' + ')
                    varlabel = varlabel.replace('times',
                                                ' ' + r'$\times$' + ' ')
                    varlabel = varlabel.replace('smooth', '')
                    varlabel = varlabel[3:]
                    varlabel = 'qvals = ' + varlabel
                ax.set_title(varlabel, verticalalignment='bottom', **csfont)

                # Make title
                if iplot == 0:
                    ax_xmin, ax_xmax, ax_ymin, ax_ymax = axis_range(ax)
                    ax_delta_x = ax_xmax - ax_xmin
                    ax_delta_y = ax_ymax - ax_ymin
                    ax_center_x = ax_xmin + 0.5 * ax_delta_x