How to use the tonic.plot_utils.cmap_discretize function in tonic

To help you get started, we’ve selected a few tonic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
'amap': cmap_discretize('cm.RdBu_r')},
                       'c': {'vmin': 0,
                             'vmax': 2.5,
                             'amin': -0.5,
                             'amax': 0.5,
                             'amap': cmap_discretize('cm.RdBu_r')},
                       'elev': {'vmin': 0,
                                'vmax': 2500,
                                'amin': -200,
                                'amax': 200,
                                'amap': cmap_discretize('cm.RdBu_r')},
                       'annual_prec': {'vmin': 0,
                                       'vmax': 2000,
                                       'amin': -500,
                                       'amax': 500,
                                       'amap': cmap_discretize('cm.RdBu')}}

    if not plot_atts_9:
        plot_atts_9 = {'soil_density': {'vmin': 0,
                                        'vmax': 4000,
                                        'amin': -500,
                                        'amax': 500,
                                        'amap': cmap_discretize('cm.RdBu_r')},
                       'bulk_density': {'vmin': 0,
                                        'vmax': 1800,
                                        'amin': -100,
                                        'amax': 100,
                                        'amap': cmap_discretize('cm.RdBu_r')},
                       'Wpwp_FRACT': {'vmin': 0,
                                      'vmax': 1,
                                      'amin': -0.4,
                                      'amax': 0.4,
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
def my_plot3(lons, lats, d1, d2, units=None,
             vmin=None, vmax=None, amin=None,
             amax=None, mask=True, amap=None,
             t1='', t2='', cmap=None):
    """ 3 pannel plot to compare two different datasets"""
    if vmin is None:
        vmin = d1.min()
    if vmax is None:
        vmax = d1.max()

    if not cmap:
        cmap = cmap_discretize('cm.winter')

    if not amap:
        amap = cmap_discretize('cm.RdBu')

    d1 = np.ma.masked_where(mask, d1)
    d2 = np.ma.masked_where(mask, d2)

    anom = d1 - d2

    if amin is None:
        amin = -1 * np.max(np.abs(anom))
    if amax is None:
        amax = np.max(np.abs(anom))

    f, axarr = plt.subplots(1, 3, figsize=(13.5, 4), dpi=150)
    f.tight_layout()
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
def my_plot3(lons, lats, d1, d2, units=None,
             vmin=None, vmax=None, amin=None,
             amax=None, mask=True, amap=None,
             t1='', t2='', cmap=None):
    """ 3 pannel plot to compare two different datasets"""
    if vmin is None:
        vmin = d1.min()
    if vmax is None:
        vmax = d1.max()

    if not cmap:
        cmap = cmap_discretize('cm.winter')

    if not amap:
        amap = cmap_discretize('cm.RdBu')

    d1 = np.ma.masked_where(mask, d1)
    d2 = np.ma.masked_where(mask, d2)

    anom = d1 - d2

    if amin is None:
        amin = -1 * np.max(np.abs(anom))
    if amax is None:
        amax = np.max(np.abs(anom))

    f, axarr = plt.subplots(1, 3, figsize=(13.5, 4), dpi=150)
    f.tight_layout()

    plt.sca(axarr[0])
    sub_plot_pcolor(lons, lats, d1, vmin=vmin, vmax=vmax, ncolors=9,
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
'amap': cmap_discretize('cm.RdBu_r')},
                       'Dsmax': {'vmin': 0,
                                 'vmax': 1,
                                 'amin': -0.5,
                                 'amax': 0.5,
                                 'amap': cmap_discretize('cm.RdBu_r')},
                       'avg_T': {'vmin': -25,
                                 'vmax': 25,
                                 'amin': -2,
                                 'amax': 2,
                                 'amap': cmap_discretize('cm.RdBu_r')},
                       'c': {'vmin': 0,
                             'vmax': 2.5,
                             'amin': -0.5,
                             'amax': 0.5,
                             'amap': cmap_discretize('cm.RdBu_r')},
                       'elev': {'vmin': 0,
                                'vmax': 2500,
                                'amin': -200,
                                'amax': 200,
                                'amap': cmap_discretize('cm.RdBu_r')},
                       'annual_prec': {'vmin': 0,
                                       'vmax': 2000,
                                       'amin': -500,
                                       'amax': 500,
                                       'amap': cmap_discretize('cm.RdBu')}}

    if not plot_atts_9:
        plot_atts_9 = {'soil_density': {'vmin': 0,
                                        'vmax': 4000,
                                        'amin': -500,
                                        'amax': 500,
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
if vmin is None:
        vmin = d1.min()
    if vmax is None:
        vmax = d1.max()

    anom = d1 - d2
    if amin is None:
        amin = -1 * np.max(np.abs(anom))
    if amax is None:
        amax = np.max(np.abs(anom))

    if cmap is None:
        cmap = cmap_discretize('cm.winter')

    if amap is None:
        amap = cmap_discretize('cm.RdBu')

    f, axarr = plt.subplots(3, 3, figsize=(13.5, 9), dpi=150)
    f.tight_layout()

    for layer in pyrange(3):
        plt.sca(axarr[layer, 0])
        sub_plot_pcolor(lons, lats, np.ma.masked_where(mask, d1[layer]),
                        vmin=vmin, vmax=vmax, units=units,
                        ncolors=9, title='{} (A)'.format(t1),
                        cmap=cmap, cbar_location='right',)
        plt.ylabel('Layer {}'.format(layer))
        plt.sca(axarr[layer, 1])
        sub_plot_pcolor(lons, lats, np.ma.masked_where(mask, d2[layer]),
                        vmin=vmin, vmax=vmax,
                        ncolors=9, title='{} (B)'.format(t2), units=units,
                        cbar_location='right', cmap=cmap)
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
amax=None, mask=True, amap=None,
             t1='', t2='', cmap=None):
    """ 9 pannel plot to compare soil layers for two different datasets"""
    if vmin is None:
        vmin = d1.min()
    if vmax is None:
        vmax = d1.max()

    anom = d1 - d2
    if amin is None:
        amin = -1 * np.max(np.abs(anom))
    if amax is None:
        amax = np.max(np.abs(anom))

    if cmap is None:
        cmap = cmap_discretize('cm.winter')

    if amap is None:
        amap = cmap_discretize('cm.RdBu')

    f, axarr = plt.subplots(3, 3, figsize=(13.5, 9), dpi=150)
    f.tight_layout()

    for layer in pyrange(3):
        plt.sca(axarr[layer, 0])
        sub_plot_pcolor(lons, lats, np.ma.masked_where(mask, d1[layer]),
                        vmin=vmin, vmax=vmax, units=units,
                        ncolors=9, title='{} (A)'.format(t1),
                        cmap=cmap, cbar_location='right',)
        plt.ylabel('Layer {}'.format(layer))
        plt.sca(axarr[layer, 1])
        sub_plot_pcolor(lons, lats, np.ma.masked_where(mask, d2[layer]),